GeezerVison is showing github.com — Add CI watch script, API budget rules and /code-review note for agents by mikolalysenko · Pull Request #1164 · SocketDev/socket-patch
Conversation
What
scripts/ci-watch.sh: a quiet event stream of a PR's CI, for Claude Code's Monitor tool (it also works in a terminal). It prints a start summary, fail: <check> for each failed check, progress: counts, queue: position changes, and a final DONE ... line. Exit status is 0 for pass/merged and 1 for fail/closed/dequeued. --merge follows the PR through the merge queue.
- Cheap to run: each poll (every 2 minutes) is one small GraphQL query for the PR's rollup state. The full check list, several pages for a PR here, is fetched only when that state changes or every 5th poll. A rate-limited poll pauses 10 minutes.
AGENTS.md:
- Wait on CI by running the script under Monitor, not with
sleep + gh pr checks loops or /loop.
- Run
/code-review high (and --fix) before a PR leaves draft or enters the merge queue. Use --comment when reviewing someone else's PR.
- New section, Share the GitHub API budget: check
x-ratelimit-remaining before bulk reads, cap pagination and parallelism, stop on rate-limit errors, and keep at most one re-check reminder per PR.
Why
Every agent and routine calls GitHub as one account and shares one 5,000/hour budget. On 2026-10-08 a bulk Actions fetch by the new CI profiler, plus ~18 concurrent agent sessions, ran that budget to zero twice in one evening, and every agent stalled. The cloud routines' prompts got the same budget rules separately; this PR puts them where every agent reading this repo will see them.
Testing
🤖 Generated with Claude Code
Note Low Risk
Documentation and a local gh helper script only; no changes to application runtime, auth, or data paths.
Overview
Adds scripts/ci-watch.sh, a quiet CI/merge-queue event stream for Monitor (or a terminal): rollup-gated GraphQL polls, full gh pr checks only when status changes or every 5th poll, fail:/progress:/queue: lines, 10-minute pause on rate limits, and exit codes for pass/fail/merged/dequeued.
AGENTS.md now tells agents to use that script instead of sleep/gh pr checks loops, run /code-review high (and --fix / --comment) before leaving draft or entering the merge queue, and follow shared GitHub API budget rules (check x-ratelimit-remaining, cap pagination/parallelism, stop on 403/429, one re-check reminder per PR).
Reviewed by Cursor Bugbot for commit fd1987d. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
scripts/ci-watch.sh turns a PR's CI into a quiet event stream meant for
Claude Code's Monitor tool: a start summary, one line per failed check,
progress counts, merge-queue position, and a final DONE line with an exit
status (0 pass/merged, 1 fail/closed/dequeued). It reads checks through
`gh pr checks`, which pages past the ~400-550 checks a PR here runs, and
reports passes as counts so a monitor isn't flooded.
AGENTS.md now tells agents to wait on CI with that script under Monitor
rather than sleep/gh polling loops, and to run /code-review high (with
--fix) before a PR leaves draft or enters the merge queue.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
ci-watch.sh now reads only the PR's rollup state each poll (one small
GraphQL query, every 2 minutes) and fetches the full check list, which
is several pages for a PR here, only when that state changes or every
5th poll. A rate-limited poll pauses 10 minutes instead of retrying.
AGENTS.md gains a "Share the GitHub API budget" section. Every agent and
routine calls GitHub as one account, and on 2026-10-08 a bulk Actions
fetch plus ~18 concurrent sessions ran the shared 5,000/hour quota to
zero twice in one evening.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
cursor
Bot
left a comment
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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 2 potential issues.

Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Watch script can exit too early
- Added check for terminal statusCheckRollup.state (SUCCESS/FAILURE/ERROR) before exiting to prevent premature exit when checks are expected but not yet created or when draft jobs are skipped.

Or push these changes by commenting:
Preview (cd1fb43bf9)
diff --git a/scripts/ci-watch.sh b/scripts/ci-watch.sh
--- a/scripts/ci-watch.sh
+++ b/scripts/ci-watch.sh
@@ -101,8 +101,12 @@
if [ "$merge" = 0 ]; then
if [ "$total" -gt 0 ] && [ "$pending" = 0 ]; then
- if [ "$fail" = 0 ]; then echo "DONE checks pass ($total checks)"; exit 0; fi
- echo "DONE checks fail ($fail of $total failed)"; exit 1
+ case "$rollup" in
+ SUCCESS|FAILURE|ERROR)
+ if [ "$fail" = 0 ]; then echo "DONE checks pass ($total checks)"; exit 0; fi
+ echo "DONE checks fail ($fail of $total failed)"; exit 1
+ ;;
+ esac
fi
fi
sleep "$interval"
You can send follow-ups to the cloud agent here.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit fd1987d. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Only report DONE when the statusCheckRollup is SUCCESS/FAILURE/ERROR as
well as the gh pr checks list having no pending entries, so expected or
not-yet-created checks keep the watch running. A failed gh pr checks
call now keeps the previous counts, retries on the next poll, and pauses
10 minutes when its stderr shows a rate limit.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
Ready for review
Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|