Repository navigation
feat(composer): choose a base ref in the New Workspace composer - #17250
Conversation
Greptile SummaryThe PR separates workspace naming-source intent from the selected creation base and adds a base-ref picker to eligible New Workspace composer states.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/renderer/src/hooks/composer-state/workspace-identity-state.ts | Adds and restores the state that distinguishes a naming branch from an independently selected creation base. |
| src/renderer/src/hooks/composer-state/branch-start-point-actions.ts | Marks base refs selected through the standalone picker as independent from workspace naming. |
| src/renderer/src/hooks/composer-state/work-item-source-actions.ts | Marks branches selected through the name field as both the workspace source and creation base. |
| src/renderer/src/components/new-workspace/NewWorkspaceComposerNameSection.tsx | Conditionally renders the new base-ref control beneath the workspace name field. |
| src/renderer/src/components/new-workspace/ComposerBaseRefPicker.tsx | Adapts the shared repository picker to optional composer base-branch state and resets picker-local state by repository. |
| src/renderer/src/components/repo/CreateFromPicker.tsx | Moves the shared picker into the repository component area and permits branch searches with empty or one-character queries. |
| src/renderer/src/hooks/composer-state/draft-target-sync.ts | Persists base-branch naming intent alongside an explicitly selected base branch. |
| src/renderer/src/store/slices/ui.ts | Extends the saved New Workspace draft shape with optional base-branch naming intent. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Workspace name or linked issue] --> B[Composer source selection]
C[Branch from picker] --> D[baseBranch]
C --> E[baseBranchNamesWorkspace = false]
F[Name-field branch selection] --> D
F --> G[baseBranchNamesWorkspace = true]
B --> H[Workspace name]
D --> I[Create-worktree payload]
E --> H
G --> H
Reviews (2): Last reviewed commit: "fix(composer): carry the base-ref naming..." | Re-trigger Greptile
|
Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (8)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe composer now tracks whether a branch names the workspace or acts as its base reference. It conditionally displays a base reference picker for eligible repositories and sources. The picker resets search state when the project changes and shows branches on open without a query. Tests cover state selection, picker visibility, callbacks, reset hints, draft persistence, and empty-query searches. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The base-reference picker and its ownership state are covered across selection, persistence, restoration, and visibility paths; no merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1⚔️ Resolve merge conflicts 💡
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: 6e5a8875-610f-490c-8578-874d76ebbf92
📒 Files selected for processing (16)
src/renderer/src/components/NewWorkspaceComposerCard.start-from.test.tsxsrc/renderer/src/components/automations/AutomationWorkspaceField.tsxsrc/renderer/src/components/new-workspace/ComposerBaseRefPicker.tsxsrc/renderer/src/components/new-workspace/NewWorkspaceComposerNameSection.tsxsrc/renderer/src/components/new-workspace/base-ref-picker-visibility.test.tssrc/renderer/src/components/new-workspace/base-ref-picker-visibility.tssrc/renderer/src/components/new-workspace/new-workspace-composer-card-props.tssrc/renderer/src/components/repo/CreateFromPicker.test.tsxsrc/renderer/src/components/repo/CreateFromPicker.tsxsrc/renderer/src/hooks/composer-state/branch-start-point-actions.tssrc/renderer/src/hooks/composer-state/composer-name-source-selection.test.tssrc/renderer/src/hooks/composer-state/composer-source-state.tssrc/renderer/src/hooks/composer-state/identity-model.tssrc/renderer/src/hooks/composer-state/issue-source-actions.tssrc/renderer/src/hooks/composer-state/work-item-source-actions.tssrc/renderer/src/hooks/composer-state/workspace-identity-state.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
|
Notes on the two failed pre-merge checks, plus the one finding that was real. Draft rehydration (Major) — valid, fixed in e96b006. Docstring coverage — not actionable as stated, because this repo asks for the opposite. Out of scope: listing branches on an empty query — deliberate, and disclosed rather than slipped in. Without it the picker shows only the project default and branches that already have a worktree until you type two characters, which makes the new control close to useless for the case the issue describes: you rarely know the exact name of the release branch you want to start from. It also aligns the picker with the composer's Branch tab, which already lists on an empty query through the same runtime helper. The shared effect on the Automations picker is stated in that commit's message, not left implicit. That said, the check is right that it reaches beyond #15747. If a maintainer prefers it as its own PR, say so and I will pull commit |
|
I almost feel the "Name or Create from" should be 2 distinct things. You can name from one thing, but want to create from a different thing. |
|
That's the split this PR is going for. The name field still picks what the workspace is named from; the new Branch from control is the independent create-from. Neil just landed a follow-up so an independently chosen base survives when you then pick a Jira / GitHub / Linear / GitLab issue (or clear the source). It only gets replaced when the name source itself is a branch or a PR. If the remaining itch is the combined "Name or Create from" label, I'm happy to follow up — I'd keep that out of this PR. |
Move CreateFromPicker and its test from components/automations to components/repo, next to the repo-scoped shared UI that already lives there (RepoCombobox, RepoBadgeLabel, repo-icon). The New Workspace composer will consume this picker instead of growing a second base-ref combobox. Pure move: no behavior change. The translate() keys are call-site literals, so no locale catalog is affected. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
baseBranch carried two meanings at once. It is the ref a worktree is created from, and it is also what buildWorkspaceSourceSelection turns into the name field's branch pill whenever no work item is linked. Any second control that set a base therefore took the name field over: the pill replaced the text input, hiding whatever the user had typed. The name survived in state, and Advanced still exposed it, but the main field silently stopped showing it. Add baseBranchNamesWorkspace, true only when a branch was picked to name the workspace. The pill reads that flag; creation keeps reading baseBranch. Two call sites set it, because those are the only paths that make baseBranch defined with nothing linked — and an undefined base yields no pill anyway. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The name field's tabs pick how a workspace is named; the base ref is a
separate decision the composer never exposed. Naming a workspace from a
Jira, Linear, GitHub or GitLab issue therefore pinned the project's default
base with no way to start from a release or a long-lived feature branch.
Nothing below the UI was missing. baseBranch already crosses IPC next to
linkedWorkItem and wins over every default in main, and the composer already
computed handleBaseBranchChange and startFromResetHint — the card simply
never declared those props, so its {...props} spread dropped them. Declare
them and render the shared create-from picker under the name field.
ComposerBaseRefPicker owns its own store reads, the way the sibling
ComposerParentWorktreePicker already does, so the name section stays
presentational and nothing subscribes to the worktree list while the picker
is hidden.
The picker is offered for a plain typed name and for issue-shaped sources.
It is hidden where a base already exists: PR/MR sources pin the pull
request's own head, a branch pick IS the base — and offering one there would
silently turn a checkout of that branch into a new branch off something
else, since picking a base clears reuse — and folder workspaces have no
branches. It always opens on the project default: no sticky base.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… picker no-adjust-state-on-prop-change no longer fires on this file: removing the directive and running the react-doctor pass over the directory — where the JS plugin actually loads — reports nothing, at the new path and at the old one on main alike. The suppression was already dead; the rename only put the file in the changed set, where the quality gate reports unused directives. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The picker only searched once two characters were typed, so opening it showed just the project default and whatever branches already had a worktree. The composer's Branch tab lists on an empty query through the same runtime helper; match it, and the picker offers the repo's branches straight away. Search stays debounced at 200ms and capped at 30 results, and it still runs on the repo's own execution host, so a remote repo lists its own branches. The Automations picker shares this component and gains the same listing. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`baseBranchNamesWorkspace` lived only in component state, so restoring a persisted draft always reset it to true. A base ref chosen in the picker came back as a name-field source pill, hiding the name the user had typed — the exact regression the flag exists to prevent, reappearing across a draft round trip. Persist it next to `baseBranch` and restore it through `resolveDraftBaseBranchNamesWorkspace`. A draft written before the flag existed records no intent and restores as a branch pick, which is the behavior it had when it was saved. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
IssueSourceActions now requires baseBranchNamesWorkspace. The create-more reset fixture is a source-owned base, so the flag stays true and the next create still clears it.
d2a3188 to
296804e
Compare
I changed it to 'Create From' |
…lyai#17250) * refactor(repo): share the create-from picker outside automations Move CreateFromPicker and its test from components/automations to components/repo, next to the repo-scoped shared UI that already lives there (RepoCombobox, RepoBadgeLabel, repo-icon). The New Workspace composer will consume this picker instead of growing a second base-ref combobox. Pure move: no behavior change. The translate() keys are call-site literals, so no locale catalog is affected. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(composer): separate the branch that names a workspace from its base baseBranch carried two meanings at once. It is the ref a worktree is created from, and it is also what buildWorkspaceSourceSelection turns into the name field's branch pill whenever no work item is linked. Any second control that set a base therefore took the name field over: the pill replaced the text input, hiding whatever the user had typed. The name survived in state, and Advanced still exposed it, but the main field silently stopped showing it. Add baseBranchNamesWorkspace, true only when a branch was picked to name the workspace. The pill reads that flag; creation keeps reading baseBranch. Two call sites set it, because those are the only paths that make baseBranch defined with nothing linked — and an undefined base yields no pill anyway. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * feat(composer): let the New Workspace composer pick its base ref The name field's tabs pick how a workspace is named; the base ref is a separate decision the composer never exposed. Naming a workspace from a Jira, Linear, GitHub or GitLab issue therefore pinned the project's default base with no way to start from a release or a long-lived feature branch. Nothing below the UI was missing. baseBranch already crosses IPC next to linkedWorkItem and wins over every default in main, and the composer already computed handleBaseBranchChange and startFromResetHint — the card simply never declared those props, so its {...props} spread dropped them. Declare them and render the shared create-from picker under the name field. ComposerBaseRefPicker owns its own store reads, the way the sibling ComposerParentWorktreePicker already does, so the name section stays presentational and nothing subscribes to the worktree list while the picker is hidden. The picker is offered for a plain typed name and for issue-shaped sources. It is hidden where a base already exists: PR/MR sources pin the pull request's own head, a branch pick IS the base — and offering one there would silently turn a checkout of that branch into a new branch off something else, since picking a base clears reuse — and folder workspaces have no branches. It always opens on the project default: no sticky base. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * chore(repo): drop a stale react-doctor suppression on the create-from picker no-adjust-state-on-prop-change no longer fires on this file: removing the directive and running the react-doctor pass over the directory — where the JS plugin actually loads — reports nothing, at the new path and at the old one on main alike. The suppression was already dead; the rename only put the file in the changed set, where the quality gate reports unused directives. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * feat(repo): list branches as soon as the create-from picker opens The picker only searched once two characters were typed, so opening it showed just the project default and whatever branches already had a worktree. The composer's Branch tab lists on an empty query through the same runtime helper; match it, and the picker offers the repo's branches straight away. Search stays debounced at 200ms and capped at 30 results, and it still runs on the repo's own execution host, so a remote repo lists its own branches. The Automations picker shares this component and gains the same listing. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(composer): carry the base-ref naming intent through a saved draft `baseBranchNamesWorkspace` lived only in component state, so restoring a persisted draft always reset it to true. A base ref chosen in the picker came back as a name-field source pill, hiding the name the user had typed — the exact regression the flag exists to prevent, reappearing across a draft round trip. Persist it next to `baseBranch` and restore it through `resolveDraftBaseBranchNamesWorkspace`. A draft written before the flag existed records no intent and restores as a branch pick, which is the behavior it had when it was saved. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(composer): preserve independent base and branch name choices * fix(composer): pass naming-intent through the create-more reset test IssueSourceActions now requires baseBranchNamesWorkspace. The create-more reset fixture is a source-owned base, so the flag stays true and the next create still clears it. --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: Neil <[email protected]>

ELI5
When you start a workspace from a Jira, Linear, GitHub or GitLab issue, Orca names it from the issue — but it also silently branches off the project's default branch, with no way to say otherwise. If your team works off a release branch you had to create the workspace and then move the branch yourself. This adds a "Branch from" control to the New Workspace composer, so you choose the starting point at the same moment you choose the name.
Getting there turned up a knot underneath: the composer used one value for two different things, so any second base control quietly took the name field over. That is untangled first, in its own commit.
What Changed
Five commits, each green on its own:
refactor(repo)— moveCreateFromPickerfromcomponents/automations/tocomponents/repo/, beside the repo-scoped shared UI already there (RepoCombobox,RepoBadgeLabel,repo-icon). Pure move.fix(composer)— split "the branch that names a workspace" from "the base it is created from". See The knot below.feat(composer)— declarebaseBranch,onBaseBranchChangeandstartFromResetHintonNewWorkspaceComposerCardPropsand render the shared picker under the name field, in a newComposerBaseRefPicker.chore(repo)— drop a staleoxlint-disable react-doctorheader the rename dragged into the changed set.feat(repo)— the picker lists the repo's branches as soon as it opens, instead of waiting for two typed characters.Why
The name field's tabs pick how a workspace is named. The base ref is a separate decision the composer never exposed, so naming a workspace from an issue pinned the project's default base.
Nothing below the UI was missing.
baseBranchandbranchNameOverrideare already separate fields onCreateWorktreeArgs(src/shared/worktree/create-types.ts:71-77); the payload builder passesbaseBranchunconditionally next tolinkedWorkItem(worktree-create-payload.ts:48,:87); an explicit base already wins over every default in main (src/main/worktree-create-base.ts:11); and the CLI already exposes the combination (orca worktree create --base-branch <ref> --issue <n>). No main, IPC, runtime or CLI change here.The knot, and why commit 2 exists
baseBranchcarried two meanings. It is the ref a worktree is created from, and it is also whatbuildWorkspaceSourceSelection(src/shared/new-workspace/workspace-source.ts:192) turns into the name field's branch pill whenever no work item is linked:So a second control that set a base took the name field over:
SmartWorkspaceNameFieldswaps its text input for a source pill (:1784), and the name you had typed stopped being shown. It was never lost — it stayed in state, and Advanced still exposes a Name input when a pill occupies the main field (NewWorkspaceComposerAdvancedSection.tsx:163) — but you had to open a collapsed section to see it again. Found by hand, not by any of the automated checks.Commit 2 adds
baseBranchNamesWorkspace, true only when a branch was picked to name the workspace. The pill reads the flag; creation keeps readingbaseBranch. Two call sites set it, because those are the only paths that makebaseBranchdefined with nothing linked, and an undefined base yields no pill anyway. It defaults totrue, so restored drafts and a caller-supplied initial base behave exactly as before.This is more than the issue asked for, and it is a prerequisite rather than a bonus: the picker cannot be offered for a plain typed name without it. Splitting it out would mean shipping the picker restricted to issue-shaped sources first — correct, because a linked issue outranks
baseBranch, but it would not serve anyone creating a workspace under a name of their own until a follow-up landed. The decoupling alone, ahead of the picker, changes nothing observable and would read as an unmotivated refactor. Hence one PR. Say the word if you would rather have the narrow version first and I will resubmit that way.Where the picker appears
Hidden rather than disabled, following
NewWorkspaceComposerAdvancedSection.tsx:183, where the Branch name field is: nullin the mirror situation. The threedisabled=uses in that file all gate on a visible adjacent control, which is not the case here.The picker always opens on the project default. Persisting the last-used base per project was considered and deliberately left out, matching every other composer source.
Linked Issue
Fixes #15747
Visual Proof
The New Workspace composer, Name tab, with a workspace name typed by hand.
main)The picker open, listing the repo's branches — commit 5. The typed name is still there above it:
Counted rather than eyeballed: "Branch from" appears 0 times on
mainand 1 time on this branch, on both the Name and Branch tabs, asserted in the same Electron run that produced these shots.Images live on a separate
pr-assets/composer-base-refbranch of the fork, not in this PR's diff.Testing
pnpm typecheck,pnpm lintandpnpm buildpass locally on macOS.pnpm testreports 65,703 passing and 9 failing; those 9 fail identically onmainin this environment — same seven files, same nine test names — and none touches the composer. They are WSL (absent on macOS), macOS bash 3.2, a process-table probe, a relay handshake, a cross-version wire property, an error-message mismatch, and a number-format test that expects a narrow no-break space.Verified end to end against a real repository. Composer on a project whose default base is
origin/dev, base ref set toorigin/main, name typed by hand:The typed name survived and became the branch name — the regression commit 2 fixes.
New coverage:
base-ref-picker-visibility.test.ts— the visibility rule alone: offered with no source and for each of the four issue-shaped sources; hidden forgithub-pr,gitlab-mrandbranch; hidden for a non-git project; hidden when branches are disabled (the folder-workspace case).composer-name-source-selection.test.ts— the knot: a branch picked in the name field still names the workspace; a base ref chosen in the picker claims no source, so a typed name stays on screen; a linked issue outranks the base ref either way.NewWorkspaceComposerCard.start-from.test.tsx— the rule through the rendered card, including that the picked ref reaches the composer and that choosing the project default reports no base rather than a pinned ref.CreateFromPicker.test.tsx— the picker requests branches on an empty query as soon as it opens.Platform and remote notes:
Renderer-only. No platform-dependent code: no keyboard shortcut, no path handling, no child process.
SSH / remote: base-ref reads run on the repo's own execution host.
CreateFromPickerresolvesgetRuntimeEnvironmentIdForRepo(state, repoId)— per-repo evidence, not the ambient active-runtime setting — and passes it togetRuntimeRepoBaseRefDefaultandsearchRuntimeRepoBaseRefs. Worth a reviewer's eye: commit 5 means opening the picker now costs one runtime round trip on a remote repo, where it previously stayed silent until two characters were typed. The Branch tab already does exactly this through the same helper, debounced 200ms and capped at 30 results, so this aligns the two rather than inventing a cost — but say the word and I will gate the empty-query listing to local repos.Remote wire: no RPC params, stream frames or published content change.
baseBranchalready crossed IPC.Git providers: provider-neutral. Only the two PR/MR kinds are named, and only to exclude them.
Automations: shares
CreateFromPickerand inherits commit 5's listing. Deliberate, and an improvement there too.Localization: the picker's
translate()keys are call-site literals, unchanged by the move. All three localization verifiers pass.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Claude Opus 5, via Claude Code, wrote the implementation and ran the validation. I tested the result by hand against real projects, which is how the naming/base conflation in commit 2 was found — no automated check caught it.
Review
Cross-platform — renderer-only, no platform branch, no path or shortcut handling.
SSH / remote / local — base-ref reads execute on the repo's execution host through existing runtime helpers; no assumption of local execution introduced. One added round trip on picker open for remote repos, called out above.
Agents and integrations — no agent-specific code. Issue sources stay provider-neutral.
Performance —
ComposerBaseRefPickermounts only while the picker is visible, so folder workspaces and PR/MR sources pay no repo-map or worktree subscription. Branch search stays debounced and capped.UI quality — the picker sits under the name field, reuses the shared
CreateFromPickeronPopover, the surfacedocs/STYLEGUIDE.md:146prescribes for a click-revealed picker, and the reset hint uses the documented trailing-metadata pattern from:220(text-[11px] text-muted-foregroundbelow the control). No new colour, size or shadow value.Security — no new IPC surface and no new user input path to the main process; the picker calls runtime helpers that already existed.
Known adjacent duplication, not addressed here —
src/renderer/src/components/settings/BaseRefPicker.tsxis a second base-ref picker duplicating the same runtime search trio and per-repo host resolution. Pre-existing; this PR promotes the other one to a shared location and leaves that consolidation alone. Flagging it so it reads as seen rather than missed.Agent skill upstream boundary
Notes
A stale
oxlint-disable react-doctor/no-adjust-state-on-prop-changeheader rides along in commit 4. The rename put the file in the changed set, wherecheck:code-quality:changedreports unused directives, and the rule no longer fires on it — verified by removing the directive and running the react-doctor pass over the whole directory, where the JS plugin actually loads, at both the new path and the old one onmain. Kept in its own commit so the file move stays pure.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Author
X: @VincentMenard76