Skip to content

fix(pr-pipeline): wait out a near reset on the merge-group queued PR read - #17433

Merged
kyle-sexton merged 1 commit into
mainfrom
fix/queued-pr-read-waits-reset
Nov 19, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
fix/queued-pr-read-waits-reset

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Refs: #17382

Summary

In a merge group, Check Plugins' Resolve the queued pull request step (queued_pr) read the pull request with a single gh api call. When that call hit a rate limit, the step failed immediately. The bump, fragment, release and vendor gates all read QUEUED_PR, so each then refused ("The queued pull request could not be resolved"), and the group was ejected. At the GITHUB_TOKEN exhaustion at 06:41Z on 2026-11-19, the vendor gate's refusal ejected 5 merge groups (lessons-ledger row L852).

Fix

Verification

  • bash scripts/ci-queued-pr.test.sh: 9 pass. Two new cases were written first and failed before the fix: a reset 1 s away is waited out (two reads, one sleep, correct outputs); a reset 3600 s away fails with one read and no sleep.
  • node --test .github/actions/log-api-budget/rate-guard.test.mjs: 164 pass. A new test pins the step's QUEUED_PR_WAIT_SECONDS and the job's timeout (9 min + the wait) to WAIT_BUDGET_SECONDS.queuedPr.
  • scripts/check-changelog-fragments.sh --check and --check-required origin/main pass. shellcheck is clean.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj

…read

Check Plugins' "Resolve the queued pull request" step read the pull
request with one gh api call. A rate limit failed it at once, and the
bump, fragment, release and vendor gates then refused, which ejected the
merge group (5 groups at the 06:41Z exhaustion on 2026-11-19).

- The read goes through retry_call --read with QUEUED_PR_WAIT_SECONDS,
  so a rate limit whose reset is at most WAIT_BUDGET_SECONDS.queuedPr
  (900 s) away is waited out and read again.
- check-plugins' timeout rises from 9 to 24 minutes to hold the wait.
- rate-guard.test.mjs pins the step's literal and the timeout to the key;
  ci-queued-pr.test.sh covers a reset inside and past the budget.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 19, 2026 14:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T14:21:47.569417Z 8f3923a Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 8f3923aeecbcf71a3299dfa40ccc6e369f1472bb: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #17433, wait out a near rate-limit reset on the merge-group queued PR read

No blocking or advisory findings. I read all 6 changed files in full in .claude-lane/pr.diff.

What I checked

  • The read path (.github/workflows/pr-require-checks.yml, Resolve the queued pull request):
    • The step sources rate-stop.bash and retry-call.bash after api-budget.bash, which is the order retry-call.bash requires.
    • read_pr calls the wrapped gh function, so a 403 rate-limit reply records its stop. retry_call then sleeps until - now.
    • After that sleep, api_budget_stop_until ($2 > now) no longer counts the stop. So api_budget_refuse does not block the next try.
    • A reset beyond the 900 s budget is not slept on, and the step fails with one read, as before.
    • Every try overwrites $RUNNER_TEMP/queued-pr.json, and the body is read only after retry_call returns 0. A refused read's body never becomes pr.
    • Calling retry_call inside || { ...; exit 1; } keeps bash -e from cutting the retry loop short.
  • Side effect: non-rate-limit failures (for example a 404 or 5xx) now get up to 3 tries with a jittered backoff of at most about 45 s. That doesn't change what the gates accept.
  • Timeout: timeout-minutes: 24 equals 9 + 900/60. The new test in rate-guard.test.mjs pins both the env value and the timeout to WAIT_BUDGET_SECONDS.queuedPr, so they cannot drift apart.
  • Tests (scripts/ci-queued-pr.test.sh):
    • The stub gh returns one 403 and then a 200. The stub sleep logs each wait.
    • Each expect resets the call log, so the calls() counts (2 when inside the budget, 1 when past it) are per case.
    • The reading check is skipped only for the limited cases.
  • Docs and changelog: the rate-guard.mjs key comment, the pr-pipeline README "Outage posture" exception and the bump: patch fragment match the behavior.

Criteria

  • Closing issue: the PR only says Refs: #17382 and closes no issue, so there are no acceptance criteria to check against.
  • Loosened checks: none of the nine kinds applies. The retry is on a data read, not on a check's pass or fail, and the gates judge the same PR data. Job timeouts are explicitly not judged by this criterion.
  • Verification: the PR's test results (9 pass, 164 pass, shellcheck clean) are the author's claims. I did not run them.

Spend (not a hold): during a rate limit, check-plugins can now hold a standard ubuntu-24.04 runner for up to 15 more minutes per merge group. It uses no larger runner and no new paid resource.

Loosened-check verdict: fail (default; the prompt has no loosened_check_verdict: or loosened_check_patterns: lines, so no consumer entries apply); patterns: 0. The prompt has no loosened_check_decision_record: line, so the citation requirement was not checked.

Verifier dropped 0 of 0 candidates.

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 8f3923aeecbcf71a3299dfa40ccc6e369f1472bb: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Security review: no security issues found

I read all six changed files in full. This PR changes how Check Plugins' merge-group Resolve the queued pull request step reads the pull request. Instead of one gh api call, the read now goes through retry_call --read. When a rate limit resets within QUEUED_PR_WAIT_SECONDS (900 s), the step waits for the reset and reads again. The job's timeout-minutes goes from 9 to 24.

What I checked

  • The step still fails closed. retry_call returns 0 only when the command succeeds and 2 in every other case (retry-call.bash#L29-L58). On 2, the step runs exit 1 (pr-require-checks.yml#L2521-L2524). The bump, fragment, release and vendor gates still refuse whenever steps.queued_pr.outcome != success (L2546-L2553). The step's continue-on-error: true was already there. No gate lets through anything the base stopped.
  • A refused read cannot become the answer. read_pr overwrites $RUNNER_TEMP/queued-pr.json on every try. The file is read only after retry_call returns 0, so a 403 body from an earlier try never feeds the author, head ref or head SHA outputs.
  • No new injection surface. $number still comes only from the ^…/pr-([0-9]+)-[0-9a-f]{40}$ match on QUEUE_HEAD_REF, which reaches the step through env:. "$*" passed to rate_stop_from holds only the function name.
  • No trust control is widened. The token (github.token), the permissions: block, the trusted-actor checks, the kill switch and the merge holds are all unchanged. The rate-guard.mjs edit only adds the queuedPr: 900 key to the frozen WAIT_BUDGET_SECONDS. The test and docs changes have no security effect.
  • No instruction text is removed or softened. I found no embedded instructions in the PR context.

Spend (not a finding, not a hold): the timeout rise from 9 to 24 minutes lets one check-plugins job run up to 15 minutes longer on a standard ubuntu-24.04 runner, and only when it is waiting for a rate-limit reset. That is longer runs within existing Actions usage, not a new paid plan or larger runner.

critical-findings: 0

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 19, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit dd17d9d Nov 19, 2026
84 of 97 checks passed
@kyle-sexton
kyle-sexton deleted the fix/queued-pr-read-waits-reset branch November 19, 2026 15:51
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 19, 2026
kyle-sexton added a commit that referenced this pull request Nov 19, 2026
Keep both waits #17433 and this branch add: WAIT_BUDGET_SECONDS carries
ciStatusVerify and queuedPr, rate-guard.test.mjs keeps both timeout
tests, and the outage-posture paragraph names both readers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant