Skip to content

[codex] Support multiple checkouts in workspace picker#4407

Open
juliusmarminge wants to merge 1 commit into
mainfrom
codex/multi-clone-workspace-picker
Open

[codex] Support multiple checkouts in workspace picker#4407
juliusmarminge wants to merge 1 commit into
mainfrom
codex/multi-clone-workspace-picker

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jul 23, 2026

Copy link
Copy Markdown
Member

Problem

Repository grouping collapses projects with the same canonical repository into one logical project. When two independent clones of that repository are registered on the same environment, the new-thread workspace picker only exposed the representative clone. Users could not select the other checkout or use it as the base for a new worktree.

Root cause

The workspace selector modeled only the workspace mode (Current checkout or New worktree). It did not retain the physical project dimension after the logical repository group was selected, even though draft sessions already support a scoped physical project reference.

Fix

  • Build checkout choices for every physical project in the selected logical repository and environment.
  • Group the desktop workspace menu by checkout name and abbreviated path.
  • Offer Current checkout and New worktree… beneath each checkout.
  • Update the draft project reference and workspace mode together when a choice is selected.
  • Preserve the existing compact selector when only one checkout is available.
  • Keep the mobile selector unchanged for a separate follow-up.
CleanShot 2026-07-24 at 00 45 41@2x

Verification

  • vp fmt --check on all changed files
  • vp run --filter @t3tools/web typecheck
  • focused BranchToolbar.logic.test.ts suite: 39 passing tests
  • targeted vp lint
  • integrated disposable web environment with two clones of the same repository:
    • both clones appeared in one logical project
    • both checkout groups appeared in the workspace picker
    • selecting clone A's New worktree… made clone A the active base
    • selecting clone B's Current checkout switched the physical project to clone B

Note

Support multiple checkouts in the workspace picker of the branch toolbar

  • Adds availableCheckouts and onWorkspaceChange props to BranchToolbar and BranchToolbarEnvModeSelector, enabling per-checkout local/worktree selection when multiple checkouts exist for the same logical project.
  • In ChatView, computes the list of logical project checkouts filtered by environment and de-duplicated by normalized path (preferring the active project), then wires onWorkspaceChange so selecting a checkout updates the draft thread's projectRef, envMode, and startFromOrigin.
  • Adds exported helpers buildCheckoutWorkspaceChoices and dedupeCheckoutOptions to generate selector entries and remove path duplicates respectively.
  • Behavioral Change: onWorkspaceChange is only active in draft mode and when the environment is not locked; single-checkout contexts preserve the original two-option behavior.

Macroscope summarized 6e9d76d.


Note

Low Risk
UI and draft-context wiring only; no auth, server, or git execution paths. Wrong selection would affect which project a new draft targets.

Overview
When a logical repository has more than one physical clone on the same environment, the desktop workspace control now lists each checkout instead of only toggling local vs new worktree for the current project.

BranchToolbar.logic adds dedupeCheckoutOptions (normalized roots, active project wins on duplicates) and buildCheckoutWorkspaceChoices (per-checkout local / worktree select values). ChatView builds logicalProjectCheckouts from the active logical group and wires onWorkspaceChange for draft threads so projectRef, envMode, startFromOrigin, and worktree path stay consistent when switching clone or mode.

BranchToolbarEnvModeSelector groups the menu by checkout title and abbreviated path, with Current checkout and New worktree… under each group; the trigger shows title · mode when multiple checkouts exist. Single-checkout and locked behavior is unchanged; mobile workspace UI is unchanged.

Reviewed by Cursor Bugbot for commit 6e9d76d. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jul 23, 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: 1a6f26a2-c718-44b3-b4cd-344ae75d5724

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/multi-clone-workspace-picker

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

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jul 23, 2026
Comment thread apps/web/src/components/BranchToolbarEnvModeSelector.tsx
@juliusmarminge
juliusmarminge marked this pull request as ready for review July 24, 2026 11:46
Comment thread apps/web/src/components/BranchToolbarEnvModeSelector.tsx
@macroscopeapp

macroscopeapp Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces a new user-facing feature (multiple checkout support in the workspace picker) with new UI components, state management, and user interactions. New features that change user-facing behavior warrant human review.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge
juliusmarminge force-pushed the codex/multi-clone-workspace-picker branch from 9800407 to 278333f Compare July 24, 2026 13:41
Comment thread apps/web/src/components/ChatView.tsx
@juliusmarminge
juliusmarminge force-pushed the codex/multi-clone-workspace-picker branch from 278333f to 56c11f1 Compare July 24, 2026 13:49
Comment thread apps/web/src/components/BranchToolbar.logic.ts Outdated
Comment thread apps/web/src/components/ChatView.tsx
@juliusmarminge
juliusmarminge force-pushed the codex/multi-clone-workspace-picker branch from 56c11f1 to a30cf29 Compare July 24, 2026 13:55
Comment thread apps/web/src/components/BranchToolbar.logic.ts Outdated

@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 ON, but a cloud agent failed to start.

Reviewed by Cursor Bugbot for commit a30cf29. Configure here.

Comment thread apps/web/src/components/BranchToolbar.logic.ts
Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge
juliusmarminge force-pushed the codex/multi-clone-workspace-picker branch from a30cf29 to 6e9d76d Compare July 24, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant