Skip to content

Add CI watch script, API budget rules and /code-review note for agents - #1164

Draft
Mikola Lysenko (mikolalysenko) wants to merge 2 commits into
mainfrom
agents/ci-monitor-code-review
Draft

Mikola Lysenko (mikolalysenko) wants to merge 2 commits into
mainfrom
agents/ci-monitor-code-review

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

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

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) <noreply@anthropic.com>
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) <noreply@anthropic.com>
@mikolalysenko Mikola Lysenko (mikolalysenko) changed the title Add CI watch script and agent notes for Monitor and /code-review Add CI watch script, API budget rules and /code-review note for agents Oct 8, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant