Cut ci-monitor's GraphQL call volume and harmonize poll cadence - #217
Merged
Merged
Conversation
Steps 3 and 6e now poll at 60s, matching Step 7a's existing interval; CI-check and approval state don't change meaningfully faster than queue state does, and polling faster just burns API calls. ci-check-status.sh merges its `gh pr checks` and `gh pr view` calls into one `gh pr view --json statusCheckRollup` call, one fewer gh call per poll. checks-rollup.jq reimplements gh's pass/fail/pending bucketing against the raw rollup (verified against gh's aggregateChecks source) and dedupes repeated CheckRun/StatusContext nodes, so a flaky rerun doesn't leave a stale failure sitting next to the fresh pass. Unlike the old `gh pr checks`, `gh pr view` succeeds with an empty rollup in the few seconds before a fresh commit's checks register, instead of erroring. SKILL.md's Step 2 now gives a `no_checks` report one grace retry against the same head_sha before concluding a PR has no CI, so a fix push can't race straight through to Step 7 without ever seeing the fix's own CI. Claude-Session: https://claude.ai/code/session_01C1aAmYe7fvjH5ddF9QhovU
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Critical correctness issues remain in check pagination and event-aware deduplication, and the new tests are not covered by CI.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (3)
What changed in this PR
Reduces ci-monitor GraphQL polling volume and standardizes polling at 60 seconds.
Changes:
- Consolidates PR metadata and check-status queries.
- Adds rollup bucketing, deduplication, and grace retry handling.
- Adds regression coverage for rollup behavior.
| File | Summary | Findings |
|---|---|---|
ai/skills/ci-monitor/SKILL.md |
Updates polling cadence and no-check retry behavior. | None |
ai/skills/ci-monitor/scripts/tests/test-checks-rollup.sh |
Tests rollup bucketing and deduplication. | Moderate: not invoked by CI (2 votes) |
ai/skills/ci-monitor/scripts/helpers/ci-helpers.sh |
Sets the poll interval to 60 seconds. | None |
ai/skills/ci-monitor/scripts/helpers/checks-rollup.jq |
Reconstructs check-status buckets and deduplicates runs. | Critical: deduplication omits check-suite event identity (3 votes) |
ai/skills/ci-monitor/scripts/ci-check-status.sh |
Uses a combined PR status query. | Critical: rollup is limited to the first 100 contexts without pagination (1 vote) |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| @@ -0,0 +1,203 @@ | |||
| #!/usr/bin/env bash | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Reduces GraphQL API call volume in the ci-monitor skill's polling loops, which was implicated in hitting the account's GraphQL rate limit.
gh pr checksandgh pr viewcalls into onegh pr view --json statusCheckRollupcall. A new jq helper, checks-rollup.jq, reimplements gh's own pass/fail/pending bucketing against the raw rollup. It also deduplicates repeated check runs, so a flaky rerun doesn't leave a stale failure sitting next to the fresh pass.gh pr viewsucceeds with an empty rollup in the window before a fresh commit's checks register, where the oldgh pr checkserrored. SKILL.md's Step 2 now gives ano_checksreport one grace retry against the same head SHA before concluding a PR has no CI. That keeps a fix push from racing straight through to re-enqueueing without ever seeing the fix's own CI.Test plan
ai/skills/ci-monitor/scripts/tests/*.sh), including a newtest-checks-rollup.shcovering every bucket category, action_required, and dedup of stale reruns.aggregateChecksincli/cli) and against live posthog/posthog PRs.status,all_passed,failed,pending, andpassedmatched the old script exactly.totaldiffered only by a documented edge case, where a job fires on two trigger events andgh pr view's exported JSON doesn't carry enough data to fully dedupe.https://claude.ai/code/session_01C1aAmYe7fvjH5ddF9QhovU