Skip to content

fix(pull-requests): refresh data after thread turns - #9496

Open
maria-rcks wants to merge 7 commits into
pingdotgg:mainfrom
maria-rcks:t3code/refresh-pr-data-after-turn
Open

fix(pull-requests): refresh data after thread turns#9496
maria-rcks wants to merge 7 commits into
pingdotgg:mainfrom
maria-rcks:t3code/refresh-pr-data-after-turn

Conversation

@maria-rcks

@maria-rcks maria-rcks commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Note

Written by gpt-5.6-sol on behalf of Maria

Pull 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 passed
  • CheckpointReactor.test.ts: 18 passed
  • pullRequests.test.ts: 2 passed
  • typechecks: server, contracts, client-runtime, web, mobile
  • scoped lint: no new warnings

Browser 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-sol through the Codex harness.


Note

Medium Risk
Turn-completion hooks in CheckpointReactor and project-scoped cache epoch invalidation affect orchestration and PR host traffic; client query atoms with refreshTrigger change 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 via thread.turn-diff-completed (including when session metadata was missed), CheckpointReactor calls PullRequestService.refreshAfterTurn once per thread/turn. refreshAfterTurn bumps a project-scoped cache epoch (listings, stats, detail/summary) and publishes a PullRequestRefreshEvent. Clients subscribe through the new streaming RPC pullRequestsSubscribeRefreshes (read scope, optional projectId filter).

Client: Shared refresh subscription atoms drive refreshTrigger on 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 refreshTrigger now 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 CheckpointReactor

  • CheckpointReactor now tracks active thread turns and calls PullRequestService.refreshAfterTurn when 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.
  • PullRequestService gains refreshAfterTurn, 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.
  • A new pullRequestsSubscribeRefreshes WebSocket 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.
  • refreshAfterTurn subscription RPC requires AuthOrchestrationReadScope.
  • Risk: commit-specific diff cache keys are intentionally independent of the project refresh epoch, so post-turn refresh does not invalidate cached commit diffs in PullRequestService.diff.

Macroscope summarized 8b943a9.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Sep 3, 2026
Comment thread apps/web/src/routes/_chat.pull-requests.tsx
Comment thread apps/server/src/pullRequest/PullRequestService.ts
Comment thread apps/server/src/pullRequest/PullRequestService.ts Outdated
Comment thread apps/web/src/routes/_chat.pull-requests.tsx Outdated
Comment thread apps/server/src/orchestration/Layers/CheckpointReactor.ts Outdated
Comment thread apps/server/src/orchestration/Layers/CheckpointReactor.ts Outdated
Comment thread apps/server/src/pullRequest/PullRequestService.ts Outdated
Comment thread apps/web/src/routes/_chat.pull-requests.tsx Outdated
Comment thread apps/server/src/orchestration/Layers/CheckpointReactor.ts
Comment thread apps/server/src/orchestration/Layers/CheckpointReactor.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread apps/server/src/orchestration/Layers/CheckpointReactor.ts
Comment thread apps/server/src/orchestration/Layers/CheckpointReactor.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant