Skip to content

fix(web): pull request panel polls go around the server hold - #9829

Open
lnieuwenhuis wants to merge 4 commits into
pingdotgg:mainfrom
lnieuwenhuis:fix/pr-panel-poll-invalidate
Open

fix(web): pull request panel polls go around the server hold#9829
lnieuwenhuis wants to merge 4 commits into
pingdotgg:mainfrom
lnieuwenhuis:fix/pr-panel-poll-invalidate

Conversation

@lnieuwenhuis

@lnieuwenhuis lnieuwenhuis commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

The PR detail poll re-reads through the server hold, so external title and check changes stay invisible until the hold expires.

Invalidate only the detail reference before each polled re-read, preserving cached diff pages even while metadata refresh is pending or fails. When the PR revision changes, await full invalidation before refreshing activity and diff data. Regressions cover held metadata, immediate and failed-refresh diff reads, both cached pages, and full invalidation; polling cadence is unchanged.

Ports #9491 with the requested regression coverage.

Built with muse-spark-1.3-contributor via OpenCode in T3 Code.


Note

Medium Risk
Touches PR caching and invalidation semantics on the server and poll path in the UI; wrong scoping could cause stale UI or extra host requests, but behavior is covered by new tests.

Overview
PR panel polls were re-reading detail through the server’s stale-while-revalidate hold, so title and check updates from the host never showed until the hold expired.

The panel now invalidates with scope: "detail" before each live refresh, so the next detail read misses the hold and fetches fresh metadata. Manual refresh still invalidates detail and diff (unchanged behavior).

On the server, detail and diff use separate cache epochs: invalidate({ scope: "detail" }) only strands the detail/summary path; diff keeps its SWR hold so the Code tab is not forced to refetch on every poll. Contracts add optional scope: "detail"|"all"``.

Regression tests cover invalidated vs plain re-read under an in-flight background refresh, and detail-scoped invalidate without stranding a held diff.

Reviewed by Cursor Bugbot for commit 103ffcd. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Route PR panel live polls through detail-scoped server invalidation

  • Extends PullRequestInvalidateInput with an optional scope of detail or all in pullRequest.ts
  • Splits the single reference epoch into separate detail and diff epochs in PullRequestService.ts; detail-scoped invalidation bumps only the detail epoch so diff reads keep their existing cache key and stale-while-revalidate hold
  • Changes the live-refresh callback in PullRequestDetailPanel.tsx to send detail-scoped invalidation then refresh the detail query, instead of incrementing the token that refreshes activity and diff; the explicit refresh button still does full invalidation
  • Adds effect tests in PullRequestService.test.ts covering the detail invalidation race and detail-scoped diff retention
  • Behavioral Change: listing invalidation is unchanged, but any reference invalidation call that previously relied on the implicit single epoch now needs to pass scope: "all" (or omit the field) to invalidate both detail and diff; detail-only invalidation intentionally leaves diff stale

Macroscope summarized 103ffcd.

The panel's automatic refresh (five-minute interval and return-to-window read) now invalidates the pull request on the server before re-reading its detail, the same way the manual Refresh action already does. An ordinary detail read is answered from the server's hold while it refreshes behind the answer, so each poll showed the previous poll's data and a passively watched panel never caught an external title or check change. The invalidation is scoped to that one pull request (bumpRefEpoch).
@github-actions github-actions Bot added size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Sep 4, 2026

@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 d878b13. Configure here.

Comment thread apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
@macroscopeapp

macroscopeapp Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Would Approve

Macroscope's review found this PR approvable — The change narrowly fixes stale pull-request metadata polling by invalidating only detail data, while preserving cached diff pages and existing full-refresh behavior. The additive contract change and targeted server regression tests keep the runtime impact bounded.

Not approved because:

  • Monthly spending limit reached (workspace setting). Approvability relies on correctness review in order to determine eligibility

Review your spending limits in Billing settings. You can add or adjust custom eligibility rules. Learn more.

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Sep 4, 2026
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Sep 6, 2026
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