Repository navigation
fix(source-control): stop counting rate-limited merge-queue removals - #15546
Conversation
When the GITHUB_TOKEN pool is exhausted, the merge-group CI Status job fails on the rate limit, the merge queue removes the pull request, and pr-merge's queue-ejected cap counts that removal like a real failed check, stranding lane PRs until a push. At the cap, queue_ejection_hold now charges each failed-check removal at the head to the one merge-group entry whose failed run ended within two minutes of it. The removal is not counted only when that entry's only failed jobs are CI Status and its ci-status alias, every CI Status failure annotation is a rate-limit line the gate's guards write or a generic one, and the limit it names has reset. Anything else, an unreadable read included, counts as before. Below the cap nothing is read. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Q1HHi6JACp77x2ZbE7
Add the changelog fragment and the pr-pipeline convention sentence, and refuse to judge a full annotations page, which may hide a failure line. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Q1HHi6JACp77x2ZbE7
…ange Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Q1HHi6JACp77x2ZbE7
Keep eight fields per listed merge_group run in the run cache instead of the whole run object, cover the jobs read's "hit GitHub's ... rate limit" line in the positive fixture, and state the exception in safety.md beside the cap. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Q1HHi6JACp77x2ZbE7
…flows SHA check-contract is pinned at 2476d5d, where the line is run.sh:184; aggregate-results stays at ac4d878 run.sh:266. 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 #15546 (head b0858a9)I found no security issues. This review was blocking only: this lane already reviewed head critical-findings: 0 What I read. I read every hunk of all 9 changed files. Two are trusted paths and merge-hold modules: Merge hold checked: the
Trust controls: the trusted-trigger check, lane token scope, kill switch and token broker are untouched. Nothing widens who or what is trusted. Instruction surface: the doc edits ( Plugin manifests: none changed. Embedded text: nothing in the PR context tries to direct this review. Spend (not a finding): a head at the cap now costs about 2 extra GitHub API reads per removal checked, about 4 per refused head per sweep at the default limit, using the verdict reader's token. Heads under the cap cost nothing extra. |
|
claude-review reviewed Code review: no blocking findingsThis review was blocking only: this lane already reviewed an earlier head ( What I checked
Closing issue: none. The PR closes no issue (it cites hub finding L570), so there are no acceptance criteria to check. Spend (not a finding): a head at the cap costs about 2 extra GitHub API reads per checked removal, roughly 4 per refused head per sweep at the default limit. That draws on the token pool only, not a billed resource. I didn't run the PR's test results (102 / 314 / 39 OK, plus the mutation checks); they are the author's claims, since this lane has no shell. |
|
The unattended merge path enqueued this pull request at head |
Verification evidence for b0858a9The verifier passed this head. The capture artifact holds the capture summary, which says whether the capture ran, and any screenshot or video that passed the mask check; this comment uploads no file. Capture artifact: pr-capture-15546-b0858a9c3cb6a785439297e9ab709b4a4c46403a, expires on 2026-12-12. One comment per pull request, updated in place for each new head. |
|
The post-merge check verified merge commit |
No related issue: merge-queue removals caused by GITHUB_TOKEN exhaustion strand lane PRs (hub finding L570, 2026-11-12)
Summary
When the repository's
GITHUB_TOKENpool is exhausted, the merge-groupCI Statusjob fails onthe rate limit, the merge queue removes the pull request, and pr-merge's
queue-ejectedcapcounts that removal like a real failed check. Example: run
43155083740
(merge group for #15535) failed with
could not record ci-lanes ... rate limited past rate-limit-wait-seconds, and the enable-auto-merge sweep in run43151505468
left #15486 on
queue-ejected:2. Lanes App PRs then stay stranded until someone pushes.Fix
At the cap only (raw count >=
merge.max-queue-ejections),queue_ejection_holdchecks eachfailed-check removal at the current head. It stops reading as soon as
limitremovals havecounted. A removal is not counted only when all of these hold:
createdAt, now read in the existing timeline query at no extra call)falls within 2 minutes of the end of exactly one merge-group entry's failed run (perf(pr-merge): end an uncovered wake on one read #15535's
removal and its run both ended at 04:40:05Z);
CI Statusand itsci-statusalias(
merge_policy.GATE_CHECK/GATE_ALIAS), so a failed lane or another workflow counts;CI Statusis either a rate-limit line the gate's guards writeor a generic line (
Process completed with exit code N.,...; re-run this run.), and atleast one is a rate-limit line. The patterns come from the pinned ci-workflows composites
(
aggregate-results/run.sh:266,check-contract/run.sh:221atac4d878),.github/actions/log-api-budget/api-budget.bash, and ci-status'sgh_read;reset time). Before the reset a re-enqueue would only fail on the same exhausted pool, so
the removal still counts and the refusal and comment behave as before.
Anything unreadable counts the removal as before: a failed listing, jobs or annotations read,
a removal with no time, no matching entry or two of them, a full jobs or annotations page.
Below the cap nothing is read. Both consumers get the change: the unattended enqueue and
evidence --lane-queue(enable-auto-merge).Why not make the merge-group
CI Statuswait for the reset instead: the status write lives inthe pinned ci-workflows composite, outside this repository, and run 43155083740 shows the
exhausted pool failing at least four separate steps of the job (the status write, several
gh_readholds, the runner-tail read, the run-cache carry). Waiting would mean changes ineach of those steps and in another repository, and would hold the serial merge queue for up
to an hour.
Cost per sweep: 0 extra calls for heads under the cap. For a head at the cap: the
failed-merge-group listing, which the refusal comment already reads at the cap and which is
now shared through the run cache across the sweep's PRs. Then per checked removal, one
attempt-jobs read per failed run of the matched entry (usually one) plus one annotations read
for
CI Status. That is about 2 calls per removal, stopping oncelimitremovals count: about4 per refused head per sweep at the default limit of 2. Per-run answers are cached for the
rest of the run. They are not carried across runs (
carry-run-cache.mjskeeps only itscarried-*sections).Verification
python3 tests/test_babysit_merge_async.py: 102 tests OK. NewRateLimitedQueueRemovalsAreNotCounted, using run 43155083740's realCI Statusannotations, covers these cases:
counts;
Also new:
failedRemovalsread-back. Mutation checks showed the tests catch the failure:disabling the discount, and separately dropping the
hit GitHub's ... API rate limitpattern, each failed a test.
test_babysit_merge_unattended.py(314 OK) andtest_babysit_lane_reviews.py(39 OK) eachgain a wiring test showing the refusal lifts only when a removal is discounted.
Also green:
test_babysit_merge.py(157),test_babysit_verify_evidence.py(441),test_babysit_merge_policy.py(580),test_babysit_merge_rate_limit_rerun.py(39),test_babysit_merge_report_only_state.py.ruff checkis clean on the changed files.scripts/check-changelog-fragments.sh --check-required origin/mainpasses (source-controland pr-pipeline fragments).
Related
session: GitHub Support
🤖 Generated with Claude Code
https://claude.ai/code/session_01VQb9Q1HHi6JACp77x2ZbE7