Skip to content

perf(server): pull request watches stop spending GitHub quota when nothing changed - #181

Merged
yordis merged 2 commits into
yordis/fix-watch-wakes-follow-headfrom
yordis/perf-watch-conditional-fingerprint
Oct 29, 2026
Merged

yordis merged 2 commits into
yordis/fix-watch-wakes-follow-headfrom
yordis/perf-watch-conditional-fingerprint

Conversation

@yordis

@yordis yordis commented Oct 29, 2026

Copy link
Copy Markdown
Member
  • Each sweep spent GitHub quota even when nothing on the pull request had moved, which forced a slow cadence and left the agent waiting minutes after CI finished.
  • A conditional request that returns 304 costs no quota, so a watch can follow CI closely without nearing primary or secondary rate limits.

@cursor

cursor Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes GitHub polling and orchestration sweep timing; bugs could miss CI updates or increase API load, but behavior is covered by new integration tests.

Overview
Pull request watch sweeps no longer burn GitHub quota on idle PRs and can poll every 30 seconds while CI is active instead of waiting 2 minutes every time.

GitHub watch fingerprints now prefer conditional REST (If-None-Match / 304) across pull, check-runs, and commit status endpoints, assembling the same status/remarks shape with conditional: true when REST can answer in one page. Unsupported hosts, paginated check runs, or bad responses fall back to the existing GraphQL path (no conditional flag).

PullRequestWatchReactor picks sweep delay from that flag: quick cadence when a group has a conditional fingerprint and checks are in flight or the head was pushed within five minutes; otherwise the slow two-minute interval. Read planning treats conditional fingerprints as already reflecting pending checks, so unchanged conditional status skips expensive detail rereads. The fixed Schedule.spaced loop is replaced by sweepDelayMs after each sweep.

Provider types and tests cover quota-free revalidation, status updates when only checks move, and cadence transitions (conditional vs GraphQL vs rate-limited).

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

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Oct 29, 2026
@yordis
yordis added this pull request to stack #182 October 29, 2026 03:46
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 38 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 2ea27de and 7d4f301.

Files selected for processing: 7
  • apps/server/src/orchestration-v2/PullRequestWatchReactor.ts
  • apps/server/src/orchestration-v2/runtimeLayer.test.ts
  • packages/source-control-core/src/server/PullRequestProvider.ts
  • packages/source-control-github/src/server/GitHubPullRequestApi.test.ts
  • packages/source-control-github/src/server/GitHubPullRequestApi.ts
  • packages/source-control-github/src/server/gitHubConditionalFingerprint.ts
  • packages/source-control-github/src/server/gitHubPullRequestJson.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a7872d1. Configure here.

…thing changed

A conditional request that returns 304 costs no quota, so a watch can follow CI closely without nearing primary or secondary rate limits.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…quest

While checks run, each quick sweep reread the pull request and spent the quota the conditional fingerprint exists to save.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis
yordis force-pushed the yordis/perf-watch-conditional-fingerprint branch from a7872d1 to 7d4f301 Compare October 29, 2026 04:08
@yordis
yordis merged commit f3a1e1a into main Oct 29, 2026
16 of 19 checks passed
@yordis
yordis deleted the yordis/perf-watch-conditional-fingerprint branch October 29, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 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