Repository navigation
fix(pr-pipeline): wait out a short rate-limit reset in the shared rate guard, hold past it when the step opts in - #12944
Conversation
…ep holds The rate latch now waits out a stop whose reset fits the 60 s budget (SERVER_RETRY_BUDGET_MS, moved into rate-guard.mjs) and sends the call, instead of refusing it. createGitHub resends a read a rate limit refused once the reset passes, inside its 3 attempts. Past the budget the call is still refused; under API_BUDGET_HOLD=1 the refusal logs a notice and leaves the exit to the caller instead of failing the step. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015te8Cr8u7uFJG4tdeUACLz
…s caller holds api-budget.bash prints its rate-limit lines as ::notice:: under API_BUDGET_HOLD=1 and keeps returning 1, so a caller that does not hold, such as ci-status, still fails closed. The two verbatim copies in pr-require-checks.yml follow. The outage-posture audit narrows the three shared rows to the workflow opt-in, and a changelog fragment records it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015te8Cr8u7uFJG4tdeUACLz
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015te8Cr8u7uFJG4tdeUACLz
The guard failed the step on the first refusal even when createGitHub then waited out the reset and the resend succeeded. retryServerErrors now marks each attempt it would resend (RESEND), and the guard logs a notice and skips the failure for such a refusal, with the same predicate (refusedForLimit, moved into rate-guard.mjs, plus the latch's waits). A refused mutation, the last attempt and a reset past the budget still fail. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015te8Cr8u7uFJG4tdeUACLz
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015te8Cr8u7uFJG4tdeUACLz
…e wait budget The rate guard now waits out a reset within 60 s before failing, so a retry-after of 60 made this test wait a real minute. A reset of 120 s is past the budget and is refused at once. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015te8Cr8u7uFJG4tdeUACLz
…re audit The lane rows and the shared-code paragraph now say the rate guard waits out a reset within 60 s and refuses past it (a notice under API_BUDGET_HOLD=1), cite the current lines, and give the shared client's 3 attempts with full jitter. The Remaining table gains a row for budgetedFetch, whose client sets no resendLimited, so the guard fails the step on a refusal it waits out and resends. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015te8Cr8u7uFJG4tdeUACLz
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95bc909638
ℹ️ 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".
…starts retryServerErrors started each attempt's AbortSignal.timeout and its clock before calling the guarded fetch, so the latch's wait for a rate-limit reset ran inside the attempt: a wait past attemptTimeoutMs sent the resent read on an aborted signal, and the wait counted toward the 60 s server-retry budget when that attempt failed. The latch now exposes waitOut, and retryServerErrors calls it with its own sleep before it starts the timeout and the clock. The guard's own wait then finds nothing left. Refusal past the budget, the hold notice, RESEND and refusedForLimit are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015te8Cr8u7uFJG4tdeUACLz
|
claude-security-review reviewed Security review: PR #12944, incremental since 95bc909No security issues found. I read every hunk of the 3 files changed since the last review. Two of them are on trusted paths, so I read their whole change and what it gates: Trust controls checked
Other notes
critical-findings: 0 |
|
claude-review reviewed Code review (incremental): PR #12944, 95bc909 → 35c0274I read every hunk of the 3 files in the incremental scope:
I also read the head versions of Prior finding: resolvedThe blocking finding from the last round was that the latch wait ran inside the attempt's timeout and counted against the 5xx budget (earlier comment). This push fixes it:
I traced both new tests by hand against the head code, and they test what they say:
Settled threadsThe only settled thread is on Other checks
SpendThe latch can still sleep up to about 61 s per process before a call. That uses runner time, which is subscription or prepaid usage, so it is not a hold. No new findings. |
Refs: #12292
Summary
Problem: a short GitHub rate limit ended lane steps red even when the reset was seconds away. Intent: "waits out a short reset and holds instead of failing the step".
This PR delivers the shared rate-guard part of #12292: criteria 1 and 2 of the 2026-11-03 decision, plus the audit's "shared 2"
api-budget.bashrow. The rate guard now waits out a reset within the existing 60 s budget (SERVER_RETRY_BUDGET_MS) and then sends the call.check-trusted-triggergets the same wait through the latch. Past the budget, the call is still refused. A step that opts in withAPI_BUDGET_HOLD=1reports that refusal as a notice instead of::error. No workflow opts in yet.Fix
rate-guard.mjs: the latch waits out a stop that fits the 60 s budget, then sends the call.createGitHubresends a read refused for a rate limit within its 3 attempts, and that refusal fails nothing. Past the budget the call is refused:::errorand a failed step by default, or a notice under the hold, which leaves the exit to the caller.check-trusted-trigger.mjs: passes its sleep intolatch.guardand resends a limited read, so it waits instead of refusing within the budget.api-budget.bash, plus its two verbatim copies inpr-require-checks.yml: a notice instead of::errorunder the hold. Every refused call still returns 1, so a gate that does not hold still fails.check-wip-cap.mjsstarts the run on a failed read). A blanket hold could therefore let a refusal pass. Tests confirm that a trust check refused under the hold returnsproceed=false.docs/outage-posture-audit.md: Remaining narrows to the open rows. The lane rows and citations now match the code, including the shared client's 3 attempts with full jitter.Verification
node --testpassed 934 of 934 on the changed suites: rate-guard, log-api-budget, check-trusted-trigger, callers and resolve-pr. The run had merged origin/main.scripts/check-changelog-fragments.sh --checkreported all 39 fragments valid. markdownlint-cli2 on the audit doc reported 0 issues.Remaining
API_BUDGET_HOLD=1one step at a time. Never set it at job or workflow level, wherecheck-trusted-trigger,check-wip-capor ci-status runs.budgetedFetchinrequest-budget.mjswaits out a short rate limit and resends, but its client does not setresendLimited. The guard still fails the step.report-outcome.mjs --find-priorholds on a failed read.stop-routes.jsonretry-spent no longer fails the issue when every retry was a fault.apply-verdict.mjsholds green with a notice on an admission or read error.label-unblocked.mjsholds on a failed listing without losing the closes it missed, drops the stored breaker-trip records, and sends etag on the sweep.handoff-evidence.shuses capped backoff with full jitter and a green hold on a failed read.fix-docs-dispatch.mjsno longer counts a red outage run as done.decide.mjsno longer posts failure on no verdict.reconcile.mjsdrops the status-page gate and the one-time re-run record.resolve-pr.mjscompleteness throws hold instead of going red, andcheck-trusted-trigger.mjssends etag on the re-run record poll.limit-stop.mjs's per-head cap stops acting as a stored breaker, andescalation-routes.jsonfiles no fail route on a job fault.Related
🤖 Generated with Claude Code
https://claude.ai/code/session_015te8Cr8u7uFJG4tdeUACLz