fix(pull-requests): refresh data after thread turns - #9496
Conversation
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — The PR introduces a new WebSocket refresh workflow spanning orchestration, pull-request cache invalidation, shared client state, and multiple UI queries. Because it changes existing production behavior across several layers and adds substantial new runtime logic, its breadth and integration risk merit human review. You can add or adjust custom eligibility rules. Learn more. |
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 69fe35c. Configure here.

Note
Written by
gpt-5.6-solon behalf of MariaPull request data can stay stale after an agent turn changes the branch, so the PR tab may not reflect new checks, commits, or review state until its next scheduled refresh.
Emit a project-scoped refresh signal when a turn terminates, invalidate only the affected server caches, and re-read mounted PR views in the background. Paginated lists restart through their existing safe refresh path so stale cursors cannot mix snapshots. Web, desktop, and mobile share the refresh behavior through client-runtime.
Tests:
PullRequestService.test.ts: 103 passedCheckpointReactor.test.ts: 18 passedpullRequests.test.ts: 2 passedBrowser interaction: unverified because the collaborative preview could not reach the dev server IPv6 listener. This change has no new visual state; focused runtime tests cover the refresh and mounted-view behavior.
Built with
gpt-5.6-solthrough the Codex harness.Note
Medium Risk
Turn-completion hooks in
CheckpointReactorand project-scoped cache epoch invalidation affect orchestration and PR host traffic; client query atoms withrefreshTriggerchange revalidation timing for mounted PR reads.Overview
Pull request UI could stay stale after an agent turn changed the branch because PR reads only refreshed on timers or explicit invalidation.
Server: When a thread leaves a running turn (
thread.session-set) or finishes viathread.turn-diff-completed(including when session metadata was missed),CheckpointReactorcallsPullRequestService.refreshAfterTurnonce per thread/turn.refreshAfterTurnbumps a project-scoped cache epoch (listings, stats, detail/summary) and publishes aPullRequestRefreshEvent. Clients subscribe through the new streaming RPCpullRequestsSubscribeRefreshes(read scope, optionalprojectIdfilter).Client: Shared refresh subscription atoms drive
refreshTriggeron mounted PR list/stats/detail/activity/linked-summary queries so they revalidate in the background when the matching project revision changes. The pull-requests page listens for those events and runs its existing safe list refresh plus detail bump when the open panel’s project matches.Queries wired with
refreshTriggernow revalidate on signal change and use zero idle TTL instead of relying only on interval refresh; queries without a trigger are unchanged.Reviewed by Cursor Bugbot for commit 8b943a9. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Refresh pull-request data after thread turns in
CheckpointReactorCheckpointReactornow tracks active thread turns and callsPullRequestService.refreshAfterTurnwhen a turn terminates or a ready turn-diff completion arrives without a running session. A bounded 2,048-entry dedup cache prevents repeated refreshes for the same thread/turn pair.PullRequestServicegainsrefreshAfterTurn, which bumps a monotonic per-project refresh epoch and publishes a project-scoped refresh event. Project-scoped epochs invalidate list, detail, non-commit diff, and list-stat caches for the affected project only; unrelated projects stay cached.pullRequestsSubscribeRefreshesWebSocket RPC streams refresh events with optional project filtering. The web pull-request page and client-runtime state subscribe to these events and revalidate mounted queries for the matching project.refreshAfterTurnsubscription RPC requiresAuthOrchestrationReadScope.PullRequestService.diff.Macroscope summarized 8b943a9.