Repository navigation
fix(workspace): a typed workspace name names its own branch - #251
Merged
Merged
Conversation
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.
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.
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`.
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.
nplez1
added a commit
that referenced
this pull request
Oct 30, 2026
Merge base f173998, fork tip before this sync 16f49e0 (rollback tag archive/pre-sync-16f49e00cf), upstream tip a903985. 184 conflicted paths / 340 hunks: both-rewrote 98, union 57, rename-replay 10, duplicate-tail 8, modify/delete 8, duplicate-members 2, add/add 1. `conflicts.mjs --apply-proven` proved 38 paths outright (55 import-only unions, 6 upstream- or fork-unchanged whole hunks, 1 identity-only); the remaining 138 were resolved in five disjoint area batches against `local/sync/convergence-ledger.md`, then the sidebar goldens were regenerated from the resolved row model rather than merged. Deletions, all 8 modify/delete entries: - Four renderer dashboard-popout paths, per ledger "Dashboard delivery: a content-area view, not a drawer or a pop-out" (owner decision 2026-10-26). The manifest entries had reverted to `pending-decision` only because upstream's blobs moved. - `ipc/jira/project-metadata-registration.test.ts` and `runtime-client-settings-wsl-host-hooks.test.ts`: upstream test retirements. - `ipc/worktrees-create-first-work-rename.test.ts`: upstream's f5a4a72 implements the fork's #251 and deleted its suite, moving coverage to `worktrees-create-label-only-first-work.test.ts` and `runtime-local-worktree-create.test.ts`. - `task-page-jira-item-source-context.test.ts`: deleted with the move under `task-page/jira/`; the matcher keeps its own suite in `shared/workspace-linked-item-source-context.test.ts`. Breaks the merge left with no conflict marker, all repaired here: - `pr-conversation-response.ts` (upstream's extraction of the PR conversation parser) carried no review-verdict mapping, so the fork's `includeReviewVerdicts` accepted a flag and ignored it. The `state` field, `mapGraphQLReview`, and the shared `isReportableReviewSubmission` keep-rule are re-homed there for both the GraphQL and the REST path. - `local-agent-inventory-refresh.ts` (upstream's extraction) derived isolation only from the floating terminal, dropping the fork's `options.isolated`; the per-workspace enable re-read would have blanked the shared detected list. - `worktree-status.ts` kept two of ten `STATUS_LABELS` entries, so every activity label but `inactive`/`setup` read `undefined`. - `terminal-transient-facts.ts` gained two `getTrackedPtyTitle` declarations — both sides added one for the same synthetic-title producer. Upstream's raw variant stays; the fork's display variant remains as the protected `getTrackedDisplayTitleForPty`. - `agent-state-rules-catalog.ts`: upstream's lazy-parse refactor dropped the fork's `copilot` rule file from the bundled list while upstream never had it. - `use-ai-vault-session-copy-actions.ts` copies the Windows-normalized path again (`formatClipboardFilePath`), now that the panel delegates to the hook. - `jira-issue-mutations.ts`: the non-Error fallback carries `taskProviderFailure('jira.updateFailed', …)` like upstream's. - `git-stream-options.ts` regains upstream's `hostGit?: true` (the fork extracted the type upstream then extended). - Fork files re-pointed at upstream's moves/deletions: `task-page-jira-status- tone` (3 importers), `shared/jira/jira-issue-url` (one depth), `ephemeral-vm-recipe-checkout-mode` (`…Error` -> `…Failure`, now spread as a structured failure), `PRIORITY_LABELS` (retired upstream; the fork's `linear-issue-edit-rows` resolves the copy from the catalog). - `main-window-actions.ts` referenced `getDashboardPopoutWindow` after the fork's own popout deletion; the companion-renderer guard is the workspace space window alone. - `pr-number-lookup.ts`: the fork's `getPRByNumber`/`lookupPRByNumberData` split lost the `options` thread, so `includeStackSummary` was read from an undefined binding. - `host-sync-settings-disposition.ts`: 13 settings upstream added were unclassified; all 13 are `replicated` (preferences and per-host selections), matching `autoRenameBranchFromWorkDefaultedOn` and `browserProfileScope`. - Test fixtures repaired for upstream's new required fields (`indexConsumers`, `pathOwner`, `initialBranchNameOverride`, `worktreeLayoutMode`) and for a doubled `toast` import and a duplicated `getTrackedPtyTitle`. - `i18n`: `setRendererUiLanguage` is restored over upstream's bootstrap, and the fork overlay now derives its directory from `readLocalizationSurface`, so upstream's desktop/mobile split carries it and a surface without an overlay merges to upstream's file unchanged. Localization: 24 orphan keys removed from each of the ten locales (the fork's deleted dashboard popout and four reworded strings), 26 stale tombstones removed from each fork overlay, and the two #169 ack toasts the fork rewords retired from every locale so they fall back to the fork's English overlay instead of rendering upstream's five-placeholder sentence. Rollback: `backup/nplez1-main-pre-sync` and tag `archive/pre-sync-16f49e00cf`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A typed workspace name now names its own branch.
Branch/Workspace Namingcreates the folderBranch-Workspace-Namingand the branchBranch-Workspace-Naming; no marine-creature nameappears anywhere.
Branch/Workspace Naming(typed)Branch/Workspace NamingBranch-Workspace-Naming<- wasmahimahinautilus(typed)nautilusnautilusA blank name is untouched: it still gets a generated creature name for both, that branch is still
eligible for
Auto-rename branch & worktree, and the setting's own copy — "Only branches Orca nameditself are renamed" — is now what the code checks.
Root cause
Upstream
9608420517b("Keep workspace labels independent of automatic branch names", stablyai#32919) addedsrc/main/worktree-create-branch-seed.ts, whose whole job was to discard a typed label and seed thebranch with a random creature name:
The design assumes the first-work rename will replace that placeholder. On the reporting machine it
never runs: after the agent's
workinghook the main-process trace records norev-parse --abbrev-ref HEADfor the worktree and no branch rename, so the creature name is permanent.docs/site/content/docs/first-session.mdxdocuments the behaviour users expect instead — a typed task name is the name, and only a blank one
becomes a creature — so this restores it.
Changes
src/main/worktree-create-branch-seed.ts— it had no other job (rgfinds no remainingreference anywhere in
src/,mobile/,tests/)src/main/ipc/worktree-remote.ts(desktop / remote-host creates) andsrc/main/runtime/runtime-local-worktree-create-candidate.ts(runtime-host creates): drop the seedand fall back to
effectiveSanitizedName, which is what every pre-Keep workspace labels independent of automatic branch names stablyai/orca#32919 create didlabel-2/label-2) instead of a freshcreature name per attempt against a suffixed folder
branchNameWasGeneratedon the worktree meta, stamped by all three create paths(
worktree-remote.ts,runtime-local-worktree-materialization.ts,provisioned-root-checkout.ts)as
nameWasGenerated === true && !branchNameOverride.canRenameOrcaCreatedBranchrequires it notto be
false, so a typed creature word is not renamed out from under the user while a generated onestill is. Legacy workspaces carry no flag and keep today's behaviour
.lockbranching name is rewritten to-lockincomputeBranchName/computeValidatedBranchName, not insanitizeWorktreeName: git refuses a ref, andsanitizeWorktreeNamealso names project containers and clone-placement folders, where rewritingwould have moved a project already called
x.lockinto a new sibling folder. The folder keeps itsname, as it already does for an explicit branch override.
toRefLeafmatches any case, becauserefs/heads/foo.LOCKshares a loose-ref filename withfoo's lock on the case-insensitivefilesystems macOS and Windows use by default
{ worktree, renamed }and one
labelOnlyCreateCasestable carries each row's expected branch and expected rename, so allthree suites assert the same five cases
local/sync/convergence-ledger.md: entry under "Worktree create and removal" so the next syncresolver knows the seed must not come back
Verification
pnpm teston the nine suites covering these paths — 252 passed:runtime-local-worktree-create,worktrees-create-label-only-first-work,worktrees-create-first-work-rename,worktree-logic,first-work-branch-rename,runtime-local-worktree-create-pr-conflicts,worktrees-create-metadata-persistence,provisioned-root-checkout,worktrees-local-create-flow. The table pins the reported input, anASCII label, a CJK label, a typed creature word, and a generated creature name.
canRenameOrcaCreatedBranchfails exactly the typed-nautilusrow;=== truefails exactly the legacy no-flag row;toRefLeaffromcomputeValidatedBranchNamefails exactly the create-path.locktest..lockbehaviour is asserted against real git:git check-ref-format refs/heads/foo.lockexits 1,refs/heads/foo-lockandrefs/heads/foo.LOCKexit 0 — hence the any-case rewrite plus the folderkeeping the name.
pnpm tc:nodeclean (probed: an injected type error makes it exit 1, so the pass is not a no-op).pnpm run check:code-quality:changed— 0 findings across 12 changed files.pnpm check:changedis red for two reasons that are not this diff and reproduce at the basecommit
24ebadb5a8d:max-lines-ratchetflags its own fixture strings intests/tools/upstream-file-comments.test.mjsand holds a stale baseline row forregister-core-handlers.ts; and its unfiltered vitest step exceeds its 300 s step deadline.(the running
Orca NPbuild predates these commits).Review
Reviewed by claude/opus (Opus 5.5), high: R1 clean; R2 clean; R3 clean; R4 clean — no BLOCKER or SHOULD-FIX findings in any round.
Four rounds, each on a committed revision, each a delta from the previous one:
f85f31e) — seed removal is complete and both call sites match their pre-Keep workspace labels independent of automatic branch names stablyai/orca#32919 shape;branchNameOverride,exactBranchName,cliProvenance: created-by-cliandnameWasGeneratedstillwin; collision suffixes keep folder and branch in step; Unicode labels stay valid through
sanitizeWorktreeName+computeValidatedBranchName+git check-ref-format.631b948) — the new meta flag survives thesetWorktreeMetawrite path the same wayorcaCreationSourcedoes, with no field allowlist to extend;!== falseblocks no rename thatshould happen and is the right default for legacy rows made under upstream's seed.
6ded5dd) — moving the.lockrule to the ref builders leaves every create path's branchpassing
check-ref-format(collision suffixes, prefixes, existing-branch checkout, the first-workrename, provisioned roots, CLI/mobile); the project-container hazard is gone.
d5868c8) — the create-path test covers all three return paths ofcomputeValidatedBranchNamewith literal expectations, and the any-case rewrite introduces no newcollision class (conflict checks run on the rewritten name).
Findings below were MINOR/NIT and are recorded rather than fixed:
workspace name. The seed only ever set the branch, and the display name has always come from the
label. That symptom was not reproduced here; its likely cause is a blank or generated name
(
displayNameKind: 'generated'). Out of scope, tracked separately.every future edit must be made twice. Folding them means deleting an upstream-owned file and buying a
sync conflict; deliberately left.
buildProvisionedRootMetastamps the flag but has no test of its own; it needs arepo/settings fixture that does not exist in
provisioned-root-checkout.test.ts, and the stampmirrors the two covered paths.
.locklabel's branch and folder diverge(
foo.LOCK-2vsfoo.LOCK). Cosmetic, and already true of the lowercase case before this PR.foo.LOCKwas a legal ref and is now rewritten tofoo-lock. The branch changes on every platform so the result is the same everywhere; folders anddisplay names are untouched.
Sync note
This reverts a deliberate upstream decision (stablyai#32919). The next sync will conflict on the deleted
src/main/worktree-create-branch-seed.tsand on the two call-site lines; re-apply the revert there.The ledger entry above is the durable record.