Repository navigation
Conversation
…nch lists Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Pull-request checkout now refreshes cached branch lists using the existing cache-invalidation mechanism. The change is limited to disposable cache state and preserves existing Git command behavior. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Command runtime and cache invalidation packages/client-runtime/src/state/git.ts, packages/client-runtime/src/state/vcs.test.ts |
The runtime type includes EnvironmentCacheStore. The command invalidates cached VCS refs when it settles. The test checks for a successful result, an additional cache clear, and a cache revision increase. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: t3dotgg
Merge Risk: 
Minimal · up to 15dca
-
The cache invalidation change is consistent across supported callers and is covered by the updated test.
Pre-merge checks: 
4
-
Full details: Title check
-
Explanation
The title names the fix and its scope: checking out a pull request now refreshes cached branch lists. The raw summary shows the change adds cache invalidation to preparePullRequestThread, and the objectives describe the same stale branch list problem. The title is specific and follows the conventional commit format from the template.
Full details: Description check
-
Explanation
The description follows the template. It has Problem, Change, Scope and approval, and Verification sections. The Problem section explains the stale ref lists and reproduction contexts. The Change section explains the hook addition and the runtime type widening. The Scope section explains why no prior issue exists and gives an overlap search. The Verification section gives a failing-before and passing-after test result, the check run, and a note on what was not checked. The model and harness are named at the end, as the template requests. Minor gap: the Scope section cites a small fix without a linked issue or maintainer approval, which the template allows when the fix is obviously small and the reasoning is given. The description is complete enough to pass.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
|
Note Written by Verified in a real dev environmentverified unchanged head
runtime transcript from real codex turns: before, main still marked current after pr checkout: after, pr branch current and main default: local checkout and switching back to main, with the worktree badge visible: Not verifiednative ios/android and electron shells were not exercised on this linux vm. other providers, remote/relay connections, the separate diff ref selector, failure-path invalidation, and persistent cache storage across a client restart were not directly exercised. the existing unit test covers persisted refs clearing and the revision bump. no source changes were needed. |





Problem
When you check out a pull request (the PR thread dialog in Local or Worktree mode, or a mobile new task started from a PR), the server creates or switches a local branch or adds a worktree. The branch lists the client already has open don't refresh: the worktree base picker, the diff panel ref lists, and the mobile branch lists keep the pre-checkout refs. They are missing the PR branch, they show the old
currentbranch, and they lack the new branch's worktree path. The persisted branch list keeps the old snapshot too. The lists stay stale until something else invalidates refs, the session changes, or the atom idles out.#4727 replaced ref-list polling with explicit invalidation. Every ref-changing VCS command in
state/vcs.ts(pull,refreshStatus,createWorktree,removeWorktree,createRef,switchRef,init) hasonSettled: invalidateRefs, and so dogitRunStackedActionand clone/publish.preparePullRequestThreadinstate/git.tsuses the same VCS scheduler, and the server handles it likecreateWorktree/switchRef, but it was left without the hook.Change
preparePullRequestThreadnow callsinvalidateCachedVcsRefsfromonSettled, the same way its siblings instate/vcs.tsdo. The runtime type ofcreateGitEnvironmentAtomswidens to includePersistence.EnvironmentCacheStore, matchingcreateVcsEnvironmentAtoms. Web and mobile already pass the sameconnectionAtomRuntimeto both, so neither client needs a change.Scope and approval
This is a very small, focused fix for an obvious bug, so there is no prior issue. It is one command #4727 missed when it added invalidation to every other ref-changing command: 6 lines in
git.tsplus one assertion block in an existing test. There are no contract, server, or UI changes.Overlap search: #27438 (open) adds
refresh: trueto rebuiltlistRefsrequests instate/vcs.ts. It complements this fix, because it depends on the revision bump that this PR adds for PR checkouts, and the lines don't overlap. OtherpreparePullRequestThreadPRs (#24674, #23368, #27658, …) change server checkout behavior or mobile new-task files, not client cache invalidation.Verification
invalidates persisted refs when ref-affecting commands settlecase inpackages/client-runtime/src/state/vcs.test.ts. It now runspreparePullRequestThread(local mode) and asserts that the persisted refs are cleared and the refs revision is bumped.mainit fails:AssertionError: expected 2 to be 3atvcs.test.ts:293(1 failed | 9 passed).vp test run src/state/vcs.test.ts→ 10 passed (10).vp run check:changed: format, lint, knip, typecheck (7 packages, including web, mobile, and desktop) and tests all pass.Reviewed with sol-loop: 1 round with GPT-6.1 Sol on high. Sol verdict: approved.
Created with Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code