improve and prevent silent thread branch drift and PR fetching#2284
improve and prevent silent thread branch drift and PR fetching#2284justsomelegs wants to merge 10 commits intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review 1 blocking correctness issue found. This PR introduces a new branch mismatch warning feature with user-facing UI changes, refactors core PR matching logic, and has an unresolved bug where You can customize Macroscope's approvability policy. Learn more. |
|
Heya I will properly review your PRs when we get back from Miami. Seems like some good stuff just don't have capacity to review big PRs while we're here |
f1ffd01 to
02bb838
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 23355c1. Configure here.
|
either i messed soemthing up when mergin main or i don't understand this PR: CleanShot.2026-05-02.at.23.02.21.mp4 |
e0314cf to
beb7b1a
Compare
|
@justsomelegs is attempting to deploy a commit to the Ping Labs Team on Vercel. A member of the Team first needs to authorize it. |
It meant to warn the user when switching branches that the thread was last working on another branch so that they dont accidently try and continue the work on the wrong branch. just pushed my local version up that is rebased onto main if you wanna try that one out. Screen.Recording.2026-05-04.101354.mp4 |

What Changed
Improves the local branch mismatch warning in the branch picker.
Why
When using local checkout mode, the active Git branch can drift away from the branch a thread was last associated with. Previously this was easy to miss and could lead to continuing work on the wrong branch.
This makes the mismatch visible in-place and gives users clear recovery actions without changing branches automatically.
The thread’s associated branch should only change when the user intentionally chooses a branch for the thread, creates/checks out a branch through the picker, or clicks
Use currentin the warning popover. It should not change just because the shared local checkout moved while viewing an existing server thread.UI Changes
Screenshots/video to attach:
Use current/Switchactions.Checklist
Note
Fix silent thread branch drift and PR fetching for shared checkouts and worktrees
GitActionsControlfrom overwriting an existing server thread's branch when using a shared checkout; branch sync now only runs for draft threads.BranchToolbarBranchSelectorwhen the thread's stored branch differs from the current checkout, with actions to either switch the checkout or update the thread.resolveThreadPrinThreadStatusIndicatorsso dedicated worktree threads always surface PR info even if the stored branch is stale or missing.matchesBranchHeadContextinGitManagerto reject same-repo PRs for cross-repo head contexts and avoid false matches when head identity metadata is absent.matchesBranchHeadContextis stricter about cross-repo vs same-repo PR reuse.Macroscope summarized c4e2315.
Note
Medium Risk
Touches PR matching logic and thread/ref state synchronization across server + UI, which can affect which PRs are reused/displayed and when thread branch metadata updates. Changes are well-covered by new unit/integration tests but could still cause edge-case regressions in ref/PR selection flows.
Overview
Prevents silent thread branch drift in local-checkout mode by detecting when the thread’s stored ref differs from the current checkout and surfacing an inline warning + popover actions (switch checkout to thread ref, or re-associate thread to current ref) in
BranchToolbarBranchSelector.Tightens PR/status scoping so PR indicators for local checkouts only show when
vcsStatus.refNamematches the thread’s stored branch, while dedicated worktree threads always show the worktree’s PR even if stored branch metadata is stale/missing; PR tooltips are now rendered via structuredtooltipLead/tooltipTitle(PrStatusTooltipContent).Fixes cross-repo PR reuse edge cases by reworking
matchesBranchHeadContextto compare head identity only when comparable metadata exists, rejecting ambiguous cross-repo PRs when GitHub omits head identity fields; adds new server-side tests for these scenarios. Also introducesvcs*-named query/status wrappers (vcsQueryKeys,vcsRefSearchInfiniteQueryOptions,useVcsStatus/refreshVcsStatus) while keepinggit*aliases for compatibility.Reviewed by Cursor Bugbot for commit e0314cf. Bugbot is set up for automated code reviews on this repo. Configure here.