Uh oh!
There was an error while loading. Please reload this page.
fix(server): settle branch threads immediately on pull request merge - #9528
Conversation
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort 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 f2e2c4c. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused server-side bug fix that refreshes cached branch state on merge and settles only eligible threads, with regression tests for immediate settlement and unrelated pull requests. Its additional lookup work is confined to the settlement path and concurrency-bounded. You can add or adjust custom eligibility rules. Learn more. |
Dismissing prior approval to re-evaluate 85d76cc

Merging from the in-app pull request viewer left branch threads active for minutes: the merge fast-path only swept explicitly linked threads, so everything else waited for the next minute's sweep on a branch lookup that can stay cached as open for two minutes.
The merge event now re-sweeps every auto-settlement candidate and drops the swept checkouts' cached git answers first, so a merge settles its branch threads in seconds. Threads linked to the merged pull request still settle from the event itself without a lookup.
Verified with the reactor suite (10 tests, including a new regression test that fails on the old code) plus the settlement policy suite (12 tests), and a clean typecheck for the touched files. Built with Muse Spark on OpenCode.
Note
Medium Risk
Changes merge settlement scope and linked-PR matching (exact repo/number), plus shorter PR lookup caching, which affects orchestration timing and API load under settlement sweeps.
Overview
Merging a PR in-app no longer leaves branch-only threads active for minutes. A merge-triggered settlement sweep now considers every auto-settlement candidate (not only threads with an explicit PR link), and it calls
GitManager.invalidateStatuson each branch lookup checkout first so cached “open” branch PR state cannot block settlement.Threads that are linked to the merged PR still settle from the merge event without a lookup; linked threads for other PRs keep using a normal summary lookup instead of inheriting the merge.
PR_LOOKUP_CACHE_TTLdrops from two minutes to 60 seconds so periodic sweeps see fresher branch PR state without waiting out a longer cache.Tests cover immediate branch-thread settlement on merge, cache invalidation, and that an unrelated merge does not settle other linked threads.
Reviewed by Cursor Bugbot for commit 85d76cc. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Settle branch threads immediately on pull request merge in
ThreadSettlementReactorpullRequestFornow compares project, repository, and pull-request number exactly, so only the thread linked to the exact merged PR gets merged state; unrelated linked threads continue through normal lookupPR_LOOKUP_CACHE_TTLfrom 2 minutes to 60 seconds so the settlement sweep observes merge state soonersweepnow processes all eligible threads on every merge event and invalidates up to eight working directories concurrently, which may increase load during merge bursts; check ThreadSettlementReactor.ts for concurrency limitsMacroscope summarized 85d76cc.