Skip to content

Fix worktree base branch updates for active draft#1900

Merged
juliusmarminge merged 4 commits intomainfrom
t3code/fix-worktree-base-branch
Apr 10, 2026
Merged

Fix worktree base branch updates for active draft#1900
juliusmarminge merged 4 commits intomainfrom
t3code/fix-worktree-base-branch

Conversation

@juliusmarminge
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge commented Apr 10, 2026

  • Route branch selection to the active draft session
  • Prevent draft branch sync from overwriting an in-progress worktree setup
  • Add coverage for the draft-specific branch selector flow

What Changed

Why

UI Changes

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

Note

Medium Risk
Touches branch/worktree synchronization logic for draft threads; mistakes could cause incorrect branch context or unexpected worktree setup behavior, but changes are localized and covered by new tests.

Overview
Fixes draft worktree routing so branch/base-branch changes act on the active draft route session when a draftId is present, instead of resolving drafts only by threadRef (applies to BranchToolbar, BranchToolbarBranchSelector, and GitActionsControl).

Threads draftId from ChatViewChatHeaderGitActionsControl, adds an isSelectingWorktreeBase guard to prevent automatic branch sync from overwriting user selection while a worktree draft is being configured, and adds browser tests covering the draft-specific branch selector flow and the non-overwrite behavior.

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

Note

Fix base branch updates for active worktree draft session in branch toolbar

  • BranchToolbar, BranchToolbarBranchSelector, GitActionsControl, and ChatHeader now accept a draftId prop and use getDraftSession(draftId) to scope branch changes to the active draft route session rather than the thread-scoped draft.
  • GitActionsControl suppresses automatic branch syncing when a worktree draft is being configured (no server thread, no worktreePath), preventing a preselected base branch from being overwritten.
  • Live branch sync now falls back to the draft session's branch when no active server thread is present.
  • A new browser test in ChatView.browser.tsx verifies that branch changes apply only to the active draft session and that stale sessions are unaffected.

Macroscope summarized 8490aff.

- Route branch selection to the active draft session
- Prevent draft branch sync from overwriting an in-progress worktree setup
- Add coverage for the draft-specific branch selector flow
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

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

Run ID: be40e39a-5b08-4515-b132-67f5d4176c97

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 t3code/fix-worktree-base-branch

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

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Apr 10, 2026
macroscopeapp[bot]
macroscopeapp bot previously approved these changes Apr 10, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 10, 2026

Approvability

A prior Macroscope approval was dismissed. Re-evaluating efce830

No code changes detected at 8490aff. Prior analysis still applies.

- Replace unsafe DraftId construction with the draft ID helper type
- Keep the base-branch session parity test aligned with active draft routing
@macroscopeapp macroscopeapp bot dismissed their stale review April 10, 2026 21:45

Dismissing prior approval to re-evaluate ace12af

macroscopeapp[bot]
macroscopeapp bot previously approved these changes Apr 10, 2026
- Build draft session IDs with `draftIdFromPath`
- Keep the active draft route selection test aligned with runtime behavior
@macroscopeapp macroscopeapp bot dismissed their stale review April 10, 2026 21:55

Dismissing prior approval to re-evaluate efce830

@juliusmarminge juliusmarminge merged commit e231681 into main Apr 10, 2026
12 checks passed
@juliusmarminge juliusmarminge deleted the t3code/fix-worktree-base-branch branch April 10, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 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