Skip to content

feat(web): reuse existing worktrees - #8517

Closed
CasperEngl wants to merge 1 commit into
pingdotgg:mainfrom
CasperEngl:feat/existing-worktrees
Closed

CasperEngl wants to merge 1 commit into
pingdotgg:mainfrom
CasperEngl:feat/existing-worktrees

Conversation

@CasperEngl

@CasperEngl CasperEngl commented Aug 28, 2026 •

Copy link
Copy Markdown

What Changed

  • Add a workspace submenu for choosing any existing Git worktree on web and desktop.
  • List registered worktrees through a dedicated RPC, including detached checkouts.
  • Preserve worktree paths and exclude aliases of the current checkout.

Why

  • Users could only choose the current checkout, create a new worktree, or reuse one previous worktree. Existing registered worktrees should be directly reusable.

Stack

UI Changes

Before
t3code-existing-worktrees-before

After
t3code-existing-worktrees-after

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Implemented with GPT-5.6 Sol through the Codex harness in T3 Code.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 81b7dd28-f1bf-4483-b847-e0ab2270c8b4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XL 500-999 changed lines (additions + deletions). labels Aug 28, 2026
Comment thread apps/server/src/vcs/GitVcsDriverCore.ts Outdated
Comment thread docs/user/composer.md Outdated
Comment thread packages/contracts/src/git.ts Outdated
Comment thread apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx Outdated

@macroscopeapp macroscopeapp 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.

One consistency finding on the workspace control migration from Select to Menu. Details inline.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/BranchToolbarEnvModeSelector.tsx Outdated
Comment thread apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx Outdated
Comment thread apps/web/src/components/BranchToolbar.tsx
@macroscopeapp

macroscopeapp Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This XL PR introduces a new cross-layer workflow for selecting and reusing arbitrary Git worktrees, including new UI, RPC, contracts, filesystem/path handling, and auth wiring. The scope and workspace-selection risks—including path aliases and ambiguous detached-worktree labels—make the runtime impact unsuitable for automatic approval.

Not approved because:

  • 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity

Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more.

Comment thread apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx Outdated

@macroscopeapp macroscopeapp 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.

One finding: the workspace picker migration from Select to Menu drops the explicit non-modal behavior of the control it replaces.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/BranchToolbarEnvModeSelector.tsx Outdated

@macroscopeapp macroscopeapp 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.

One finding on the workspace trigger migration from SelectTrigger to MenuTrigger/Button: descendant icon tone no longer tracks the label on hover/open, which diverges from the adjacent environment selector in the same composer strip.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/BranchToolbarEnvModeSelector.tsx Outdated
@CasperEngl
CasperEngl force-pushed the feat/existing-worktrees branch from e5d926f to b7757b4 Compare August 28, 2026 16:49
@CasperEngl CasperEngl changed the title feat: reuse existing worktrees feat(web): reuse existing worktrees Aug 28, 2026
);

export function vcsWorktreeLabel(worktree: Pick<VcsWorktree, "branch" | "head">): string {
return worktree.branch ?? `Detached at ${worktree.head.slice(0, 7)}`;

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.

🟡 Medium state/vcs.ts:46

Detached worktrees that share the same head are rendered with the identical Detached at <sha> label, so the picker cannot distinguish them and may attach a draft to the wrong workspace. Include a distinguishing worktree path or other unique identifier in the detached label.

🤖 Copy this AI Prompt to have your agent fix this:
In file @packages/client-runtime/src/state/vcs.ts around line 46:

Detached worktrees that share the same `head` are rendered with the identical `Detached at <sha>` label, so the picker cannot distinguish them and may attach a draft to the wrong workspace. Include a distinguishing worktree path or other unique identifier in the detached label.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b7757b4. Configure here.

),
isRepo: true,
};
});

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.

Worktree exclusion misses path aliases

Medium Severity

listWorktrees compares the current checkout with realPath(cwd) against listed paths that only go through path.resolve/normalize, which do not follow symlinks. Alias pairs such as /var vs /private/var can therefore fail the inequality check, so the current checkout still appears as a reusable worktree. Picking it stores that path with envMode worktree and can make the later worktree-add fail because the directory is already a checkout.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b7757b4. Configure here.

@shivamhwp

Copy link
Copy Markdown
Collaborator

Note: GPT-5 on behalf of shivam (@shivamhwp).

Thanks for the contribution. We're closing #8517 and #8568 because we're keeping the existing selection flow. Users can already reuse worktrees through the branch selector, and web/desktop also provides a Previous worktree shortcut.

The dedicated picker adds another UI path for largely the same workflow. We recognize that it also exposes detached worktrees, but don't see enough benefit to add a separate picker across clients right now.

@shivamhwp shivamhwp closed this Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants