Repository navigation
fix(worktrees): retire a created pool name whatever the client claims (STA-4471) - #14919
brennanb2025 wants to merge 1 commit into
Conversation
46294c6 to
910e39c
Compare
7dd1413 to
6ee943d
Compare
Review: CLEAN — merge only as part of the stackIndependent re-verification against head
|
| Path | Test killed by the mutation |
|---|---|
| unit | refuses a retired cwd even when the client sends no provenance bit |
| unit | records a pool-shaped name as spent however the client labelled it |
| local IPC | skips a retired cwd on the local create path when the client omits provenance |
| SSH IPC | skips a retired cwd on the SSH create path when the client omits provenance |
| runtime | skips a retired cwd when an older client omits nameWasGenerated |
Strongest signal in the diff: the three integration tests were green while asserting the bug (leaves a user-typed name reusable…, neither skips nor retires a name the user typed). This PR inverts all three rather than adding alongside them — the old behaviour cannot silently survive.
CI at this head: 44 pass, 1 skipping (static analysis and both Node 24/26 shards included).
Two findings NEW to this pass (neither blocking)
retiresCreatedNamealso drops the provenance gate (:57), which is wider than the PR title suggests — a typed pool-shaped name is now recorded as spent too. This is required for coherence, not incidental scope: refusing retired cwds regardless of provenance while only recording generated ones would burn a directory without a tombstone, and the generator would later reissue that name onto spent state. Correctly pinned by therecords a pool-shaped name as spent however the client labelled ittest.- Compaction watermark — checked, no gap. The typed ladder uses plain
-2/-3suffixes and does not skip ahead pastexhaustedTiers, which looked like a hole for compacted tiers. It isn't:createRetiredNameLookuptests the watermark independently of the explicit name set, so those rungs are still refused. They cost pure string math and no attempt budget (thecontinueskipsattempts += 1), andclampExhaustedTiersbounds the walk — no spin.
Also confirmed unchanged: the display-name (requestedName) suffixing logic is preserved exactly across all three call sites; the old shouldRetireGeneratedName and the new usesGeneratedLadder are the same predicate.
Explicitly NOT covered
- No independent same-model review round. This PR had 0 reviews and 0 comments before this one. This pass is a single reviewer; treat it accordingly.
- Test-proven vs reasoned. Test-proven: the provenance-independent refusal and recording on all three create paths, and registry-skip for non-pool names. Reasoned only: the merge-order hazard (argued from the call graph and the absent deadline — no stalled-mount repro was run) and the prior-art verdict.
- No rendered surface. The diff is main-process only (
src/main/**, no renderer files), so there is no UI to screenshot — the user-visible effect is a workspace silently namednautilus-2instead ofnautilus, with no UI change. Not a screenshot gap. - SSH execution hosts.
ensureRetiredWorktreeNamesBackfilledreturns early forrepo.connectionId, so a re-added SSH repo still does not recover retirements from its execution host. Pre-existing and documented in-module, not introduced here.
6ee943d to
d1097eb
Compare
|
Too many files changed for review (400 files, 100 file limit). Bypass the limit by tagging |
d1097eb to
43b76d3
Compare
📝 WalkthroughWalkthroughAdds 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 40c3df5d-4031-40b7-b0be-3b57e6c44d54
📥 Commits
Reviewing files that changed from the base of the PR and between d1127b9 and d1097eb7eadfb9f10cbc8d0109a3e3a122c33173.
📒 Files selected for processing (7)
src/main/ipc/worktree-remote.tssrc/main/ipc/worktrees-ssh-pr-head-fetch.test.tssrc/main/ipc/worktrees-windows.test.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/worktree-create-name-plan.test.tssrc/main/worktree-create-name-plan.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.
43b76d3 to
9572730
Compare
Review loop — final statusRebased onto What changed in this loopThe product call. The previous revision refused a retired cwd regardless of provenance, so typing A correction to this PR's own premise. The old body framed the ambiguous population as "older Registry load tightened. With the provenance gate restored, nothing on the typed path consults the Three tests were flipped back to #14350's expectations and strengthened to also assert the Rounds run — and an honest accountI ran one substantive round, and it is my own, not a subagent's. Five dispatched reviewers What I verified directly, with evidence, is below. Non-vacuityReverting production only ( 3 behavioural RED across all three create paths. Reported separately, and not counted as Mutation testing
No coverage hole on any of the three decisions. Mutation 1 additionally flipped one unrelated test Checked, found nothing
Design auditCONFORMS WITH CAVEATS. Derived fresh against the problem rather than by re-reading the earlier
Visual proofThere is a rendered surface, and it was exercised in the running dev build (CDP 9333, throwaway
What I could not prove
|
Correction to the review-loop comment aboveI mischaracterised why the dispatched reviewers produced nothing, and the accurate version matters for I wrote that the four review workers "ran for hours past explicit time boxes without producing a report." So the correct diagnosis is report delivery in this session was broken, not that the agents hung. What does not change: there is still no second pair of eyes on this PR. The round documented above Also updating one status line: Everything else in the comment above — the code change, the mutation table, the non-vacuity counts, the |
… (STA-4471) #14350 gated the whole of generated-name retirement on the new optional `nameWasGenerated` bit, conflating two decisions that pull in opposite directions: - *Which cwd a create may land on* genuinely belongs to the client. A generated name is one of ours — nothing was chosen — so folding it onto the canonical tier ladder and stepping over cwds this host already spent costs the user nothing. A name the user typed is a request; `nautilus` stays `nautilus` even where that cwd is retired, because silently handing back `nautilus-2` is the worse surprise. This half stays gated, and clients that predate the bit are read as typing users, exactly as before #14350. - *Whether the created name is recorded as spent* never belonged to the client. An older paired or mobile client omits the bit but still hands back pool-shaped names, and a registry that never learns about them lets the very next generated create collide with one. Recording is only ever a write — `addRetiredWorktreeName` self-gates on pool shape, so a coined name like `fix-login` is never recorded, and no recorded name ever redirects a typed one. The three create paths — `OrcaRuntimeService.createManagedWorktree` (runtime, mobile, CLI), `createRemoteWorktree` (SSH) and `createLocalWorktree` (desktop IPC) — each carried their own copy of the gate plus candidate selection, which is how one rule ended up applied inconsistently. They now share `planWorktreeCreateNames`, which is unit-tested directly. No wire change: no new field, no new opcode, nothing removed from what the host publishes. A name outside the creature pool never loads the registry, and neither does a typed name, so neither pays for the deadline-less backfill scan.
9572730 to
f11a4f2
Compare
Round 2 — the missing reviews arrived, and they found somethingThe two reports I said were undeliverable came through after all. Both were substantive, and one found a P2 coverage hole — FOUND, CONFIRMED, FIXED
Why it matters: the failure paths are where a blind registry bites hardest. A client that never sent the Fixed with two tests on the rollback path: one asserting a pool-shaped name is recorded with no Suite is green at 1215 passed / 1 skipped. Two review suggestions I checked and declined — with reasonsA generator instead of
Corroboration worth recordingThe independent review confirmed several things I had asserted, by different routes: the One thing it caught that I had not: Design audit — full verdict now availableCONFORMS WITH CAVEATS, consistent with what I derived independently, with more detail. The Silently suffixing a typed name is the common answer; this PR is more conservative than that. Also unproven, so absence of objection should not be read as endorsement: a permanent non-evicting Where this leaves the loopRound 2 found and fixed a defect, so by the stopping rule this is not a clean round — a further round Standing risk for whoever picks this up: the fix above touched only tests plus one comment, so the |
CI is queued, so I ran its gates locally on
|
| gate | result |
|---|---|
typecheck (all projects) |
clean |
audit:code-quality:native (--deny-warnings) |
clean |
audit:code-quality:type-aware (--deny-warnings) |
clean |
check:max-lines-ratchet |
OK — 188 grandfathered, no new bypasses |
check:reliability-gates |
passed, 88 gates |
oxfmt |
clean |
| affected suites (4 files) | 1215 passed / 1 skipped |
The max-lines ratchet is the one worth calling out: this round added ~45 lines to
orca-runtime.test.ts, which is already large, and the ratchet still passes with no new bypass.
This is not a substitute for CI — it does not cover packaging, Windows, the Git-compatibility matrix, or
cross-version wire compatibility. Those still need the real run before merge.




Fixes STA-4471 (P2). Incomplete-fix follow-up to #14350.
Retargeted onto
mainand rebased. The original base,brennanb2025/fix-4449-4491(#14917),merged; its commit is dropped from this branch. Nothing is stacked above this PR any more.
The defect
Orca auto-names new workspaces from a pool of creature words (
nautilus,orca,runner,emperor…). #14350 introduced retirement: once a generated workspace's cwd is spent, a latergenerated create steps over it so the new workspace does not inherit the previous occupant's
Claude/Codex conversation history.
#14350 gated all of that on one new optional client field:
That single flag was made to answer two questions that pull in opposite directions, and the second
one is not the client's to answer:
nameWasGeneratednameWasGeneratedThe second row is the bug. A client that omits the field creates
nautilus, and the registry neverlearns about it. The very next generated create on that repo is free to pick
nautilusagain andland on the same cwd — which is exactly the collision retirement exists to prevent.
The fix
planWorktreeCreateNamessplits the two decisions:nameWasGenerated. A generated name is one ofours — nothing was chosen — so folding it onto the canonical tier ladder and stepping over spent
cwds costs the user nothing. A name the user typed is a request:
nautilusstaysnautiluseven where that cwd is retired, prior agent history and all. Silently handing back
nautilus-2is the worse surprise, and the pool is ordinary English that people type on purpose.
shape alone (
retiresCreatedName: isPoolShaped). Recording is only ever a write. It neverredirects anybody, and
addRetiredWorktreeNameindependently re-checks pool shape, so a coinedname like
fix-loginis still never recorded.Note on the "absent" case: every producer strips the field when false
(
...(nameWasGenerated ? { nameWasGenerated: true } : {})), so the host only ever seestrueorabsent — absent covers both older clients and every current client creating a typed name. Reading
absent as typed is therefore not a concession to old peers; it is the common path, and it matches
pre-#14350 behaviour exactly.
The cost this accepts, stated plainly
Two consequences follow, and both are deliberate:
occupant's Claude/Codex history — the exact harm the registry exists to prevent. That is the accepted
price of "an explicitly typed name wins." It fires only against a name the user chose, and only where
they chose the same word twice; a generated name is still redirected every time.
did. Not an exhaustion risk — the pool is 552 names across unbounded tiers, and completed tiers
compact into a watermark — but it is a behaviour change beyond the reported bug.
What this replaces
An earlier revision of this PR enforced the skip on both paths regardless of provenance, so
typing
nautiluson a retired cwd returnednautilus-2. That is reverted. Per the product call,auto-generated names may be redirected; a name the user typed may not.
Shape
The three create paths —
OrcaRuntimeService.createManagedWorktree(runtime/mobile/CLI),createRemoteWorktree(SSH) andcreateLocalWorktree(desktop IPC) — each carried their own copyof the gate plus candidate selection, which is how one rule ended up applied inconsistently. They
now share
src/main/worktree-create-name-plan.ts, which is unit-tested directly.Performance
The typed path no longer loads the retirement registry at all.
getRetiredNameRegistryForRepocalls
ensureRetiredWorktreeNamesBackfilled, whosereaddirscan is unbounded and whose Promise iscached forever (STA-4473). Gating the load on the generated ladder rather than on pool shape means a
user typing a pool word on a stalled NFS/SMB/WSL-UNC workspace root pays nothing — so this PR no
longer widens STA-4473's exposure at all, and no longer needs to land with #14924.
Wire compatibility
No wire change: no new field, no new opcode, nothing removed from what the host publishes. Per
docs/reference/remote-wire-compatibility.mdRule 1, the failure #14350 introduced is precisely theone that rule warns about — a host that requires a new optional field is broken against every
peer that predates it. Enforcement of the write half moved to the host, which is what makes it hold
for those peers; the read half stays advisory, which is what keeps typed names intact.