Repository navigation
Fix: Approval 422s, repo skips and write pacing - #564
Merged
ModeSevenIndustrialSolutions merged 5 commits intoOct 15, 2026
Merged
ModeSevenIndustrialSolutions merged 5 commits into
ModeSevenIndustrialSolutions merged 5 commits into
Conversation
A throttled approval 422 was reported as a token permission problem. These tests pin the intended classification: the HTTP status comes from the response, not from digits in the request URL, and an approval 422 is a PermissionError only when GitHub says the approval is not permitted. A throttled 422 is retried without stacking a second review. Marked xfail(strict=True) until the classification lands. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
Every approval 422 became a PermissionError, because the classifier matched httpx's 'Unprocessable Entity' status line and never read the response body. A throttled approval was therefore reported as a token problem, with GitHub's actual reason discarded. The 401 and 403 checks had the same flaw: httpx puts the request URL in the message, so a failure on pull request lfreleng-actions#403 read as a 403. The status now comes from the response, with the message used only for exceptions that carry none. GitHub's message and errors[] are read by one shared helper, which the merge path already relied on. An approval 422 is a PermissionError only when GitHub says the approval is not permitted; a 'submitted too quickly' throttle is retried through the duplicate-safe loop, honouring Retry-After or waiting at least a minute; anything else raises ApprovalError with GitHub's message, so the run summary shows it. PermissionError now records the HTTP status that caused it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
One failed approval skipped its repository's other pull requests as 'token lacks required permissions', without calling the API for them. These tests pin the intended scope: only a genuine, non-rate-limit 401 or 403 skips siblings, the skip names the original refusal, and a refusal that contradicts a passing pre-flight check says so. Marked xfail(strict=True) until the change lands. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
Any PermissionError added its repository to the fast-fail set, so a single refused approval failed every later pull request in that repository as 'token lacks required permissions', without a request. The skip now needs a genuine 401 or 403 that is not a rate limit; any other refusal fails its own pull request and the siblings are attempted normally. The skip message names the refusal it follows, for example 'refused with HTTP 403 (approve)'. The CLI records which repository the token pre-flight check passed against, and when a later 401 or 403 contradicts it the guidance points at that repository's access and rules rather than at the token's scopes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
GitHub allows 80 content-generating requests a minute and 500 an hour. The client had one limiter of 8 requests a second shared by reads and writes, so a bulk run made about 600 writes in 12 minutes and had an approval throttled. REST writes and GraphQL mutations now pass a second limiter, which admits 60 a minute and 450 in any rolling hour by default; reads are unaffected. DEPENDAMERGE_CONTENT_PER_MINUTE and DEPENDAMERGE_CONTENT_PER_HOUR change the budget. A secondary limit (403 or 429) or a throttled approval 422 halves the write rate and pauses writes for Retry-After or at least a minute; the rate climbs back after quiet periods. While the hourly budget holds the run back, the progress display says so. Tests land with the code: they import the new limiter module at module level, which fails collection before it exists. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
6 tasks
This was referenced Oct 15, 2026
ModeSevenIndustrialSolutions
approved these changes
Oct 15, 2026
ModeSevenIndustrialSolutions
left a comment
Member
There was a problem hiding this comment.
🤖 Dependamerge
Approved this pull request ✅
ModeSevenIndustrialSolutions
merged commit Oct 15, 2026
104a0cb
into
lfreleng-actions:main
35 checks passed
This branch was previously deployed
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.
Closes #563
Authored by an AI agent; human review required
claude-opus-5.5via GitHub Copilot CLId3cb6f0dfcbd537979175677362242321bf5dc20uv syncuv run pytest -x -q (baseline)uv run ruff check src testsuv run ruff format --check src testsuv run pytest -q tests/test_approval_classification.py (on base sources, expect 22 failures)prek install -t pre-commit -t commit-msgprek run --files <all files changed since base>aislop scan --base d3cb6f0dfcbd537979175677362242321bf5dc20 --jsonuv run pytest -qThe
github-code-monkey-botworkflow opened this pull request.Nobody has merged it; a maintainer must review it first.
Fixes three problems found when a bulk
dependamerge mergerun reported one throttled approval as a token problem and then skipped that repository's other pull requests. There is one commit per fix, and each fix's tests land first as expected failures.1. Classify approval failures by status code and response body
_parse_permission_errornow reads the HTTP status fromerror.response.status_code. It falls back to matching the message only when the exception carries no response. Before this, a failure on/pulls/401/...,/pulls/403/...or on a repository whose name contains those digits was classified as a 401 or 403.github_error_detail, reads GitHub'smessageand everyerrors[]entry, whether a string or an object with amessagefield. The merge path's_extract_github_error_detailnow delegates to it.submitted too quickly,secondary rate limitorabuse detectionin the body): retried through the existing duplicate-safe loop, which checks_has_own_approvalbefore each retry. It waits forRetry-Afterwhen present. Otherwise it waits 60 s, doubling on each attempt, up to 4 attempts.review cannot be requested from pull request author): raised as aPermissionError.ApprovalErrorthat carries GitHub's message word for word._approve_prre-raises it instead of reading the 422 as "already approved", so the run summary shows GitHub's reason.PermissionErrornow carries astatus_code.2. Skip a whole repository only after a genuine 401 or 403
_report_permission_erroradds a repository to_permission_failed_reposonly for a 401 or 403 that is not a rate limit. Any other refusal fails only that PR, and the other PRs in the same repository are still attempted.skipped: an earlier PR in o/r was refused with HTTP 403 (approve). The old message wastoken lacks required permissions on o/r.AsyncMergeManager. If a later 401 or 403 contradicts that check, the guidance points at the refusing repository's access and rulesets instead of the token's scopes.3. Pace content-creating requests and adapt to throttling
ContentLimiter(github_async/_content_limiter.py) limits RESTPOST/PUT/PATCH/DELETErequests and GraphQL mutations. By default it allows 60 a minute and 450 in any rolling hour, below GitHub's limits of 80 and 500. Reads, including GraphQL queries, do not go through it. A write waits for this limiter before it takes a concurrency slot.DEPENDAMERGE_CONTENT_PER_MINUTEandDEPENDAMERGE_CONTENT_PER_HOURoverride the budget, as do newGitHubAsyncconstructor arguments. The README documents both variables.Retry-Afterwhen GitHub sends one, otherwise at least 60 s. After each quiet period the rate climbs back by a fixed step, following the existing_tunepattern.⏳ Waiting on GitHub's content-creation limit [Ns]. Without it, the run would look stalled.Notes for reviewers
xfailmarker cannot apply.merge_manager/_base.py, the two new manager attributes are declared in_single_pr.py, which now carries the samereportUninitializedInstanceVariable=falsepragma thegithub_asyncmixins already use.ApprovalError, soTestApproveRetry::test_does_not_retry_client_errorsnow expects that exception.Validation
uv run pytest: 3197 passed, 20 skipped. Coverage 80.67%.prek run --files <all changed files>: passed (ruff, ruff-format, mypy, basedpyright, write-good, markdownlint, reuse, codespell, pytest). The hooks also ran on every commit, including gitlint.aislop scan --base d3cb6f0with ruff onPATH: 0 diagnostics, and no engine was skipped.