Address CodeRabbit review

- 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]>
This commit is contained in:
Theo BrowneandClaude Opus 5 committed 2026-07-24 17:38:23 -07:00
1 parent 0555604ded
commit 827469be4d
5 files changed
+95 -11

No files matched your search

+4 -2
View File
@@ -44,10 +44,12 @@ Ports resolve in this order, first match winning:
1. `T3CODE_PORT_OFFSET=<n>` — exact numeric offset, full control.
2. `T3CODE_DEV_INSTANCE=<value>` — numeric offset, or a hashed one for non-numeric values. Example: `T3CODE_DEV_INSTANCE=branch-a vp run dev:desktop`
3. **Git worktree** — the offset is hashed from the worktree path, so every worktree gets its own stable pair that survives restarts and doesn't collide with its siblings.
3. **Git worktree** — the offset is hashed from the worktree path, so a worktree gets the same preferred pair every time instead of everyone starting at the default and racing for it.
4. Otherwise the defaults: server `13773`, web `5733`.
Whatever the source, both ports are then checked on loopback and shifted together if either is taken. The resolved values are printed on the `[dev-runner] …` line; `--dry-run` prints them without starting anything. Read them from there rather than assuming the defaults.
Whatever the source, this only picks a _preferred_ offset. Both ports are then checked on loopback and shifted together if either is taken, so two worktrees whose hashes collide — or one whose ports something else already holds — still start, just not on the offset they asked for. Ports are stable across restarts in practice, not guaranteed.
Which means: read the resolved values from the `[dev-runner] …` line rather than assuming them, and re-read them after a restart. `--dry-run` prints them without starting anything (it resolves only — it will not touch a `--share` mapping).
## Browser dev is single-origin