docs(pullrequest skill): GraphQL CI gate + local-main update (off the REST rate limit)#399
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the /pullrequest skill documentation to change how contributors gate merges on CI completion, focusing on avoiding REST API rate-limit failures and eliminating the “late shard” race.
Changes:
- Replaces
gh pr checks --watch/gh run watchguidance with a GraphQL-based poll of the workflow check suite untilstatus == COMPLETED, then gates merge onconclusion == SUCCESS. - Adds guidance to run the CI gate loop in the background (for a single completion notification) and to fast-forward the local
mainref post-merge without checking it out. - Expands the rationale section explaining REST rate-limit failure modes and the check visibility race.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Q='query($o:String!,$r:String!,$p:Int!){repository(owner:$o,name:$r){pullRequest(number:$p){commits(last:1){nodes{commit{checkSuites(first:20){nodes{status conclusion workflowRun{workflow{name}}}}}}}}}}' | ||
| suite(){ gh api graphql -f query="$Q" -f o=Systemorph -f r=MeshWeaver -F p=$PR \ | ||
| --jq ".data.repository.pullRequest.commits.nodes[0].commit.checkSuites.nodes[]|select(.workflowRun.workflow.name==\"MeshWeaver Build and Test\")|.$1"; } | ||
| until [ "$(suite status)" = "COMPLETED" ]; do sleep 45; done # cheap: ~1 GraphQL point per poll | ||
| c=$(suite conclusion); echo "PR $PR CI: $c"; [ "$c" = "SUCCESS" ] # exit 0 iff green → the merge signal |
Test Results (shard 4) 9 files ± 0 9 suites ±0 2m 33s ⏱️ - 1m 1s Results for commit ced74dc. ± Comparison against base commit e6a191a. This pull request removes 187 and adds 29 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
Test Results 58 files ± 0 58 suites ±0 22m 48s ⏱️ - 1m 4s Results for commit ced74dc. ± Comparison against base commit e6a191a. This pull request removes 187 and adds 41 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
…ate, off the REST rate limit Replaces the `gh run watch` / `gh pr checks --watch` guidance (polls REST every ~3s → drains the shared 5000/hr user-token budget → 403s that masquerade as CI-red) with a GraphQL check-suite poll on its own budget. Gating on the check SUITE (COMPLETED only when every shard finishes) also closes the late-shard race that turned main red after #138. Adds: - step 6: fast-forward local main with `git fetch origin main:main` (no checkout — the tree is usually a dirty feature branch) - run the step-3 gate in the background so the harness delivers ONE "CI finished" notification (the completion event; a local CLI session can't be webhooked directly) - a 403 caveat (never merge off a rate-limit; /rate_limit is exempt), the GitHub-App-token durable fix, and the deferred webhook->WS push design The poll collapses to the LATEST check-suite (`| last`) so a workflow re-run's extra suite can't make `$(suite …)` multi-line and stall the gate (Copilot review). What's New: skipped — pure-internal tooling change to the /pullrequest skill, no user-visible effect. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
adbdcf7 to
ced74dc
Compare
Why
While merging #396 the
/pullrequestgate'sgh run watchpolled the REST API hard enough to trip a403 API rate limit exceeded— its exit=1 looked like CI-red but wasn't, nearly causing a false abort. This reworks the skill's CI gate to avoid the REST budget entirely and to close a second long-standing gap.What changed (docs-only:
.claude/skills/pullrequest/SKILL.md)gh run watch/gh pr checks --watch. REST is a shared 5000/hr user-token budget drained by ~3s polling across concurrent sessions; GraphQL has its own budget at ~1 point/query. Gating on the check SUITE (which isCOMPLETEDonly when every shard job finishes) also fixes the late-shard race that merged-before-tests and turned main red after fix(build): track ToolCallVisibility.cs — main CI was red (CS0103) #138.mainwithgit fetch origin main:main(fast-forward the ref, no checkout — the working tree is usually a dirty feature branch).gh api /rate_limitis exempt), the GitHub-App-token durable fix, and the deferred webhook→WS push design for true zero-poll delivery.Nothing on main is lost — the What's New (step 0.5) sections are preserved; this only rewrites the CI-gate guidance.
What's New
Skipped — pure-internal tooling change to the
/pullrequestskill, no user-visible platform effect (per step 0.5's own skip rule).🤖 Generated with Claude Code