Repository navigation
Keep workspace labels independent of automatic branch names - #32919
Conversation
|
No actionable comments were generated in the recent review. ℹ️ Recent review info
Walkthrough
Priority: Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
61aa46c6-9327-45e6-b881-116203e0449a
📒 Files selected for processing: 33
mobile/src/components/NewWorktreeModal.tsxmobile/src/components/use-new-workspace-create-submit.tsmobile/src/tasks/blank-workspace-create.test.tsmobile/src/tasks/blank-workspace-create.tsmobile/src/tasks/worktree-create-capability.test.tsmobile/src/tasks/worktree-create-capability.tssrc/main/agent-hooks/first-work-branch-rename-test-harness.tssrc/main/agent-hooks/first-work-branch-rename.test.tssrc/main/agent-hooks/first-work-branch-rename.tssrc/main/agent-hooks/first-work-generated-branch-contract.test.tssrc/main/agent-hooks/first-work-rename-runtime.tssrc/main/git/branch-rename.test.tssrc/main/git/branch-rename.tssrc/main/ipc/worktree-display-name.tssrc/main/ipc/worktree-remote.tssrc/main/persistence/loading-store/worktree-meta-write-normalization.tssrc/main/runtime/construction/runtime-file-command-state.tssrc/main/runtime/rpc/methods/worktree-create-args.test.tssrc/main/runtime/rpc/methods/worktree-create-args.tssrc/main/runtime/runtime-git-command-target.tssrc/main/runtime/runtime-git-status-commands.tssrc/main/runtime/runtime-local-worktree-create-candidate.tssrc/main/runtime/runtime-local-worktree-materialization.tssrc/main/runtime/runtime-managed-worktree-create-types.tssrc/main/worktree-generated-branch.tssrc/renderer/src/store/slices/worktrees/create/create-worktree.tssrc/renderer/src/store/slices/worktrees/create/worktree-create-payload.tssrc/renderer/src/web/preload-api/web-worktree-attachment-mutations.test.tssrc/renderer/src/web/preload-api/web-worktrees-api.tssrc/shared/rpc-contract/worktree-create-params.tssrc/shared/worktree-runtime-capabilities.tssrc/shared/worktree/create-types.tssrc/shared/worktree/meta-types.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
-
⚙️ Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
ebc564ff-d46f-436f-867f-9748e075f107
📒 Files selected for processing: 6
-
src/main/ipc/worktree-remote.tssrc/main/ipc/worktrees-create-metadata-persistence.test.tssrc/main/runtime/runtime-local-worktree-create-candidate.tssrc/main/runtime/runtime-local-worktree-create.test.tssrc/main/worktree-create-branch-seed.tssrc/main/worktree-create-first-work-test-harness.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
-
|
Japanese workspace labels could become branches that never received a name from first work, because creation used the label while first-work naming recognized only creature placeholders. Label-only creation now seeds a creature branch independently of the label's language. Ordinary Japanese and Latin labels keep their existing pinned display name as first work names the branch. The implementation shares seed selection between desktop and runtime creation and retains the existing first-work guards. Explicit Advanced branches and CLI names are never re-seeded; automatic naming off retains the existing branch behavior. There is no new saved field, wire field, capability, setting or UI. Intended common-pattern differences remain as approved: explicit creature-shaped branches can still rename, and checking out another branch and back before first work can still allow renaming. #7201 is outside this change and is not claimed fixed. Review: two full review rounds across the superseded and replacement designs, plus bounded test-only CI follow-ups. The replacement and final test corrections are accepted, all eleven integrated cases retained, whole-mechanism reference comparison complete, no open findings or deferrals. The final main sync was f9707da, without conflicts; production remains 41 changed lines across three files. Subsequent commits changed tests only. Validation: creator-to-first-work integration cases cover Japanese, Latin and empty labels through both actual creators, returned labels/full Git refs, explicit Advanced branches, CLI provenance and automatic naming off. The final creator suites passed 72 tests; existing first-work and actual CLI-command coverage also passed. CI is fully green on 6d217f0, including static analysis/typecheck, all five unit shards, packaging, persistence and WSL checks. Four CI fixture diagnostics were corrected without production changes or rule suppressions. Targeted real QA passed on Windows high spec at the exact final head. Main's Japanese branch stayed label-derived after a real Claude reply. The PR's Japanese/Claude flow renamed For Brennan's review: Main after first work (Japanese/Claude): PR Japanese/Claude:
PR Latin/Codex:
|
#32919 gave typed workspace names a creature placeholder branch so first-work naming could rename it. When generation fails or never runs, users are left on branches like geoduck instead of the name they typed. Typed names are valid branches in any script, so use them directly; auto-rename keeps applying to Orca-generated creature names only.
* fix(workspace): a typed workspace name names its own branch Upstream 9608420 (stablyai#32919, "Keep workspace labels independent of automatic branch names") made `selectWorktreeCreateBranchSeed` throw the typed label away and seed the branch with a random marine-creature name, so the first-work AI rename could name the branch from the agent's work later. The label was only ever a display name. That leaves a workspace created as "Branch/Workspace Naming" sitting on branch `mahimahi` — the folder is right, the branch is a fish — and it stays there rather than being renamed: on this machine the first-work rename never runs (the trace log records no branch-rename git call after the agent's `working` hook), so the creature name is permanent rather than transient. `docs/site/content/docs/first-session.mdx` documents the behaviour users expect: a typed task name is the name, and only a blank one falls back to a creature. So a typed label now seeds its own branch: the create path falls through to `effectiveSanitizedName`, which is what every pre-stablyai#32919 create did, and which keeps `-2` collision suffixes in the directory and branch together. `selectWorktreeCreateBranchSeed` had no other job, so it and its two call sites go. Unchanged: a blank name still gets a generated creature name for both the workspace and the branch, and that branch is still creature-shaped, so the first-work rename can still improve it. Only typed labels lose the rename, which is the point — the branch is already the name the user chose. Verification: `pnpm test` on the three first-work harness suites, `runtime-local-worktree-create.test.ts` (40 passed), `runtime-local-worktree-create-pr-conflicts.test.ts`, `first-work-branch-rename.test.ts`, `worktrees-create-base-status.test.ts`; `pnpm tc:node`; `pnpm run check:code-quality:changed`. Sync note: this reverts a deliberate upstream decision, so the deleted `src/main/worktree-create-branch-seed.ts` is a modify/delete conflict on the next sync. It is not registered in local/sync/expected-deletions.json because that register holds settled fork decisions, not PR-branch state. * fix(workspace): keep a typed creature word, and accept .lock labels Two review findings from the first round, both about a typed name losing out to machinery that assumes Orca named the branch. A typed label that happens to be a creature word (`nautilus`) was still renamed on first work: eligibility tested the branch shape only, so the user's own name came back as an AI slug. The create paths now stamp `branchNameWasGenerated` on the worktree meta — `nameWasGenerated === true` and no branch override — and `canRenameOrcaCreatedBranch` requires it not to be `false`. That is the signal the setting's own copy promises ("Only branches Orca named itself are renamed"); a blank name still gets a creature name for both label and branch and stays rename-eligible. Legacy workspaces carry no flag, so they keep today's behaviour rather than losing a rename they always had. A label ending in `.lock` produced a ref `git check-ref-format` rejects, so the create failed at the last step. `sanitizeWorktreeName` now rewrites the suffix to `-lock`, next to the `..` rule it already had for the same reason. Only the lowercase suffix is rewritten: git accepts `.LOCK`. Also records the revert in local/sync/convergence-ledger.md under "Worktree create and removal", so the next sync resolver knows the creature seed must not come back. Verification: 225 tests across the seven suites covering these paths, `pnpm tc:node`, `pnpm run check:code-quality:changed`. The new typed `nautilus` row fails if the gate ignores the flag (checked by neutering it), and the `.lock` rewrite is asserted against what `git check-ref-format` actually accepts. * fix(workspace): put the .lock rule on refs, and pin the gate's edges Round 2 left three findings worth acting on, plus two coverage gaps. The `.lock` rewrite moves from `sanitizeWorktreeName` to the branch-name builders. A ref is what git refuses, not a directory: `sanitizeWorktreeName` also names project containers and clone placement folders, so rewriting there would have moved a project already called `x.lock` into a new sibling folder. `computeBranchName` and `computeValidatedBranchName` now rewrite the leaf, which also covers the first-work rename's generated slugs; the folder keeps the name, the way it already does for an explicit branch override. `buildProvisionedRootMeta` stamps `branchNameWasGenerated` too, so a typed creature word on the provisioned-root path is not renamed out from under the user either. Coverage for the two edges round 2 named: a workspace whose meta predates the flag still gets its generated creature branch renamed (asserted by deleting the flag from a real create's meta and running the real gate), and a generated name with an explicit branch override stamps `false` and is never renamed. Both were checked for teeth by tightening the gate to `=== true`, which fails exactly the legacy case. Verification: 251 tests across the nine suites covering these paths, `pnpm tc:node`, `pnpm run check:code-quality:changed`. * test(workspace): pin the `.lock` rewrite on the create path Round 3's one MINOR: the new `.lock` test covered only `computeBranchName`, which the first-work rename uses, so deleting `toRefLeaf` from `computeValidatedBranchName` — the builder every local and remote create actually goes through — would have left the suite green. It now has its own cases for the bare, custom-prefix and git-username shapes, checked for teeth by removing the rewrite and watching exactly that test fail. Also widens `toRefLeaf` to `.lock` in any case. git's check-ref-format only rejects the lowercase suffix, but `refs/heads/foo.LOCK` occupies the same loose-ref filename as `foo`'s lock file on the case-insensitive filesystems macOS and Windows use by default, so a later update of branch `foo` would fail with "Unable to create ... lock: File exists". Rewriting both cases avoids creating such a ref; the folder still keeps the name.





A workspace labelled in Japanese could keep its label-derived Git branch instead of receiving a branch name from its first work. Creation used the display label as the branch seed, while first-work naming only recognized creature placeholders.
Label-only workspaces now start on a creature placeholder independently of the label's language. Japanese and Latin labels remain pinned as the workspace display name, and the existing first-work mechanism renames the placeholder from the work. Desktop and runtime creation share the seed selection. Empty labels retain the existing generated-name path.
Explicit Advanced branch names and CLI
--nameretain their existing creation path. Turning automatic naming off leaves the existing label-derived branch behavior. No saved field, wire field, capability, migration, new setting, control or notice is added. Old phones use their existing request shape; new owners select the seed locally, while old owners keep their shipped behavior.Intended differences from the common pattern:
The earlier saved-provenance design has been replaced by this current-state mechanism under the 10-23 decision. The symbolic-HEAD probe from #7201 is omitted: this change does not alter detached or unborn HEAD handling and does not claim to resolve that issue.
Validation: full-path review and whole-mechanism reference comparison are complete, with no open in-scope findings. The once-only main sync is f9707da; later corrections change tests only. Creator-to-first-work integration cases cover Japanese, Latin and empty labels, exact returned labels, explicit Advanced branches, CLI provenance and automatic naming off. The final creator suites passed 72 tests; existing first-work and actual CLI-command coverage passed another 53. Normal pre-commit checks and all CI checks are green on 6d217f0.
Targeted real QA passed on Windows high spec at that exact head, with normal setup/default tabs and real native-agent replies. Main kept its Japanese label-derived branch. On this PR, Japanese/Claude changed
pelicantoadd-greeting-fileand createdgreeting.txt; Latin/Codex changedterntoadd-greeting-notes-fileand creatednotes.txt. Both exact display labels stayed fixed. The report, both actual driver records, Git/files and five full-window screenshots were inspected; test copies stopped gracefully and recorded processes exited. Other creation variants are covered by integration tests; no lifecycle or mobile matrix was run for this seed-selection change.tracked in STA-11403
Why this is better
Before this PR, what branch you got depended on the language of the label you typed. Type a label in English and Orca turned it into the branch name, and kept that name forever. Type a label in Japanese (or any script that can't become a branch name) and you got a leftover name that also never changed to match what you actually worked on. The same action gave different results depending on the alphabet.
With this PR, every workspace you give only a label works the same way, in any language. The label stays exactly as you typed it as the workspace's name. The branch starts with a temporary name and gets a real name from your first piece of work, the same way a workspace with no label already did. A branch name you type yourself is still used as is and never renamed.
Is this what people expect? Yes. When you don't choose a branch name yourself, the common pattern is a temporary branch that gets renamed from your first message, which is what Orca already did for workspaces with no label. The workspace name and the branch are separate things: renaming one doesn't change the other.
Why this design and not the earlier one on this PR. The first version of this PR saved extra records about which branches Orca had created, to decide later which ones it may rename. It grew past 780 lines and still wasn't finished. This version reuses the rename Orca already has, adds no saved data, and is about 40 lines. Older phones and paired servers keep working unchanged.
What changes for people who type English labels. Until now an English label also became the branch name. With this PR the branch instead gets its name from the first work, like everywhere else. If you want a specific branch name, type it in the branch field.