Skip to content

fix(web): picker branch switches no longer re-read the full local status - #40389

Merged
juliusmarminge merged 3 commits into
mainfrom
factory/issue-40354
Nov 21, 2026
Merged

juliusmarminge merged 3 commits into
mainfrom
factory/issue-40354

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

After a branch switch in the branch picker, every mounted branch selector sent its own vcs.refreshStatus (localOnly) and reloaded the branch list, even though the switch already reloads the refs and the server already publishes the new status. Now the picker marks its checkout in a map shared by every selector on that environment and checkout, and the selectors skip that refresh for the picker's own checkout. A checkout made outside T3 Code still triggers it, so the picker keeps following it.

  • While vcs.switchRef or vcs.createRef runs, the checkout is marked in flight and no selector on it refreshes, whatever branch is reported meanwhile.
  • On success the mark becomes the branch the server reports it checked out, which can differ from the picked ref (a remote ref resolving to an existing tracking branch). On failure the mark is removed.
  • The mark is dropped as soon as the checkout reports a different branch, so the refresh for outside checkouts is unchanged.

Fixes #40354

Reproduction on main

Commit 997575b (origin/main), Windows Server 2025 pool machine, 4 vCPU, Git 2.56.1.windows.1, Node 26. Followed the issue's harness exactly: worktree at C:/p/wt, vp i, vp build in apps/web; bare clone of t3code as C:/p/repos/remote.git, working clone C:/p/repos/p0 (32,168 files), branch work pushed with upstream, feat-a/feat-b/feat-c at HEAD~20 pushed; devReplay provider via settings.json; server node src/bin.ts serve --base-dir C:/p/home --port 4800 --host 127.0.0.1 with T3CODE_DEV_SEED=0 started through Win32_Process Create; project add, thread start --provider devReplay --model command-output, pair --ttl 1h; the reporter's common.cjs/branch.cjs/sum.cjs verbatim (branch.cjs plus an outside-checkout check at the end), RUNS=7 SEQ=1 on the thread page /ENVID/mcp:. Results: on 7 of 7 switches, including the first, the client sent one extra vcs.refreshStatus {localOnly:true} 1,581-1,831 ms after the click, at the same moment as review.getDiffPreview. Server root span ws.rpc.vcs.refreshStatus ran 10 git each time and took 1950/2112/2191/2101/2089/2065/2109 ms (median 2,101 ms, spread 1,950-2,191). About 2 s later its settle sent 2 more vcs.listRefs refresh=true (limit 10 and 100), so 5 listRefs per switch. Whole-switch git count over 8 s from the click: 110/102/116/90/98/123/98 (median 102). Client switch latency 1,619-2,010 ms. Outside-checkout baseline: git checkout feat-b in p0 updated the picker to feat-b in 1,435 ms, and it did so through this same effect (a vcs.refreshStatus localOnly at +1425 ms), so a fix must keep that path. The draft-page double-mount case was not measured.

Evidence

On the same Windows Server 2025 machine (4 vCPU, 16 GB, Defender enabled), used Chromium at 1600×1000 with a 33,231-file repository, local bare remote and replay thread. Ran seven alternating feat-a/work picker switches per commit, then an outside git checkout feat-b.

Before After
755de001f2 b88235da13
Before: seven Windows branch-switch measurements After: seven Windows branch-switch measurements
Interaction recording Interaction recording
VCS completion median 5,254 ms, range 4,192–5,476 ms VCS completion median 2,998 ms, range 2,825–3,416 ms
Extra status refresh after 5/7 switches; each ran 10 git, median 2,773 ms Extra status refresh after 0/7 switches
5 refs requests per switch 3 refs requests per switch
Outside checkout updated picker in 1,976 ms Outside checkout updated picker in 1,916 ms

VCS completion means click to the last completion of VCS RPCs sent after the click during the observation window; no measured requests remained pending. Its median improved 2,256 ms (42.9%), exceeding both spreads combined (1,875 ms), with non-overlapping ranges. All seven branch changes succeeded on each revision. Both outside-checkout checks retained the status refresh and updated the picker.

Visible picker-label latency was essentially unchanged: medians 2,388 → 2,373 ms. Whole-window git counts were noisy: medians 98 → 94. The demonstrated performance improvement is VCS completion and removal of the redundant status-read work.

Branch driver · Complete scripts, request transcripts and sanitized timing spans · Before JSON · After JSON

Recordings were inspected; the environment label is masked for privacy.

Not shown:

  • Draft-page double-mounted selectors and branch-creation paths were not measured; this proof covers picker switches on an existing thread.
  • A visible picker-label latency improvement was not established; the demonstrated speedup is completion of switch-related VCS RPC work.

Tests

  • vp run check:changed: passed (format, lint, knip 1/2 and 2/2, typecheck of 2 packages, react compiler)
  • CI on PR fix(web): picker branch switches no longer re-read the full local status #40389 at b88235d: all 38 checks passed
  • Playwright driver against the built web app and server on Linux, draft New thread with both branch selectors mounted and a local my-feature tracking origin/feature: 0 vcs.refreshStatus for every picker switch, including the remote pick (the previous approach sent 2 there); outside checkouts still update the picker with 2 refreshes each
  • Windows driver from the issue (thread page, 7 switches, 32k-file repo): extra vcs.refreshStatus 7/7 to 0/7, vcs.listRefs 5 to 3 per switch, git per switch median 102 to 100

Not in this change

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
  • Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5

Run by the t3code factory in T3 Code.

juliusmarminge and others added 3 commits November 21, 2026 14:27
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… checkout

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…its branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 21, 2026
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The branch selector tracks branch switches and creations by environment and checkout path. It uses that state to control stale-ref refresh checks and clears tracking entries when an operation fails or the reported branch differs.

Changes: Branch checkout tracking

Layer / File(s) Summary
Track checkouts and gate refreshes
apps/web/src/components/BranchToolbarBranchSelector.tsx
Branch switches and creations mark a checkout as in flight, record the resulting branch on success, and remove tracking on failure. The stale-ref refresh handler skips refreshes for in-flight or matching tracked checkouts. If the reported branch differs, it removes the tracking entry and continues the existing checks.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: macroscopeapp, bil0000, yuruzuu

Merge Risk: Minimal · up to b8823

This change stops branch pickers from sending redundant status refreshes after a checkout, and outside checkouts still update the picker. No concrete defect was found. The worst case is an occasional extra refresh, so it is low risk to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title follows the conventional commit format and names the main change: picker branch switches no longer trigger a full local status re-read. The changeset adds a shared in-flight checkout marker …
Linked Issues check Passed Directly linked issue #40354 has coding requirements: (1) stop the picker's redundant client-sent vcs.refreshStatus after a picker branch switch; (2) preserve vcs.switchRef and the server post-checkou…
Out of Scope Changes check Passed The whole-PR diff against the merge base changes only apps/web/src/components/BranchToolbarBranchSelector.tsx (+23/-1 by the raw summary). Every hunk is tied to the picker checkout marker: the module-…
Description check Passed The description follows the repository template closely. It has Problem, Change, Scope, and Verification content, and it names the author and model. It explains the cause, the fix, and the linked issu…
Full details: Title check

Explanation

The title follows the conventional commit format and names the main change: picker branch switches no longer trigger a full local status re-read. The changeset adds a shared in-flight checkout marker so branch selectors skip the redundant vcs.refreshStatus and listRefs calls after a picker checkout, which matches the title.

Full details: Linked Issues check

Explanation

Directly linked issue #40354 has coding requirements: (1) stop the picker's redundant client-sent vcs.refreshStatus after a picker branch switch; (2) preserve vcs.switchRef and the server post-checkout refresh; (3) keep picker updates for checkouts made outside T3 Code. The diff to apps/web/src/components/BranchToolbarBranchSelector.tsx (only changed file) addresses each point. A module-level pickerCheckouts Map, keyed by environmentId and checkout cwd, is set to null before switchRef or createRef runs and to the resulting branch on success. It is deleted on failure. In refreshRefsMissingStatusBranch, the stale-ref refresh (which sends the refresh and listRefs) returns early while the entry is null or matches the reported branch. A different reported branch deletes the entry and the existing refresh path continues, so outside checkouts still refresh. switchRef and createRef calls and the server path are unchanged. Caveat: the PR's own Windows measurement shows git operations per switch only moved from a median of 102 to 100. The issue expects avoided Git work as a benefit. The explicit acceptance target (zero client-sent refreshes) is met by the code. The residual git work comes from the server HEAD watcher, which the PR names as follow-up #38949. The Evidence section of the PR is still marked as pending, but it is not a code requirement.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base changes only apps/web/src/components/BranchToolbarBranchSelector.tsx (+23/-1 by the raw summary). Every hunk is tied to the picker checkout marker: the module-level map and key helper, the in-flight and success and failure updates in the switch and create handlers, and the guard in refreshRefsMissingStatusBranch. No unrelated files or behavior changes were found. The PR explicitly leaves the server reconcileCheckedOutRef watcher unchanged, which is consistent with scope. No automated tests were added. The issue does not request tests, so this is not a scope problem.

Full details: Description check

Explanation

The description follows the repository template closely. It has Problem, Change, Scope, and Verification content, and it names the author and model. It explains the cause, the fix, and the linked issue #40354. Its Scope section links the issue that shows the bug. Verification is detailed: it lists focused tests, a Windows reproduction, before/after measurements, and what was not checked. The Problem section is brief, but it states the expected behavior and reproduction environment. The Change section explains the in-flight marker mechanism. Some sections are long and the title is not a strict conventional commit in the template sense, but the required information is present and the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b427708 and b88235d.

Files selected for processing: 1

  • apps/web/src/components/BranchToolbarBranchSelector.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@juliusmarminge
juliusmarminge merged commit 7d3677f into main Nov 21, 2026
39 checks passed
@juliusmarminge
juliusmarminge deleted the factory/issue-40354 branch November 21, 2026 16:12
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Nov 22, 2026
**v0.1.12-nightly.20261121.5064** · 39 changes from 13 contributors

- **Linear team selection.** Agents can file issues in any Linear team bound to a project.
- **PDF links.** Open links directly from the in-app PDF viewer.
- **Devin commands on Windows.** Devin’s terminal commands now run in Git Bash, so its shell commands work on Windows.
- **Automatic thread settlement.** Threads can now settle automatically and stop project actions configured to stop on settlement.

### Plus 35 more bug fixes and performance improvements.

<details>
<summary>Full changelog</summary>

## What's Changed
* fix(cli): thread --wait --json keeps a result a woken run submits by @Marve10s in pingdotgg/t3code#40360
* fix(issues): agents can file issues in any bound Linear team by @shivamhwp in pingdotgg/t3code#40299
* fix(server): a queued message that names no model runs on the thread's current pick by @juliusmarminge in pingdotgg/t3code#40373
* perf(server): branch list reloads run 6 git processes instead of 9 by @juliusmarminge in pingdotgg/t3code#40376
* perf(client-runtime): Git menu status refresh keeps the branch list when no ref moved by @juliusmarminge in pingdotgg/t3code#40385
* fix(web): picker branch switches no longer re-read the full local status by @juliusmarminge in pingdotgg/t3code#40389
* fix(web): a modified click on a remote server opens it after forwarding by @Marve10s in pingdotgg/t3code#40390
* fix(server): a no-op fetch on Windows no longer re-resolves the base branch by @juliusmarminge in pingdotgg/t3code#40388
* fix(web): CSV preview rows keep their height during horizontal scroll by @Abaans in pingdotgg/t3code#40381
* fix(server): transcript cleanup failures tell the user why by @juliusmarminge in pingdotgg/t3code#40424
* fix(acp): Devin's terminal commands run under Git Bash on Windows, not cmd.exe by @juliusmarminge in pingdotgg/t3code#40418
* fix(server): a delegated task still reaches its parent when its first update fails by @sungyongcho in pingdotgg/t3code#37225
* fix(server): worktree threads start when a checkout hook already linked a nested clone by @juliusmarminge in pingdotgg/t3code#40419
* fix(desktop): a forward moves off a port this machine serves on IPv6 loopback by @Marve10s in pingdotgg/t3code#40423
* fix(web): RTF previews no longer join text across section and column breaks by @Michel-Liao in pingdotgg/t3code#40437
* fix(azure-devops): project-less pull request URLs can be pasted to check out by @Michel-Liao in pingdotgg/t3code#40436
* fix(server): queued messages no longer wait out every timed-out checkpoint in a shared folder by @ExSidius in pingdotgg/t3code#40411
* fix(shell): non-ASCII Windows PATH entries survive the PowerShell environment probe by @lowlyleon in pingdotgg/t3code#37154
* fix(web): scheduled task times follow the Time format setting by @Gooder24 in pingdotgg/t3code#37314
* perf(client-runtime): opening the branch picker keeps the branch list when no ref moved by @juliusmarminge in pingdotgg/t3code#40452
* perf(server): turn end reads upstream divergence once, not twice by @juliusmarminge in pingdotgg/t3code#40450
* fix(shared): file links whose title holds the other quote keep their folder labels by @Michel-Liao in pingdotgg/t3code#40464
* fix(web): RTF previews break the line at TextEdit soft line breaks by @Michel-Liao in pingdotgg/t3code#40468
* fix(mobile): scheduled task Time dialog closes after OK on Android by @juliusmarminge in pingdotgg/t3code#40479
* fix(server): RTF attachments no longer garble text set in a font's own character set by @Michel-Liao in pingdotgg/t3code#40476
* fix(antigravity): match skill manifest filters literally by @Lucenx9 in pingdotgg/t3code#40488
* fix(contracts): older clients drop unknown values in RPC responses by @phorrr in pingdotgg/t3code#40490
* fix(server): Word table cells wrapped in a content control reach the agent by @Michel-Liao in pingdotgg/t3code#40496
* fix(server): a stop-on-settle action no longer holds back automatic settlement by @Marve10s in pingdotgg/t3code#40489
* fix(web): links inside a PDF are clickable in the in-app PDF viewer by @juliusmarminge in pingdotgg/t3code#40507
* fix(web,mobile): Limits shows why a provider's limits are unavailable by @seankd3 in pingdotgg/t3code#40481
* fix(server): preview snapshots no longer report an empty interactiveElements list by @juliusmarminge in pingdotgg/t3code#40520
* fix(web): ODT previews no longer print an index's title twice or its entry separators by @Michel-Liao in pingdotgg/t3code#40509
* fix(web): preserve newer navigation when reopening closed views by @StiensWout in pingdotgg/t3code#40516
* fix(server): ODT attachments no longer repeat index titles or template separators by @Michel-Liao in pingdotgg/t3code#40523
* fix(server): skip symlinks during storage cleanup by @StiensWout in pingdotgg/t3code#40528
* fix(web): keep secret check replies tied to their own attempt by @StiensWout in pingdotgg/t3code#40541
* fix(web): downscaled image attachments keep Display P3 colors by @juliusmarminge in pingdotgg/t3code#40501
* fix(keybindings): preserve sibling shortcuts when editing an inherited rule by @StiensWout in pingdotgg/t3code#40525

## New Contributors
* @Abaans made their first contribution in pingdotgg/t3code#40381
* @sungyongcho made their first contribution in pingdotgg/t3code#37225
* @ExSidius made their first contribution in pingdotgg/t3code#40411
* @Gooder24 made their first contribution in pingdotgg/t3code#37314
* @phorrr made their first contribution in pingdotgg/t3code#40490
* @seankd3 made their first contribution in pingdotgg/t3code#40481

**Full Changelog**: pingdotgg/t3code@v0.1.12-nightly.20261121.5051...v0.1.12-nightly.20261121.5064

</details>


Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.1.12-nightly.20261121.5064
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

1 participant