Skip to content

Keep workspace labels independent of automatic branch names - #32919

Merged
brennanb2025 merged 7 commits into
mainfrom
brennanb2025/sta-11403-auto-branch
Oct 26, 2026
Merged

brennanb2025 merged 7 commits into
mainfrom
brennanb2025/sta-11403-auto-branch

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

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 --name retain 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:

  • Orca uses its existing creature placeholders and managed-worktree, unpublished-branch and live-HEAD guards. The first-work rename implementation is unchanged.
  • An explicitly typed creature-shaped branch can still be renamed on first work, as today. Explicit names are never re-seeded at creation.
  • Checking out another branch and back before first work can still allow renaming, as today.
  • Display labels remain pinned independently of branch naming. Direct SSH and existing workspaces retain their existing paths.

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 pelican to add-greeting-file and created greeting.txt; Latin/Codex changed tern to add-greeting-notes-file and created notes.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.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 23, 2026 20:52
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

ℹ️ Recent 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: bd86f541-c5d2-425c-a68c-2534223cd2a7
📥 Commits

Reviewing files that changed from the base of the PR and between a32d55c and 6d217f0.

📒 Files selected for processing: 3
  • src/main/ipc/worktrees-create-metadata-persistence.test.ts
  • src/main/ipc/worktrees-test-module-mocks.ts
  • src/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.

Walkthrough

Worktree creation now uses eligible user-provided display labels as branch-name seeds when automatic branch renaming is enabled. Branch overrides and CLI-created names do not use these seeds. Local and remote creation use the selected seed for branch candidates, with the sanitized worktree name as fallback. Tests cover branch creation, first-work renaming, and cases that preserve the selected branch.

Priority: Low

Merge Risk: Minimal · up to 6d217

Label-only workspaces retain their display names while starting on creature branches that can be renamed on first work. No actionable merge-blocking risk remains after normal checks.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 23.68% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 38 functions across 38 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description gives a detailed explanation of the change, rationale, scope, testing, and QA results. However, it does not follow the required template structure. It lacks the required linked issue f… Reformat the description using all template headings. Add an actual issue link in the Fixes #... section instead of only tracked in STA-11403. Attach the referenced before/after screenshots or state N/A with a reason. Complete the Tes…
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: keeping workspace labels independent from automatic branch names.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description gives a detailed explanation of the change, rationale, scope, testing, and QA results. However, it does not follow the required template structure. It lacks the required linked issue format, visual proof or an explicit N/A statement, testing checklist, AI disclosure, review sections, agent-skill boundary, notes, and final checklist.

Resolution

Reformat the description using all template headings. Add an actual issue link in the Fixes #... section instead of only tracked in STA-11403. Attach the referenced before/after screenshots or state N/A with a reason. Complete the Testing, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections, including the required test and platform status.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
📥 Commits

Reviewing files that changed from the base of the PR and between cd1f190 and 967b40c.

📒 Files selected for processing: 33
  • mobile/src/components/NewWorktreeModal.tsx
  • mobile/src/components/use-new-workspace-create-submit.ts
  • mobile/src/tasks/blank-workspace-create.test.ts
  • mobile/src/tasks/blank-workspace-create.ts
  • mobile/src/tasks/worktree-create-capability.test.ts
  • mobile/src/tasks/worktree-create-capability.ts
  • src/main/agent-hooks/first-work-branch-rename-test-harness.ts
  • src/main/agent-hooks/first-work-branch-rename.test.ts
  • src/main/agent-hooks/first-work-branch-rename.ts
  • src/main/agent-hooks/first-work-generated-branch-contract.test.ts
  • src/main/agent-hooks/first-work-rename-runtime.ts
  • src/main/git/branch-rename.test.ts
  • src/main/git/branch-rename.ts
  • src/main/ipc/worktree-display-name.ts
  • src/main/ipc/worktree-remote.ts
  • src/main/persistence/loading-store/worktree-meta-write-normalization.ts
  • src/main/runtime/construction/runtime-file-command-state.ts
  • src/main/runtime/rpc/methods/worktree-create-args.test.ts
  • src/main/runtime/rpc/methods/worktree-create-args.ts
  • src/main/runtime/runtime-git-command-target.ts
  • src/main/runtime/runtime-git-status-commands.ts
  • src/main/runtime/runtime-local-worktree-create-candidate.ts
  • src/main/runtime/runtime-local-worktree-materialization.ts
  • src/main/runtime/runtime-managed-worktree-create-types.ts
  • src/main/worktree-generated-branch.ts
  • src/renderer/src/store/slices/worktrees/create/create-worktree.ts
  • src/renderer/src/store/slices/worktrees/create/worktree-create-payload.ts
  • src/renderer/src/web/preload-api/web-worktree-attachment-mutations.test.ts
  • src/renderer/src/web/preload-api/web-worktrees-api.ts
  • src/shared/rpc-contract/worktree-create-params.ts
  • src/shared/worktree-runtime-capabilities.ts
  • src/shared/worktree/create-types.ts
  • src/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.

Comment thread src/main/ipc/worktree-remote.ts Resolved
@brennanb2025 brennanb2025 changed the title Automatic branch names work the same for workspace labels in every language Keep workspace labels independent of automatic branch names Oct 23, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
📥 Commits

Reviewing files that changed from the base of the PR and between 967b40c and a32d55c.

📒 Files selected for processing: 6
  • src/main/ipc/worktree-remote.ts
  • src/main/ipc/worktrees-create-metadata-persistence.test.ts
  • src/main/runtime/runtime-local-worktree-create-candidate.ts
  • src/main/runtime/runtime-local-worktree-create.test.ts
  • src/main/worktree-create-branch-seed.ts
  • src/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.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

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 pelican → add-greeting-file and created greeting.txt; Latin/Codex renamed tern → add-greeting-notes-file and created notes.txt. Both exact pinned labels remained. Each send produced a real reply; Git, files, actual drive.json records and all five genuine full-window images were checked. Copies stopped gracefully and all recorded app/driver/keeper processes exited; the gate ticket is released. The run covered these local Git flows; integration tests cover empty labels, explicit Advanced/CLI paths, setting off and both creators. No lifecycle/mobile matrix was run because the replacement adds no saved or wire state.

For Brennan's review:

Main after first work (Japanese/Claude):

Main: Japanese label-derived branch remains

PR Japanese/Claude:

Before first work After real reply
Japanese: pelican placeholder Japanese: add-greeting-file, label retained

PR Latin/Codex:

Before first work After real reply
Latin: tern placeholder Latin: add-greeting-notes-file, label retained
  • Seed selection: label intent selects a placeholder; explicit choices and CLI provenance preserve their creation path.
  • Existing first-work guards: current branch shape, managed eligibility and publication/live-HEAD checks remain unchanged.

@brennanb2025
brennanb2025 merged commit 9608420 into main Oct 26, 2026
39 checks passed
nwparker added a commit that referenced this pull request Oct 29, 2026
#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.
nplez1 added a commit to nplez1/orca that referenced this pull request Oct 30, 2026
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant