fix(desktop): keep the prompt when opening a branch from the new-workspace picker
AA
3d ago+840+840+012345678901234567890123456789-497-497-012345678901234567890123456789
What & why
On the new-workspace screen (⌘N), there was no way to both pick an existing branch and send a prompt. Large repos had a second problem: you couldn't use a branch name you already knew until the picker finished loading.
- Opening a branch from the picker now launches the prompt. "Open workspace" and ⌘↵ in the branch picker went through
useBranchPickerController.onOpenWorkspace, which sent a bareworkspaces.createwith noagents. The prompt, attachments and linked context were all silently dropped. This path now goes throughuseSubmitWorkspace, viahandleSubmit, with an optionalOpenWorkspaceTarget. An explicit branch takes priority over a linked PR and over the local-checkout setting. - A typed or pasted branch name works without waiting. The picker trigger is no longer disabled while the first page loads; the list shows "Loading branches..." instead. When the search text doesn't exactly match a loaded branch, a row appears after the real matches: Open workspace on
<name>. The host checks the branch out if it exists, or creates it from the selected base branch if it doesn't. The row opens only on ⌘↵ or a click; plain Enter does nothing on it, so plain Enter never creates a workspace. The row is hidden when the name fails git's branch-name rules. searchBranchesno longer waits forgit fetch. The fetch, still limited to once every 30s per project, now runs in the background. The page answers from cached refs, and refs that arrive with the fetch show up on the next search.
The two new strings are translated in all 16 locales.
How I tested it
bun run lint✅bun run typecheckforapps/desktopandpackages/host-service✅bun testfor theDashboardNewWorkspaceModaltests: 27 pass ✅ (new: typed-row tests inCompareBaseBranchPicker.test.tsx,isValidBranchName.test.ts)bun run check:i18n✅
Manual testing in the dev app isn't finished yet, which is why this is a draft. I'll add screenshots before marking it ready. Remaining checks:
- Prompt + "Open workspace" on an existing branch → agent starts with the prompt
- Worktree row → opens in the existing worktree with the prompt
- Clicking a row or pressing Enter → still only sets the base branch
- Paste a new branch name with a non-default base selected → branch is created from that base
- Type a name with no match, press plain Enter → nothing happens; ⌘↵ opens it
- Large repo, first search after the 30s TTL → no wait on fetch
Known trade-offs:
- The row says "Open workspace on X" even when X will be created as a new branch.
- Branches pushed seconds before the first search after the TTL appear one keystroke later.
searchBrancheswithrefreshnow returns cached refs, not freshly fetched ones; input and output are unchanged, so released clients still work.
Checklist
- PR title follows conventional commits (
type(scope): subject) -
bun run lintandbun run typecheckpass (CI fails on lint warnings too) - "Allow edits from maintainers" is checked on fork PRs
Summary by cubic
Fixes the new-workspace branch picker discarding the prompt, attachments, and linked context when opening an existing branch or worktree, and lets a typed branch name open without waiting for branches to load.
- Opening a branch via "Open workspace" or ⌘↵ routes through the form's submit flow, preserving the prompt, attachments, linked PR/issues, and agent settings.
- Typing or pasting a branch name shows "Open workspace on " after the real matches; the row opens on click or Mod+Enter only, and is hidden for invalid names, empty input, and cloud workspaces.
searchBranchesno longer waits ongit fetch; it answers from cached refs and refetches in the background.- A branch typed in the picker opens as typed (no project branch prefix), and the host fetches it from origin — handling an already-typed
origin/prefix — before creating a new branch, so branches pushed after the last fetch open instead of being re-created from the wrong base. - The new picker messages are translated in all 16 locales.
Summary by CodeRabbit
- New Features
- Open a workspace directly on a valid branch by entering its name in the branch picker and selecting the option. Use Mod+Enter when the option is selected.
- The typed-branch option appears only for valid names that aren’t already listed, and can be disabled in certain branch pickers.
- The branch picker remains available while branches load and displays a loading status.
- Branch searches can find newly available remote branches without waiting for the fetch to finish.
- Branch-picker messages are available in supported languages.