Repository navigation
feat: continue an existing local or remote branch in a new worktree - #85
Conversation
…rom the workspace selector
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the change enabling existing local or remote branches to be checked out in a new worktree.
No open issues 🎉
What changed in this PR
This PR lets users continue an existing local or remote branch in a new worktree through T3 Code’s web, desktop, and mobile clients, without creating a second branch.
Changes:
- Adds Check out in worktree to workspace selection and removes the branch-picker toggle.
- Resolves remote refs to local tracking branches, reuses matching local branches, and rejects conflicting branches or deleted remote refs.
- Extends server and shared-state tests and updates user guidance and architectural decisions.
| File | Description |
|---|---|
packages/contracts/src/orchestrationV2.ts |
Documents remote refs in existing-branch checkout mode. |
packages/client-runtime/src/state/vcsRef.ts |
Allows remote refs as checkout candidates. |
packages/client-runtime/src/state/vcsRef.test.ts |
Updates checkout eligibility tests for remote refs. |
docs/user/thread-sidebar.md |
Explains workspace choices and branch-fetch behavior. |
docs/adr/0009-choose-where-new-worktrees-start.md |
Updates terminology for default-branch selection. |
docs/adr/0008-start-threads-on-existing-branches.md |
Records workspace selection and remote-checkout decisions. |
apps/web/src/components/BranchToolbarEnvModeSelector.tsx |
Adds the existing-branch workspace option. |
apps/web/src/components/BranchToolbarBranchSelector.tsx |
Removes wiring for the old branch-creation toggle. |
apps/web/src/components/BranchToolbar.tsx |
Connects workspace choices to mode and branch-creation state. |
apps/web/src/components/BranchToolbar.logic.ts |
Adds workspace-choice types and labels. |
apps/web/src/components/BranchPicker.tsx |
Removes the branch-creation toggle UI. |
apps/server/src/orchestration-v2/ThreadLaunchService.ts |
Resolves, validates, and prepares local or remote branch checkouts. |
apps/server/src/orchestration-v2/ThreadLaunchService.test.ts |
Covers remote checkout, tracking reuse, conflicts, and deleted refs. |
apps/server/src/mcp/toolkits/project/handlers.test.ts |
Updates expected workspace-error wording. |
apps/mobile/src/features/threads/NewTaskDraftScreen.tsx |
Cycles workspace choices and updates accessible labels. |
apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx |
Removes the toggle and explains remote-branch checkout. |
apps/mobile/src/features/threads/new-task-flow-provider.tsx |
Combines workspace and branch-creation selection updates. |
apps/mobile/src/features/threads/new-task-context-presentation.ts |
Adds capability-aware workspace cycling and labels. |
Review effort: Balanced
|
Thanks for making the workspace choices clearer across web, desktop, and mobile, and extending existing-branch checkout to remote refs. OverviewSummaryThis change separates new-branch worktrees from existing-branch checkouts in the workspace controls. The server resolves remote selections to local tracking branches, rejects conflicting or occupied branches, and fetches before first-time remote checkout. Good points🟢 The deleted-remote regression test checks the failed run, fetch-stage detail, user-visible error, and absence of worktree creation ( Main IssuesNo blocking issues found in the verified review candidates. Recommend merging. Verification was by code inspection; tests were not run during this review. |
|
Thanks for making the workspace choices more explicit across web, desktop, and mobile while preserving the existing launch model. OverviewSummaryThis change separates new-branch worktrees from existing-branch checkouts in the workspace controls and adds server-side resolution of remote selections to local tracking branches. The clients continue to use the existing workspace mode and branch-creation fields rather than introducing another launch strategy. Good points🟢 Main IssuesNone found in the reviewed candidates. Ready to merge from this review. Additional NotesTests were not executed; verification used the PR diffs and targeted reads of the current code. |
A branch that was only on the remote, such as one pushed from another device, could not be continued in a new worktree. New worktree always created a second branch from it. Turning off the Create new branch switch (hidden in the branch picker) allowed only local branches, so remote refs were greyed out. The two choices lived in different selectors.
What changed
existingBranchWorktreeand during multi-model fan-out.origin/featurecan be selected.ThreadLaunchServicefetches that branch, creates a localfeaturetracking it, and checks it out. A localfeaturethat already tracks it is reused without a fetch. A localfeaturethat tracks something else is refused before the thread exists. A remote branch deleted since the last fetch fails preparation instead of being revived from the stale tracking ref. Retries resolve to the branch the first attempt created.t3_thread_launchtool description is unchanged because changing it needs a paidmcp-tool-useeval run. Agents can still pass remote refs (noted in the ADR).Screenshots
Narrow composer menu:
Verification
vp run check:changed: format, lint, knip, typecheck, react compiler, and unit tests pass. The browser test runner can't start on this machine (missinglibglibfor headless Chromium), so CI covers those.ThreadLaunchServicetests cover: a remote-only ref creating a tracking branch, reuse of an existing tracking branch (including thelistRefsorigin dedupe), refusal of an unrelated same-named local branch, missing refs, and a remote branch deleted since the last fetch.origin/feature/from-other-deviceproduced a worktree on localfeature/from-other-devicetracking origin, at a commit pushed after the last local fetch.origin/feature/secondworked the same way after therefs/remotes/...start-point fix.Implemented by Claude Opus 5.5 in Claude Code (T3 Code), reviewed by GPT 6.1 Sol via Codex.
🤖 Generated with Claude Code