Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): a branch picked right after opening the picker no longer waits for its status read #33877

MergedYuruzuu(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/33877/headmerged by juliusmarminge View on GitHub

Problem

A branch picked right after opening the branch picker waits for the picker's own status read before its checkout starts. This mostly hits keyboard picks: open, type a few letters, Enter.

Change

Opening the picker sends vcs.refreshStatus with localOnly: true through vcsCommandScheduler, the serial per-checkout queue that vcs.switchRef also uses. Since #33263 that refresh no longer waits for a PR lookup on the server. It is still one local status read, though (git status, diff-index --numstat, and the branch's Changes totals against its base), and the checkout queues behind it on the client.

Now the picker sends the same RPC through refreshLocalStatusForPicker, which skips the queue. The read only refreshes status, so it has no reason to hold up a checkout. Server-side, localRefreshLocks still serializes it against other local reads. Other refreshStatus callers stay in the queue.

Web and desktop share this picker. Mobile doesn't send this refresh when its picker opens, so it isn't affected. No contract or server changes.

Scope and approval

This is the smaller follow-up @juliusmarminge asked for when closing #28576: https://github.com/pingdotgg/t3code/pull/28576#issuecomment-6769042382. #28576 covered the PR-lookup half, which #33263 fixed. This PR covers only the remaining local read.

Verification

  • vp test run src/state/vcs.test.ts (packages/client-runtime): 14/14 pass. a checkout does not wait behind a picker's local status refresh holds the picker's refresh open and checks that a checkout still completes. With the command back on the serial queue it times out.
  • Typecheck passes for apps/web and packages/client-runtime. Format, lint and knip pass.
  • Size of the wait: on Windows, the git commands behind one local status read took about 410 ms (3 runs) on a branch 470 commits ahead of main. On branches near main the whole refresh took a median of 0.115 s in the #28576 measurements.

Not checked: I haven't re-captured picker timing in a real client on top of #33263. Native desktop, relay and tunnel weren't checked either.

Made with Claude Opus 5.5 via Claude Code in T3 Code.

🤖 Generated with Claude Code

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Approvability

      Verdict: Approved at 690830b

      Macroscope's review found this PR approvable — The branch picker’s local status read no longer blocks a checkout behind it in the VCS queue. Mutation scheduling and existing cache invalidation remain unchanged, limiting the change to picker responsiveness.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      The branch picker now uses a separate local status refresh command. A test verifies that ref switching completes while the picker refresh is blocked.

      Changes: Branch picker status refresh

      Layer / File(s)Summary
      Add and wire the picker refresh command
      packages/client-runtime/src/state/vcs.ts, apps/web/src/components/BranchToolbarBranchSelector.tsx, packages/client-runtime/src/state/vcs.test.ts
      The picker calls refreshLocalStatusForPicker when it opens. The command invalidates refs when settled and is not configured with the shared VCS command scheduler or concurrency limit. A test verifies that switchRef succeeds before the blocked refresh completes.

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

      Change: Bug fix

      Suggested reviewers: utkarshusername, juliusmarminge

      Merge Risk: Minimal · up to cde4e

      The branch picker's status refresh no longer holds up a checkout picked right after opening the picker. No concrete merge-blocking risk was identified in the supplied change.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe title names the main change: the branch picker no longer makes a branch pick wait behind the picker's status read. The summary shows the picker now calls refreshLocalStatusForPicker, which skips t…
      Description checkPassedThe description follows the template sections: Problem, Change, Scope, and Verification. The Problem section gives the wait symptom and the keyboard pick case. The Change section explains the queue by…
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Full details: Title check

      Explanation

      The title names the main change: the branch picker no longer makes a branch pick wait behind the picker's status read. The summary shows the picker now calls refreshLocalStatusForPicker, which skips the scheduler queue, so the title matches the changeset. It uses the conventional commit form the template asks for, though it is long at 92 characters.

      Full details: Description check

      Explanation

      The description follows the template sections: Problem, Change, Scope, and Verification. The Problem section gives the wait symptom and the keyboard pick case. The Change section explains the queue bypass and why it is safe, and notes that other refreshStatus callers and mobile are unaffected. The Scope section links the prior PR and the maintainer request. The Verification section names the focused test, typecheck results, and a timing measurement, and it states what was not checked. The description does not include a before/after screenshot, but the change has no UI layout change, so that omission is acceptable. The template's agent-attribution line is present.

      Finishing Touches

      Generate unit tests (beta)

      • 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 690830b48aa73daace8cfcd3fd86ab9e38d8a628 and cde4e8f840a5ccddda6f4286bad21d3dd7275013.

      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; 2 remain after this review.

    4. tanstack-source added labelsbug

    5. Evidence

      Open an idle Git thread with two existing branches and a clean working tree. Control: open the picker, type feature/ready, wait for refresh to finish, then press Enter. Return to main, reopen the picker, immediately type feature/ready and press Enter. Capture two seconds later and again after refresh is released.

      Environment for all captures: real web app and server, Chromium 156 on Linux, 1280×800, light theme, fresh synthetic data. A controlled 12-second transport delay holds the opening local-status RPC pending; application code and Git operations are unmodified.

      At two seconds, base has sent no checkout RPC and real Git remains on main. Head has sent checkout and real Git is already on feature/ready while refresh remains pending. On base the picker label is optimistic: the sidebar still says main and the picker is disabled. Both commits switch successfully when selection waits for refresh.

      Proven: the scenario fails on base e0d0fb33dd and passes on head cde4e8f840.

      CaptureBefore — e0d0fb33ddAfter — cde4e8f840
      Scenario resultFailed: checkout was not dispatched while refresh was pendingPassed: checkout was dispatched while refresh was pending
      Waited-for-refresh controlBefore: controlAfter: control
      Two seconds after immediate selectionBefore: checkout waiting; sidebar remains mainAfter: checkout completed on feature/ready
      After status delay releasedBefore: checkout eventually completedAfter: checkout remains completed
      Automatic failure captureBefore: assertion failure capture after delay released
      Full recordingBefore; immediate selection at 0:26After; immediate selection at 0:30

      Scenario source · Git and RPC observations

      AI-assisted; verified with the tests and tools listed above.

      Not shown:

      • Natural large-repository status-read latency was not measured; the opening local-status RPC was held pending with controlled transport delay.
    6. juliusmarminge merged this1b13310

    7. juliusmarminge closed this

Sign in to join this conversation.