Repository navigation
fix(ci): log pr-feedback-dispatch's rerun-ci-status and post-verify-notes API readings - #9882
Conversation
…otes API readings Both jobs spent github-token calls without posting an api-budget notice, so GitHub Support's 18:57-19:57Z window counted their runs (87 of the workflow's 91 executing runs) among the unattributed spend. - rerun-ci-status: the sparse checkout adds the log-api-budget library; read_api keeps each response's reading (refusals included) through api_budget_read, and the job ends with the log-api-budget step. A failed checkout leaves no library and the job runs as before. - post-verify-notes: the artifact listing's gh api call runs through api_budget_wrap_gh, and the job ends with the log-api-budget step. Call counts per path are unchanged; scripts/ci-rerun-ci-status.test.sh now pins one reading per call on every counted path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis 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 No security issues found in this pull request. critical-findings: 0 The change adds api-budget logging to two jobs in
|
|
claude-review reviewed Code review: no findingsI read the full diff ( What I checked
Observations, not findings
Spend: the new log steps add at most one notice per run and no extra API calls. They use no billed resources, so there is no hold. |
|
The pr-unblock lane stopped on this pull request and needs a person: the merge stages a change under .github/workflows/, which the lane does not push.
To resume, deal with the reason above, remove the gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=9882 -f activity=resolve-conflicts |
…-call-budget Compose log-api-budget.test.mjs's fs import: main's mkdirSync and this branch's copyFileSync and mkdirSync. Narrow the post-verify-notes test comment: its notice covers only the artifact listing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the artifact listing leaves one. gh run download passes through the gh wrapper but is not gh api, and verify-notes.mjs uses its own fetch client, so the job-end notice understates the job's spend. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No related issue: follow-up to the 2026-10-24 18:57-19:57Z GITHUB_TOKEN window analysis, which found about 2,000 of 4,015 core calls unattributed
Summary
pr-feedback-dispatch ran 91 times in that window and posted no api-budget notice for any of them. That made it the top suspect for the unattributed calls. Counting from the code (the per-path counts are pinned by
scripts/ci-rerun-ci-status.test.sh) shows it spends about 200 to 250 calls an hour, with a ceiling near 550. So it is not the main source. This PR changes no call. It makes the two jobs that posted no notice post one, so the next window analysis can attribute their calls instead of guessing.Metric: pr-feedback-dispatch github-token core calls per hour, and how many of its executing runs post an api-budget notice.
Baseline (window 18:57-19:57Z):
work-resolve-issue/issue-*headcost=(an upper bound, since it includes concurrent jobs' calls) of 1 to 3 on most of the 15 notices from the neighbouring windows, 18 and 19 on the full pathEstimate: rerun-ci-status 26 × 1 + 26 × 5 = 156, post-verify-notes 35 × 1 = 35, plus the dispatch and sweep runs, for about 200 to 250 calls an hour. Ceiling with every last-lane run hitting the 10-poll cap: 26 × 1 + 26 × 15 = 416 for rerun-ci-status, about 550 for the workflow. Notices posted: 0 of the 87 rerun-ci-status and post-verify-notes runs (the dispatch job already logs).
Expected change: calls per hour unchanged, since no call is added or removed and the log step reads no
/rate_limit. Notices: from 0 to one per executing rerun-ci-status and post-verify-notes run (about 87 an hour). rerun-ci-status keeps a reading for every read, so its notice carries acost=Nwhenever two readings fall in the same reset window.Fix
/.github/actions/log-api-budget/. The find step sourcesapi-budget.bash, andread_apipasses eachgh api -iresponse, refusals included, throughapi_budget_read. The job ends with thelog-api-budgetstep. A failed checkout leaves no library, and the job runs as before with no reading.ghwithapi_budget_wrap_gh github-token, and the job ends with thelog-api-budgetstep. The notice covers only the artifact listing's reading, so it understates the job's spend: on the fail-verdict path,gh run downloadgoes through the wrapper but is notgh apiand leaves no reading, and verify-notes.mjs calls through address-feedback'screateGitHubApi, a plain fetch outside the guard. RoutingcreateGitHubApithrough the guard is a separate follow-up, not done here..github/actions/log-api-budgeton main has both functions; the rate guard has since merged, so the wrapped calls also stop while a limit holds.Considered and not done:
cancel-in-progress: true: the group covers the dispatch job. Cancelling it between its dispatch POST and the dispatched-run record would leave a pr-unblock run that the gate and the broker refuse.workflow-gates.test.mjspins that such a run still re-runs.Verification
On the head merged with main:
bash scripts/ci-rerun-ci-status.test.sh: 152 passed.check_callsalso requires one reading per API call on every counted path (1, 3, 4, 6, 13 and the rate-limited 5). New cases cover the refusal's reading and a missing library. It fails 14 checks on the base workflow.node --testoverlog-api-budget.test.mjs,rate-guard.test.mjs,check-trusted-trigger.test.mjs, and bothfeedback-dispatch.test.mjssuites (pr-unblock and resolve-config): 537 passed.workflow-gates.test.mjsandcallers.test.mjs: 205 passed. Two newlog-api-budget.test.mjscases fail on the base workflow. One requires each API-calling job to end with the log step. The other runs post-verify-notes' download body against a stubghand checks it keeps the artifact listing's reading and still reports no fail verdict.pr-feedback-dispatch.yml.Related
gh run downloadand verify-notes.mjs on the fail-verdict path, and in the dispatch job, resolve-config's fact reads (resolveFeedbackSlotbuilds its own client outsidebudgetedFetch). These are candidates for the api-budget logging follow-up.POLL_SECONDSandPOLL_LIMIT_SECONDSare inline in the workflow, not indocs/conventions/pr-pipeline.yaml. They are unchanged here.used, +657 from 19:19 to 19:24Z and +574 from 19:26 to 19:29Z. The notices around them are pr-unblock-dispatch's dispatch job (self-reported 54, 25 and 6) and pr-merge's enable-auto-merge (cost=442at 19:26:25Z). pr-merge's merge job reportedcost=1332at 19:35:05Z.🤖 Generated with Claude Code