Repository navigation
feat(pr-merge): read the merge sweep through the lanes App token - #17306
Closed
kyle-sexton wants to merge 2 commits into
Closed
kyle-sexton wants to merge 2 commits into
kyle-sexton wants to merge 2 commits into
Conversation
Owner decision D398 (2026-11-18): the scheduled merge sweep reads through the lanes App's own installation allowance instead of the repository's shared GITHUB_TOKEN pool. - lane-rules.json gives the merge-pr grant actions read, which the token broker already allows to that activity alone. - The merge job's candidate listing, carried artifact reads, post-merge check, skip filter, gate verdict and review-evidence reads and sweep-count read use the lane token, named lanes-app to the rate guard. - babysit_gh sends check-run, check-suite, annotation and commit-status reads under BABYSIT_JOB_GH_TOKEN (the job's GITHUB_TOKEN) when set, since the lane grant holds neither permission, and names a call whose GH_TOKEN equals the process's own as API_BUDGET_TOKEN. - Whole-review reads its job bucket with BABYSIT_JOB_GH_TOKEN when set. Enable Auto Merge stays on GITHUB_TOKEN: the broker refuses actions to the enable-auto-merge activity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gate already read check suites, check runs and annotations with the lane token on this public repository (run 44399528272: 5 check-suite reads under lanes-app, no unreadable refusal). Routing those reads to GITHUB_TOKEN moved calls back onto the pool this change drains, so BABYSIT_JOB_GH_TOKEN now carries commit-status reads only, which need the Commit statuses permission the lane grant lacks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Closed by owner decision (2026-11-18): the 2026-10-23 decision stands that no pr-merge read moves to the lanes App token to gain quota, because GitHub's Terms of Service section H says 'You may not share API tokens to exceed GitHub's rate limitations' (decision record: #9297 (comment)). Quota relief comes from cutting calls. |
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.
No related issue: owner decision D398 (2026-11-18, hub session): the scheduled merge sweeps read through the lanes App's allowance instead of the shared
GITHUB_TOKENpool. Scope: pr-merge's reads only, no new App.Summary
The shared
GITHUB_TOKENpool (5,000 an hour) ran out 14 times on 2026-11-18, and every time it did, every lane paused. pr-merge's Merge job spent about 320GITHUB_TOKENcalls an hour in the six hours to 22:16Z. Over the same period the lanes App's own pool never fell below 4,100 remaining in an hour.This PR moves the Merge job's reads onto the lane token the job already mints. Each read now has one designated token. No read switches to the other token when its own pool runs low.
D398 replaces the 2026-10-23 decision that kept these reads on
GITHUB_TOKENbecause of GitHub's Terms of Service ("You may not share API tokens to exceed GitHub's rate limitations"), and the revert in #9438 that followed it. The October record compared three options: (a) designed routing, (b) fallback when exhausted, and (c) no App reads. It judged (b) the shape closest to the ban. This PR builds (a). The owner should confirm that D398 knowingly supersedes the Terms-of-Service rationale before this merges.Fix
lane-rules.json: thepr-mergerow grantsmerge-practions: readagain. The broker already accepts that grant forpr-merge.yml'smerge-practivity and refuses it to every other activity (azure-iacsrc/lanes-token-broker/src/authorize.mjs, the check from azure-iac#83). No broker change is needed.pr-merge.yml, Merge job: these steps now read with the lane token and name itlanes-appto the rate guard:BABYSIT_VERIFY_GH_TOKENis now the lane token);babysit_gh.pyjob_token_env: a REST GET of a commit's statuses goes underBABYSIT_JOB_GH_TOKEN(the job'sGITHUB_TOKEN) when it is set, because the lane grant has no Commit statuses permission. Check runs, check suites and annotations stay on the lane token. The gate already read those with it before this change: run 44399528272 made 5 check-suite reads underlanes-app, and its log has nocheck suites unreadablerefusal._budget_token_namenow names a call whoseGH_TOKENoverride equals the process tokenAPI_BUDGET_TOKEN, so a verdict reader set to the lane token budgets againstlanes-app.babysit_whole_review.py: the job-bucket and running-job reads preferBABYSIT_JOB_GH_TOKEN, so the whole-review guard still watchesGITHUB_TOKEN.docs/conventions/pr-pipeline/README.mdand the changelog fragments describe the new routing.What stays on
GITHUB_TOKEN, and why:whoandsupersededactionsto theenable-auto-mergeactivity (authorize.mjsline 420). Moving its Actions reads needs a broker change first.Two stops still act on
GITHUB_TOKENalone, and this PR leaves both unchanged:pace.mjs), which skips the Merge job whenGITHUB_TOKENburns fast.The hub brake also reads only the
GITHUB_TOKENpool when it setsCLAUDE_LANES_REPO_DISABLED. That kill switch still stops this job whichever pool its reads use.Behaviour change: the post-merge check and the gate's lane-run annotation reads now use the lane token. If one is refused,
_failed_gatesreturns None and excuses nothing, which is the safe direction.Verification
node --testover.github/scripts/pr-merge/*.test.mjs,.github/scripts/pr-verify/workflow.test.mjs, and.github/actions/resolve-config/{live-config,callers}.test.mjs: 1,436 pass, 0 fail.python3 -m unittest discoverinbabysit-prs/scripts/tests: all pass (19 skipped).lanes-app;BABYSIT_JOB_GH_TOKEN;actionstomerge-pralone.actionlint .github/workflows/pr-merge.yml: clean.scripts/check-affected.sh --uncommitted: 17 passed, 5 skipped (those 5 run the checked tree's own code and run in CI).GITHUB_TOKENcalls an hour. Merge averaged 320 an hour over six hours. In the two sampled runs (44399528272 and 44378219249, per theirapi-routesannotations), everyGITHUB_TOKENroute except statuses (1 call) and the collaborator read (2 calls) belongs to a step that now uses the lane token. The re-fire and escalation-clear steps' share is not split out, which is why this is a range. The lanes App pool takes on the same load, with at least 4,100 of its 5,250 an hour remaining since 19:00Z.Related
🤖 Generated with Claude Code