# fix\(web\): branch picker no longer interrupts a running turn · PR \#15255 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/pull/15255)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

State: open

Source repository: Unavailable fork

Source branch: fix/14245-branch-picker-running-turn-v2

Target branch: main

Head commit: d93656badef5c467f7679d21aafe61709047a11c

[Discussion and reviews](https://git.cafe/pingdotgg/t3code/pull/15255)

[Commits](https://git.cafe/pingdotgg/t3code/pull/15255/commits?format=markdown)

[Files changed](https://git.cafe/pingdotgg/t3code/pull/15255/diffs?format=markdown)

## Description

---

Picking a branch checked out in another worktree used to detach a running turn without explaining why. The web picker now disables those selections until the turn ends, while keeping same-worktree picks available. It rechecks received thread state before mutations and after checkout/ref creation, so a newer run is not stopped by a stale selection.

Closes [#14245](https://github.com/pingdotgg/t3code/issues/14245). Maintainer takeover of ScottN-PV’s [#15255](https://github.com/pingdotgg/t3code/pull/15255); original commits and author credit are preserved. Current main was merged without rewriting the contributor’s history. The rebuild centralizes the mutation guard and uses the row renderer to invalidate virtualized rows.

Verification on headless Linux:
- 88 focused tests pass: `cd apps/web && pnpm exec vp test run src/components/BranchToolbar.panel.browser.test.tsx src/components/BranchToolbar.logic.test.ts`.
- Web `pnpm exec tsc-rs --noEmit`, targeted lint, format check, and `git diff --check` pass.
- PR-added coverage reduced from 22 cases in two files to nine browser cases in the existing panel suite. Both deferred races fail when their completion guards are disabled; disabling the guard causes seven regression failures.
- Isolated live web app, real Git repository with `main` and `feature` worktrees, real Codex turn running `sleep 120`: clicking the disabled row and keyboard selection left the persisted run `running` on `main`. After Stop, selecting `feature` moved the thread to its worktree. Before capture uses current-main production source; after uses the rebuilt source. Crops show the same fixture, viewport, and picker location.

| Before: current main | After: rebuilt picker |
| --- | --- |
| ![Before: feature worktree selectable during a running turn](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/208f49989ee29891/15255-before.png) | ![After: feature worktree disabled with Stop notice](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/f8f4e1853f937d14/15255-after.png) |

[Recording: blocked selection while running, then successful selection after Stop](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/926f26c08cc9f1c2/mcp-launch-client-3af38753c3-7bc2-452d-b2ed-d7a048e33a57-fwd-3a99751c6e5ac1e6ec0-106b7e84-f2dc-42b2-a0b1-191705bc01ce-mp4.mp4)

The nine browser cases cover preparing/starting/running/waiting, same-worktree selection, unlock, stale pre-action state, automatic base selection, and both deferred checkout/creation races. No server or wire contract changed. Web and desktop share the picker; mobile remains outside this web PR. The client can only guard against updates it has received; server-side agent handoffs remain supported.

Not verified live: macOS, Windows, Electron desktop, iOS, Android, other providers, or relay/tunnel connections. These are platform verification limits, not claims inferred from Linux.

Independent whole-diff reviews: one round each by Claude Opus 5.5 and GPT-6-Sol, both with no blockers. Opus independently passed all 14 browser cases; Sol passed all 88 focused cases. Current-head CI is green, including build/typecheck, lint, tests, CodeRabbit, and Macroscope. Unmerged; landing is handled centrally.

Models: GPT-6-Astra (tests), GPT-6.1-Sol (implementation), Claude Opus 5.5 and GPT-6-Sol (review). Harness: Codex and Claude through T3 Code.

Fixes #14245
GitCafe: https://git.cafe/pingdotgg/t3code/issues/14245

