perf(server): read quiet pull requests every five minutes #22073
t3/pr-stack-etag-revalidation fromrefs/pull/22073/head·merged by juliusmarminge View on GitHubProblem#
Every T3 server re-reads every open pull request linked to an unsettled thread on each one-minute sync sweep (PullRequestSyncReactor). Telemetry from 44 servers sharing one GitHub account put getPullRequestSummary at about 5,300 GraphQL requests/hr, more than the 5,000/hr limit on its own, and about 98% of it came from the sweep.
Most of those pull requests weren't changing. On the busiest server, 104 open linked pull requests were read every minute; none had been updated in the last 30 minutes and only 4 in the last hour.
Fix#
An open pull request whose host updatedAt is over 30 minutes old is read every 5 minutes instead of every sweep. One with recent activity keeps the one-minute cadence. Explicit refresh requests, watches, links without a snapshot, and runs that ran gh pr merge/close still read it at once, so the cost is that settlement of a quiet pull request merged elsewhere can lag by up to 5 minutes.
Top of a 2-PR stack on #22078.
Verification#
- New test: a quiet open pull request is read every five minutes until it changes, then every sweep again.
- Two existing tests now use pull requests with recent activity, since they assumed every-minute reads of open pull requests. They test unchanged snapshots and rate-limit pauses.
vp test run apps/server/src/orchestration-v2/PullRequestSyncReactor.test.ts, plus lint and typecheck forapps/server.
Done by Claude Opus 5.5 in Claude Code, running in T3 Code.
🤖 Generated with Claude Code
- 1
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
ℹ️ No successful
mainbaseline artifact is available yet. This run establishes the initial measurement.Provider Metric Main baseline This PR Impact PR ceiling Codex Total thread wire — 5.0 KiB — 6.8 KiB ✅ Codex Thread snapshot wire — 3.8 KiB — 4.9 KiB ✅ Codex Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅ Codex Live turn WebSocket decoded — 20.9 KiB — 29.3 KiB ✅ Codex Live turn messages — 2 — 8 ✅ Claude Total thread wire — 5.0 KiB — 6.8 KiB ✅ Claude Thread snapshot wire — 3.8 KiB — 4.9 KiB ✅ Claude Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅ Claude Live turn WebSocket decoded — 21.2 KiB — 29.3 KiB ✅ Claude Live turn messages — 2 — 8 ✅ Baseline: unavailable · PR result:
b597b18· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
Important
Review skipped#
Review was skipped as selected files did not have any reviewable changes.
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
9e5a5dcf-985a-4020-b41f-c91cb6ca7409
📥 Commits
-
Reviewing files that changed from the base of the PR and between 6015b72ae234c2b078a7847f7d8ff7271a3412b2 and b597b1853bc282bf2c91a53c30663165d574df77.
You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- 🔍 Trigger review
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
8cd85042-44b4-4d91-b217-189441729e7a
📥 Commits
-
Reviewing files that changed from the base of the PR and between 6327a639a6d3632f181899c425abb67acdbab6d5 and 707118f0d3ac483de8c74f598e4ae0ebc00c3839.
📒 Files selected for processing: 4
-
apps/server/src/orchestration-v2/PullRequestSyncReactor.test.tsapps/server/src/orchestration-v2/PullRequestSyncReactor.tspackages/source-control-github/src/server/GitHubPullRequestApi.test.tspackages/source-control-github/src/server/GitHubPullRequestApi.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
-
📝 Walkthrough
-
The sync reactor now polls unchanged open pull requests on a five-minute cadence after 30 minutes. GitHub stack reads use credential-scoped ETag revalidation and reuse cached response bodies for HTTP 304 responses.
Changes: Quiet pull-request synchronization
Layer / File(s) Summary Quiet polling cadence
apps/server/src/orchestration-v2/PullRequestSyncReactor.ts,apps/server/src/orchestration-v2/PullRequestSyncReactor.test.tsOpen pull requests unchanged for at least 30 minutes use a five-minute interval. Explicit refresh paths remain immediate. Tests cover the quiet cadence and update fixture timestamps. GitHub stack revalidation
Layer / File(s) Summary Credential-scoped stack revalidation
packages/source-control-github/src/server/GitHubPullRequestApi.ts,packages/source-control-github/src/server/GitHubPullRequestApi.test.tsThe initial stack request uses conditional REST reads. Cached bodies are reused on HTTP 304 responses, and validators are scoped to credentials. Tests cover revalidation and credential separation. Priority: ⬇️ Low
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Other
Suggested reviewers:
maria-rcks
Merge Risk: ⚪ Minimal · up to
70711-
Quiet pull requests retain the intended polling cadence, and stack revalidation does not reuse cached responses across the inspected request contexts. The change is mergeable after normal checks.
Pre-merge checks:
3 · 1-
Failed checks: 1 warningCheck name Status Explanation Resolution Description check The description explains the problem, the fix, the behavior tradeoff, and focused verification. It does not include the required Scope and approval section or link a triaged issue or explicit maintain… Add a Scope and approval section with the triaged bug issue or discussion link and the explicit maintainer approval comment. If no prior approval exists, explain why this focused fix qualifies for an exemption. Passed checks: 3 passed-
Check name Status Explanation Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Title check The title clearly and concisely describes the main change: reducing polling frequency for quiet pull requests.
Full details: Description check
-
Explanation
The description explains the problem, the fix, the behavior tradeoff, and focused verification. It does not include the required Scope and approval section or link a triaged issue or explicit maintainer approval.
Resolution
Add a Scope and approval section with the triaged bug issue or discussion link and the explicit maintainer approval comment. If no prior approval exists, explain why this focused fix qualifies for an exemption.
-
✨ Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
juliusmarminge changed the title
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
juliusmarminge merged this8dec2ff
juliusmarminge closed this
Sign in to join this conversation.
Approvability#
Verdict: Needs Human Approval
Macroscope's review found this PR requires human approval — The PR changes the server’s default pull-request synchronization cadence, deferring reads for quiet open pull requests from each minute to every five minutes and potentially delaying externally detected state changes. The behavior is covered by tests and remains localized, but the product-default change warrants human review.
Notes:
No code changes detected at
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).b597b18. Prior analysis still applies.