Preserve pull request status across branch checkouts
What Changed
- Added branch-specific pull request lookup through the VCS workflow and WebSocket RPC layers.
- Preserved thread and branch PR indicators when the working tree checkout changes.
- Serialized local and remote VCS refreshes to prevent stale status from overwriting current checkout data.
- Updated branch selectors, sidebar indicators, chat, and Git actions to resolve PR status from the thread’s recorded branch.
- Simplified terminal font inheritance so terminal surfaces use the configured code font unless explicitly overridden.
- Added coverage for checkout changes, refresh ordering, and remote status recovery.
Why
PR status was derived from the current checkout, causing thread badges and PR actions to show stale or incorrect information after switching branches. Branch-keyed lookups keep each thread associated with its own PR while preserving fast stream-fed status for the active checkout. Refresh serialization prevents slow remote lookups from publishing results for a previous branch.
The typography cleanup keeps monospace surfaces consistent and removes unused advanced-font preference logic.
UI Changes
The sidebar, chat, branch selector, and Git actions now continue to display and act on the correct PR after switching checkouts. No visual layout changes were made, so before/after screenshots are not applicable.
Checklist
- [ ] This PR is small and focused
- [x] 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 VCS caching, concurrency, and checkout/switch RPC ordering where stale or mismatched PR/ref data could briefly surface; changes are localized to git status/PR resolution with added test coverage.
Overview PR indicators and thread badges now follow each thread’s recorded branch, not whatever is checked out in the repo. A new
vcs.branchPrRPC (and cached client query) resolves PR/MR state from git branch config and upstream tracking, reusing the samelookupStatusPrpath as live status.Web and mobile replace checkout-only
resolveThreadPrwithuseThreadPr/selectBranchPr: streamed status wins whenrefNamematches the thread branch (including “no PR”), otherwise the branch-keyed query keeps the badge. Sidebar, chat, and the branch toolbar use this;resolveBranchToolbarPrBranchis removed. Git actions stay gated on checkout status only.
VcsStatusBroadcastergets per-cwd local/remote semaphores, drops cached remote data onrefNamechange, discards superseded in-flight remote reads, and publishes a local-only snapshot (remote: null) on checkout change before async remote refresh.vcsSwitchReftriggersrefreshLocalStatusbefore the full refresh so clients don’t see the old branch after await.Contracts add
VcsBranchPrInput/VcsBranchPrResult; tests cover refresh races and branch PR selection.Reviewed by Cursor Bugbot for commit 4a42ee1ad0afecdfe15ccaf169eb51dd110e305d. Bugbot is set up for automated code reviews on this repo. Configure here.
[!NOTE]
Preserve pull request status by branch across checkout changes
- Adds a
vcs.branchPrRPC endpoint that resolves a PR for any branch (not necessarily checked out) by reading git config to infer upstream and default branch, without requiring an active checkout.- Introduces
selectBranchPranduseThreadPrutilities that prefer live git status when it matches the thread's branch, but fall back to the branch-keyedvcs.branchPrquery when the checkout has moved away.- Updates PR badges in the sidebar rows, chat view, and branch toolbar to use
useThreadPrinstead of the removedresolveThreadPrfunction, so badges persist after a checkout change.- Fixes
VcsStatusBroadcasterto prevent stale remote or local status from overriding newer state during concurrent refreshes; remote halves are cleared on ref changes and repopulated asynchronously.- Behavioral Change: switching refs now triggers an immediate local status publish before the full refresh, so clients see the new ref name sooner in the status stream.
Macroscope summarized 4a42ee1.
[!IMPORTANT]
Review skipped
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
366c55e3-c521-4f3c-9fa5-ebf0a7adbba8You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- [ ] 🔍 Trigger review
Comment @coderabbitai help to get the list of available commands.
Approvability
Verdict: Needs human review
1 blocking correctness issue found. This PR introduces a new feature for preserving PR status across branch checkouts, including a new RPC endpoint, concurrency controls, and caching changes across multiple layers. Two open review comments identify potential race conditions and badge flickering bugs in the new logic that warrant human review.
You can customize Macroscope's approvability policy. Learn more.
(ignore the approval please, sorry, was testing it for our pr page discussion. It can't be dismissed because github does not allow that when there are conflicts)