An isolated dev database starts empty, which makes any list- or
thread-shaped UI impossible to look at without hand-writing fixtures.
`dev:seed` copies the newest threads and their projects out of the
shared home into the worktree's own database.
Projections only — `orchestration_events` is never copied. The projector
cursor is exclusive, so an empty event log means bootstrap streams
nothing and leaves the copied rows alone; a partial event range is the
real hazard, since the projector would replay a tail whose creating
events are missing.
Details that matter for a usable copy:
- writes all nine projection_state rows, or computeSnapshotSequence
reports 0 for every shell snapshot
- forces sessions to stopped with no active turn, since a copied
"running" session has no agent behind it and the reaper skips
anything with an active turn
- zeroes pending approval/input counts, as approvals are not copied
- copies the intersection of columns, because the two databases are
routinely on different migrations
- refuses to write to the shared home
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A dev server started in a worktree resolved its data directory to the
shared `~/.t3`. Worse, an ambient `T3CODE_HOME` counts as an *explicit*
base dir, which flips the state directory from `<base>/dev` to
`<base>/userdata` — the database the user's installed T3 Code is
actively running against. Feature work in a throwaway branch was
sharing a database with the user's real app, and its
`server-runtime.json` overwrote the live server's entry.
Worktrees now default to their own gitignored `.t3`, outranking the
ambient env var; `--home-dir` still wins, and the main checkout keeps
`~/.t3/dev`. `auth pairing url` applies the same default, so `dev:pair`
from a worktree can no longer mint a credential into the real database.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
- The skill told agents both to never put a pairing URL in a response and
to hand the shared one to the user. State the rule and its single
exception explicitly: give the URL to the person who asked for access,
never put it anywhere durable.
- A failed `tailscale serve` left the port unshared, because the stale-
mapping clear had already run. The clear is still required (old
mappings carry path routes that serving "/" would not replace), so say
so in the error instead of letting an operator assume the previous
mapping survived.
- Worktree-derived ports were described as collision-free. They are a
preferred offset, not a guarantee — hashes can collide and occupied
ports shift both values. Qualified in AGENTS.md, the skill, and
docs/reference/scripts.md.
CodeRabbit also asked for tests around the pairing-url command; those
landed in 0555604de, which it had not yet seen.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
- `auth pairing url` resolved the state directory with the same flag
heuristic the command exists to hide, so without --dev-url it read
`userdata` while `bun run dev` writes to `dev`. It then minted into the
wrong database and printed a URL the live server rejects with
`invalid_credential`. It now searches both state directories and issues
against whichever one the running server actually uses.
- A server killed with SIGKILL leaves `server-runtime.json` behind, and
that was taken as proof it was still up. Verify the recorded pid is
alive before minting.
- `--dry-run --share` replaced and then tore down the port's existing
tailscale mapping. Dry run now returns before the share block.
deriveServerPaths takes an optional explicit stateDir for callers that
have already located a running server and must target it exactly.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Browser dev is now single-origin: Vite proxies /api, /ws, /oauth, and
/.well-known to the backend, and dev/dev:web no longer bake
VITE_HTTP_URL/VITE_WS_URL into the bundle. Absolute localhost URLs in the
bundle sent any remote browser to its own machine, which no amount of
external path mapping could fix.
- `dev --share` publishes the web port on the tailnet and logs a pairing
URL already built against that origin
- `dev:pair` mints a pairing URL for a running server, resolving port and
state dir from server-runtime.json
- Ports derive from the worktree path, so each worktree is stable across
restarts; the availability probe is loopback-only so `tailscale serve`
can't push the port
- Web session cookies are port-scoped like desktop's, ending the
cross-instance "Invalid session token signature" loop
- Dev startup pairing tokens last 24h instead of 5m; user-issued links
keep the 5m default
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>