Repository navigation
fix(pr-merge): skip a pull request whose auto-merge arm is refused instead of failing the run - #9680
Conversation
…stead of failing the run GitHub refusing one pull request's arm (a GraphQL error or a 4xx other than 401, 403 and 429, and not rate-limited) is now a warning carrying GitHub's message; that pull request is skipped this run, its slot under merge.max-in-flight is released, and the other candidates are still armed. The step stays green, with a summary warning when every arm was refused. Network errors keep the existing resend, and a 401, 403, 429, 5xx or rate-limited answer still fails the run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DUS7XB8hUjcDnuSYLqJRzd
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 the incremental change ( I read the incremental diff and the PR context, and checked the
critical-findings: 0 |
|
claude-review reviewed Incremental review of I only read the code; I did not run the tests. The PR body reports 335 passing tests, which is author-claimed and unverified by me. What I checked:
Closing issue #9620: its body is omitted from the PR context. The one comment kept says the defect is confirmed and asks for a quick fix, and it states no acceptance criteria. Nothing to check against. No plugin manifests changed, and no hold class applies: no model or API spend, no trusted-actor or |
…rk once the run has an answer An arm that keeps failing on the network after its resends, in a run where another GitHub call answered, is now a warning naming the pull request and the error; that pull request is skipped and its in-flight slot released, and the run stays green. A run where no call answered is an outage and still fails red. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DUS7XB8hUjcDnuSYLqJRzd
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d588220f4c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…a run where no arm landed An arm that failed on the network, or was refused after a resend, keeps its merge.max-in-flight slot, since an earlier send may have landed; only a refusal on the first send frees it. withRetry tags each thrown error with its send count. A run fails when every arm in it failed on the network, or when two or more arms ran and none landed. A GraphQL error typed RATE_LIMITED, FORBIDDEN or INSUFFICIENT_SCOPES is run-wide, never a refusal of one pull request. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ason Two or more arms all refused now fail the run only when every one failed on the network, answered 404, or carried GraphQL errors that name no type, which may be the run's own fault (a wrong API URL). Refusals that name their reason, such as a 422, stay per pull request, so two pull requests each refused for their own reason no longer keep the job red. The header rate-limit test no longer carries a RATE_LIMITED type, so the headers alone decide it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #9620
Summary
When GitHub refused to arm auto-merge on one pull request, or the arm kept failing on the network,
enable-auto-mergefailed the whole step, so a single bad candidate turned the merge lane red on every run. Now that pull request gets a warning naming the reason, it is skipped for this run, and the other candidates still get armed. The run still fails when no arm lands, or when the error hits every pull request alike.Fix
In
.github/scripts/pr-merge/enable-auto-merge.mjs:Per-PR refusal.
refused(error, runWide)treats an error as GitHub refusing one pull request when it is aGitHubErrorwith GraphQL errors (status 200) or any 4xx except 401, 403 and 429. It is never a refusal when the answer is run-wide:x-ratelimit-remaining: 0orretry-after), whichmainreads throughcreateGitHub'sonResponse;RATE_LIMITED,FORBIDDENorINSUFFICIENT_SCOPES.GitHub's docs say a primary GraphQL rate limit answers 200 with errors. A refusal logs
::warning title=enable-auto-merge::#N arm refused, skipped this run: <status line>: <GitHub's messages>.Per-PR network failure. The issue's case is run 40058246788, which logged
##[error]#9540 arm: fetch failed, a TypeError with no cause. An arm that still fails on the network after the existing resends logs::warning title=enable-auto-merge::#N arm failed on the network after its resends, skipped this run: <error>. Why fix(planning): brief TLDR reads "1 question" for a single question #9540 failed this way is unknown; it has since merged.In-flight slots.
withRetrytags each error it throws with its send count (attempts). Only a refusal on the first send frees the pull request'smerge.max-in-flightslot. A refusal after a resend, or a network failure, keeps the slot counted, because an earlier send may have landed. The next run counts it again fromautoMergeRequest.When the run fails. It fails when no arm in it landed and either every arm failed on the network, or two or more arms ran and each one failed without a reason of its own: a network failure, a 404, or GraphQL errors that name no
type. Such failures may be the run's own fault, for example a wrong API URL. Refusals that name their reason, such as a 422 or a typed GraphQL error, belong to each pull request, so two pull requests refused for their own reasons keep the run green. A single refused arm stays green. Either way, a summary lineevery arm this run failed: #a, #bis written, as an error or a warning to match the outcome.Unchanged. Network errors keep the full-jitter resend. A 401, 403, 429 or 5xx answer, a failed disarm and a failed pin still fail the run.
check-trusted-triggeris unchanged.Verification
RATE_LIMITED,FORBIDDENandINSUFFICIENT_SCOPESfail the run and are not counted as refusals.main's real client against a stubbedfetch. The header rate-limit test carries no errortype, so the headers alone decide it. Guard tests keep 401, 403, 429 and 502 red with no resend.node --test .github/scripts/pr-merge/*.test.mjs: 336 pass, 0 fail.scripts/check-affected.sh --tests: 9 passed, 5 skipped.Related
🤖 Generated with Claude Code