Repository navigation
perf(monitor-signals): read job lists and annotations through GraphQL - #15434
Conversation
The monitoring lane spent about 201 core calls a run on GITHUB_TOKEN, most of them one REST read per run's jobs and per check run's annotations. Annotations now come from GraphQL nodes(ids:), 25 check runs a query, for every source that reads them. Job lists come from GraphQL, 25 runs a query and without steps, for the sources that read no step: the pr-merge budget, Actions jobs in use, failed runs, and the hold lanes without a holdStep. Sources that read steps (lane budget, lane variables, merge groups, and pr-verify and pr-review-main's Note the hold) keep REST job reads, since a GraphQL read of 5 runs' steps timed out at 10 s. A GraphQL list is never carried. A node that is null, named by an error, cut short, another run's or a re-run's is read through REST, so every signal reads the same data. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Q1HHi6JACp77x2ZbE7
…ormed answers The annotation reader is now checked against check run 130771889983's full 28 annotations, as REST and GraphQL each answered them, kept in recorded-annotations.json. A table test drives collect with four malformed GraphQL answers (an error naming no node, data.nodes not an array, fewer nodes than ids, an error on a field inside a node) and asserts the ids left unanswered go to REST with the same signal data. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Q1HHi6JACp77x2ZbE7
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-security-review reviewed Security review: PR #15434 (head
|
|
claude-review reviewed Code review: PR #15434, perf(monitor-signals): read job lists and annotations through GraphQL This is a complete review. I read every hunk of all 4 changed files: No blocking or advisory findings. What I checked:
The PR's verification (189 tests passing, mutants killed, the live recorded pair) is the author's claim; I had no shell, so I did not run the tests. No closing issue is linked ("No related issue"), so there are no acceptance criteria to check. No Spend: about 13–19 GraphQL |
Post-merge mutation testingKilled 6, survived 1, timeout 0, no coverage 0, invalid 0, not run 0.
Surviving mutants
The run's summary has the full report. |
No related issue: GITHUB_TOKEN call cut, hub analysis 2026-11-11 (lessons L547)
session: GitHub Support
Summary
maintenance-monitor-signals.ymlruns hourly and spent 201 core REST calls on itsGITHUB_TOKENin sample run 43015959548:actions/runs/{n}/jobsx114,check-runs/{n}/annotationsx44,workflows/{x}/runsx19, other x24. That pool (5,000 an hour) is shared with the PR pipeline. This PR moves part of those reads to the separate GraphQL pool. It does not reach the brief's target of about 40 core calls a run; the reasons and the measured numbers are below.Fix
The read change is in
.github/scripts/maintenance-monitor-signals/collect.mjs;signals.mjsgets comment updates and the tests get a recorded fixture,recorded-annotations.json:annotationsOfreads them. They are read withnodes(ids:)onCheckRun, 25 check runs a query, using each REST or GraphQL job'snode_id. This covers the pr-merge budget, lane budget, failed runs, lane variables, main full run and every hold lane. Each source first reads its runs' jobs in its loop's own order. It stops where the loop would: at the lane budget's 10 mint jobs, or at a failed read, which the loop then meets at the same run without a second call. It then reads the picked jobs' annotations in batches, and the loop runs as before. A job carried from the last run has nonode_id, so its annotations stay on REST.holdStep: work-resolve-issue, work-unblock, pr-refine, intake-triage and pr-merge. They are read withnodes(ids:)onWorkflowRun->checkSuite.checkRuns(first: 30, filterBy: {checkType: ALL}), 25 runs a query, without steps. The result is shaped as the REST list: sorted by id ascending (GraphQL answers newest first), with lower-casestatusandconclusion. These lists live in their own memo. A source that reads steps never gets one, and none is carried inmonitor-signals-jobs, so the carry file can be smaller while signal output stays the same.Note the holdfilter. These were measured throughghxon this repository's runs. A GraphQL read withsteps(first: 100)returned HTTP 502 after about 10.6 s on every cold batch tried: 25, 10 and 5 runs, and 10 check runs queried directly. Two other reads answered quickly. A check-run list without steps took 0.96 s for 25 cold runs, at cost 1. Annotations took 0.82 s for 25 cold check runs, at cost 1. This applies the brief's "keep that read on REST and say so" rule to a field that exists but cannot be read at batch scale.pathnames its index, its connection is cut short (totalCountabove the nodes returned, for example over 30 check runs or over 100 annotations) or holds a null, it answers for another id, or its run is a re-run (run_attemptother than 1; RESTfilter=latestkeeps only the last attempt). An answer with nodata, adata.nodesthat is not an array, an error that names no node index, or a thrown call, sends the whole batch to REST (readNodesin collect.mjs). So a gap stays a gap and never reads as "no hold".call("POST", "/graphql")client, so it counts againstCALL_BUDGET(250) and is logged asgraphqlby log-api-budget, whose step stays as it is.LIMITS.laneRuns,LIMITS.holdRuns, and theHOLD_LANEScost lines insignals.mjs). The hold scan's worst case drops from 710 calls to 204, plus the 7 marker lists either way.GraphQL fields used, confirmed in GitHub's GraphQL reference:
databaseId,runAttemptandcheckSuite: https://docs.github.com/en/graphql/reference/actionscheckRuns(filterBy:), CheckRunFiltercheckTypeand CheckRunTypeALL/LATEST: https://docs.github.com/en/graphql/reference/checksdatabaseId,name,status,conclusion,stepsandannotations: https://docs.github.com/en/graphql/reference/checksname,number,statusandconclusionexist, but are not used, for the timeout reason above: https://docs.github.com/en/graphql/reference/checksannotationLevel,titleandmessage: https://docs.github.com/en/graphql/reference/checksVerification
node --testover the five test files in.github/scripts/maintenance-monitor-signals/: 189 pass, 0 fail. That is 181 existing tests, unchanged and still exercising the REST path, plus 8 new ones incollect.test.mjs:recorded-annotations.json, read live from both APIs).nodesquery returns the samecollectdata and sends the ids it does not answer for to REST:data.nodesthat is not an array, send the whole batch;collectdata anddetectfindings with and without node ids. The GraphQL path makes 12nodesqueries and none of the 13 replaced REST reads.Risk:
readNodescatches every error a GraphQL call throws, a rate-limit latch included. When the latch also stops the REST fallback, that source fails and is recorded as a gap, the safe direction. It never reads as a false "no hold".Estimated cost per run (hub rule R461). The per-source split of today's 114 jobs reads is UNVERIFIED, estimated from the
HOLD_LANESrun-rate comments. Those comments give about 21 pr-verify and 18 pr-review-main green runs an hour, which totals about 39. Add up to 10 lane-budget runs and about 2 for merge groups, main and audits, and about 51 jobs reads stay on REST. The other ~63 move to GraphQL lists, and the 44 annotation reads move to GraphQL.Related
holdStep(Note the hold) filter. This PR does not do that, because it could change output: an annotation in a job whoseNote the holddid not succeed would then count. For pr-verify, the step'sif:(pr-verify.yml:232) matches the conditions of both notices its HOLD_NOTICES entry parses. pr-review-main's notice comes from its select steps and needs its own check.🤖 Generated with Claude Code
https://claude.ai/code/session_01VQb9Q1HHi6JACp77x2ZbE7