Skip to content

refactor(pr-pipeline): name the rate-limit wait budgets once in rate-guard.mjs - #17320

Merged
kyle-sexton merged 1 commit into
mainfrom
refactor/rate-guard-wait-budget-source
Nov 19, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
refactor/rate-guard-wait-budget-source

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: second slice of the rate-guard recovery design the hub ordered after the 2026-11-18 stop-floor failures.

Summary

The pipeline waits out a rate limit in four places, each with its own number. rate-guard.mjs now names them once, in WAIT_BUDGET_SECONDS, and tests pin every workflow literal to it. No wait changes length.

Budget Seconds Who waits
step 60 the rate guard's latch, and the two pinned ci-workflows composites in ci-status
ciStatusReads 825 ci-status's gh_read (GH_READ_JOB_SECONDS less GH_READ_MARGIN_SECONDS)
rerunCiStatus 600 pr-dispatch-feedback.yml rerun-ci-status (POLL_LIMIT_SECONDS)

Fix

  • rate-guard.mjs: WAIT_BUDGET_SECONDS, with SERVER_RETRY_BUDGET_MS derived from its step.
  • pr-require-checks.yml: ci-status passes rate-limit-wait-seconds: '60' to check-contract and aggregate-results. That is their default at the pinned v0.75.0, so the wait is the same; a default changed upstream can no longer move it unseen.
  • rate-guard.test.mjs: ci-status's read deadline, both composite inputs, and rerun-ci-status's poll limit each equal their entry.
  • scripts/ci-gh-read.test.sh: it refused any rate-limit-wait-seconds on ci-status, because a raised wait does not fit the job's timeout. It now requires exactly two quoted numbers summing to at most 120 s, the "two 60 s rate-limit waits" the job's timeout comment budgets.

Owner decision Q677 stands: a wait past a small per-step budget is not a sleep, and the lost-run reconciler recovers the run after the reset.

Verification

  • node --test .github/actions/log-api-budget/rate-guard.test.mjs: 162 pass, 0 fail.
  • bash scripts/ci-gh-read.test.sh: PASS=66 FAIL=0.
  • scripts/check-affected.sh: 14 passed, 5 skipped.
  • Not run on GitHub yet: ci-status passing the input to the composites is first exercised by this PR's own checks.

Related

🤖 Generated with Claude Code

…guard.mjs

WAIT_BUDGET_SECONDS holds the three per-step waits the pipeline already uses:
the latch's 60 s, ci-status's 825 s read deadline and rerun-ci-status's 600 s
poll limit. The latch's budget derives from it, and rate-guard.test.mjs pins
each workflow literal to it.

ci-status now passes rate-limit-wait-seconds '60' to the two pinned
ci-workflows composites, the value they defaulted to, so a default changed
upstream cannot move the wait. ci-gh-read.test.sh holds their sum to the 120 s
the job's timeout budgets, where it refused the input before.

No wait changes length.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 19, 2026 00:04
@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-19T00:06:04.292872Z 4dcf6ac 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-security-review reviewed 4dcf6ac934e679603e61f0094d1dda9d65c5acb9: read 4 of 4 changed file(s); 0 finding(s), 0 as inline comments.

Security review: no security issues found

I read the whole diff for all 4 changed files:

  • .github/actions/log-api-budget/rate-guard.mjs (a trusted path)
  • .github/actions/log-api-budget/rate-guard.test.mjs
  • .github/workflows/pr-require-checks.yml (a trusted path, and the ci-status hold job is a merge-hold control)
  • scripts/ci-gh-read.test.sh

What changed:

  • rate-guard.mjs: adds a frozen constant, WAIT_BUDGET_SECONDS = { step: 60, ciStatusReads: 825, rerunCiStatus: 600 }. SERVER_RETRY_BUDGET_MS is now WAIT_BUDGET_SECONDS.step * 1000, which is still 60 000, so the latch and 5xx retry budget is the same. No token handling, pool classification, header parsing or fail-closed logic changed.
  • pr-require-checks.yml: ci-status now passes the static literal rate-limit-wait-seconds: '60' to the pinned check-contract and aggregate-results composites. The value is a hard-coded constant, not a ${{ }} expression, so it adds no injection surface. It changes no permissions:, if: condition, token, trusted-actor input or exempt-authors value.
  • Tests: these only read workflow files from the repository and assert numeric equality.

Trust controls checked:

  • Merge hold (ci-status steps in pr-require-checks.yml): the only change is an explicit input on two existing composite calls. A bounded wait can at most make the job stop earlier and leave the run to the lost-run reconciler. It cannot turn a failing or pending check into a pass. This rests on the pinned composites at v0.75.0 already defaulting to 60, which the PR description states and I could not read in the checkout.
  • Other controls: the trusted-trigger check, lane token scope, kill switch and token broker are not touched.

No changed file is an instruction surface or plugin manifest, so there is no manifest block. The prior-findings file shows no earlier review of this pull request (blocking only: no).

Spend: none. No wait gets longer, so there are no extra runner minutes, lane runs or API calls.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings

This PR gives the rate-limit wait budgets one source, WAIT_BUDGET_SECONDS in rate-guard.mjs, and pins each workflow literal to it with a test. I read all four changed files in full in the diff and checked the pinned values against the workflows at head:

  • ci-status's read budget is 825 s. The job sets GH_READ_JOB_SECONDS: 1200 and GH_READ_MARGIN_SECONDS: 375, and 1200 − 375 = 825 (pr-require-checks.yml#L4337-L4338).
  • The two composites' waits are 60 s each. rate-limit-wait-seconds: '60' lands inside the check-contract step (L5325/L5333) and the aggregate-results step (L7360/L7388). ci-status is the last job in the file (it starts at L4269), so jobOf and the bash test's awk both read to the end of the file and find exactly these two inputs.
  • The prose still matches. The job's timeout comment at L4303 mentions rate-limit-wait-seconds followed by a backtick, not a colon, so it doesn't change the bash test's grep -c 'rate-limit-wait-seconds:' count of 2.
  • rerun-ci-status's poll limit is 600 s. POLL_LIMIT_SECONDS: '600' is set inside the rerun-ci-status job (pr-dispatch-feedback.yml#L793), so the setting() regex returns [600].
  • SERVER_RETRY_BUDGET_MS is unchanged. It is still exported, and step * 1000 is still 60 000 ms.
  • A workflow-only edit still runs the new tests. rate-guard.test.mjs names pr-require-checks.yml and pr-dispatch-feedback.yml as string tokens. Each basename belongs to only one file in the repository, so scripts/affected-tests.sh's naming rule selects the suite when either workflow changes; no test-scope: line is needed.

I did not run either test suite. The pass counts in the PR body (162 pass; PASS=66) are the author's claim and unverified. As the PR says, the composites' handling of the new input is first exercised on GitHub. I couldn't confirm from this repository that the pinned ci-workflows v0.75.0 composites declare rate-limit-wait-seconds with a default of 60; that is also the author's claim.

Loosened checks. scripts/ci-gh-read.test.sh used to reject any rate-limit-wait-seconds on ci-status. It now accepts exactly two quoted values that sum to at most 120 s. On its own, the bash check accepts splits like 0+120 that it used to reject. Across both suites, though, the passing set is now only the explicit 60/60 that rate-guard.test.mjs pins, where before it was a missing input that let an upstream default change unseen. The stated protection (a raised total wait fails) still holds, so I judged this a stricter pin rather than a loosening.

Loosened-check verdict: fail (lane default; the prompt sent no loosened_check_verdict: or loosened_check_patterns: lines); patterns: 0. The prompt also sent no loosened_check_decision_record: line, so I did not check the citation requirement.

Other criteria:

  • Closing issue: none. The PR context says "No related issue", so there are no acceptance criteria to check.
  • Path-scoped rules: no rule in .claude/rules/ has a glob that matches a changed file.
  • Paved paths: the standards index has no paved-path row.
  • Manifests: the PR changes no plugin manifest.
  • Embedded instructions: the PR context contains none aimed at this lane.
  • Spend: nothing changes; the PR keeps every wait the same length.

Verifier dropped 0 of 0 candidates.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit ac92d52 Nov 19, 2026
81 of 94 checks passed
@kyle-sexton
kyle-sexton deleted the refactor/rate-guard-wait-budget-source branch November 19, 2026 01:05
@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
Takes #17320's WAIT_BUDGET_SECONDS and reads the lane's 1200 s from it:
WAIT_BUDGET_SECONDS.workResolveIssue is waitBudgetMs's cap, and
rate-guard.test.mjs pins every rate-limit-wait-seconds and
API_BUDGET_WAIT_SECONDS literal in work-resolve-issue.yml, and the leak
scan's cap in pr-run-activity-read.yml, to it. The tests' 1200s read
the constant, and the leak-scan timeout assertion accepts the input's
expression.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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