Skip to content

feat(pr-pipeline): emit one api-stop notice for the pools a job's rate guard stopped - #17318

Merged
kyle-sexton merged 5 commits into
mainfrom
feat/rate-guard-api-stop-notice
Nov 19, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
feat/rate-guard-api-stop-notice

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

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

Summary

A job whose rate guard stopped a pool now ends with one api-stop notice:

::notice title=api-stop::<pool> <reset epoch> <cause>[ guessed][; ...]

One entry per stopped pool, at its latest reset. <cause> is limit or server-<5xx>; guessed marks a time no response header gave. A reader that recovers a stopped run can take the pool, the reset and the cause from this line instead of matching each refusal's wording.

Nothing reads the notice yet. The reconciler's reader is the next slice, after #17313 and #17315 merge, since both rewrite floorNoted and floorReset.

Fix

Today the lost-run reconciler finds a floor stop by matching annotation prose (FLOOR_NOTE, FLOOR_TIME, RATE_REFUSAL, RATE_RESET in reconcile.mjs) against four writers. A writer it does not match is missed: the pinned aggregate-results composite's "rate limited past rate-limit-wait-seconds" on run 44419777099 is one.

  • api-budget.bash: api_budget_emit_stops reads the guard's own stop, cause, guessed and fallback files in $RUNNER_TEMP/api-budget, by the stop file's line rule. A stop is a server error hold only when every cause line of it is one, the rule api_budget_server_status applies.
  • log-api-budget/action.yml: emits it first, ahead of the counting notices, so GitHub's cap of 10 annotations a step keeps it.
  • pr-require-checks.yml: ci-status's log step and mark-lanes' exit trap emit it first too. The two API_BUDGET_SH blocks are regenerated by scripts/sync-hold-floor.py.

Not covered: jobs that write their own api-calls notice inline without the action (some intake, review-count and activity-scan jobs), and the pinned ci-workflows composites, which do not write the job's stop file.

Verification

  • node --test .github/actions/log-api-budget/log-api-budget.test.mjs: 85 pass, 0 fail. Seven new tests: latest reset per pool in pool order; a past reset still named; server-<5xx> only when every cause is one; guessed from either file and only for the same reset; malformed and unterminated stop lines ignored; a stop the gh wrapper records for a refused 403 is the stop named; the action, ci-status's log step and mark-lanes' trap each write it first.
  • scripts/check-affected.sh: 14 passed, 5 skipped.
  • No run on GitHub has emitted the notice yet.

Related

🤖 Generated with Claude Code

…e guard stopped

The job-end budget log writes `api-stop <pool> <reset epoch> <cause>[ guessed]`
from the guard's stop, cause, guessed and fallback files, one entry per stopped
pool, ahead of the counting notices. A reader that recovers a stopped run can
take the pool, the reset and the cause from it instead of matching each
refusal's wording.

The log-api-budget action, ci-status's log step and mark-lanes' exit trap emit
it. pr-require-checks.yml's two API_BUDGET_SH blocks are regenerated by
scripts/sync-hold-floor.py.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 18, 2026 23:59
@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:02:20.984824Z dffb6df 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dffb6df454

ℹ️ 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".

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review needs no new review of 4cb42ac8f59c99cb69d2fc31ba2726884f231205: no file of this pull request changed since the review of ce7f1c1.

Security review: PR #17318, incremental (1884149 → ce7f1c1)

No security issues found. I read every hunk of the 4 files in this push. This lane already reviewed an earlier head, so this review reports only blocking findings.

What changed: scripts/sync-hold-floor.py now leaves full-line comments out when it writes the two API_BUDGET_SH copies in pr-require-checks.yml. Its own docstring gives the reason: GitHub's 500 KB limit on a workflow file. The copies in ci-status and mark-lanes are regenerated to match. log-api-budget.test.mjs now compares each copy with api-budget.bash minus ^[ \t]*#.*\n lines.

  • Does removing the comments change what runs? No. I listed every line in api-budget.bash that starts with optional whitespace and then #, which is exactly what both filters remove (Python line.lstrip().startswith("#"), JS /^[ \t]*#.*\n/gm). Each one is a real bash comment outside any quoted string: a header block, a function doc, or a # shellcheck directive. None sits inside the multi-line awk program (API_BUDGET_ROUTE) or the jq programs (API_BUDGET_CLASSIFY, API_BUDGET_SERVER_ERROR), so no program text or data line is lost. The executable lines in the regenerated copies match the hunks unchanged.
  • Is a merge hold weakened? No. ci-status is a merge-hold job, but its logic is unchanged: only comments are removed. No if:, permission, token request, exit status or hold condition changes. The Python and JS filters match the same set of lines, so the test that keeps the copies in sync still works.
  • Trust controls: no trusted-actor list, token scope or kill switch is touched, and no untrusted text gets a new path to a lane.
  • Settled thread (api-budget.bash, guessed/fallback split): this push does not touch the code that thread covered.
  • Embedded instructions: none found in the PR context.

Spend: none. The change only removes comments and adds no API calls or runs.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

claude-review needs no new review of 4cb42ac8f59c99cb69d2fc31ba2726884f231205: no file of this pull request changed since the review of ce7f1c1.

Code review: no blocking findings

This was a blocking-only review. This lane already reviewed an earlier head (1884149e), so this pass looked only for blocking problems. Its scope was the four files changed since then: api-budget.bash, log-api-budget.test.mjs, pr-require-checks.yml and scripts/sync-hold-floor.py. I read every hunk of all four in the incremental diff.

The change drops full-line comments from the two API_BUDGET_SH copies in pr-require-checks.yml. The PR gives GitHub's 500 KB workflow-file limit as the reason. I found no blocking problem:

  • Only real comments are dropped.
    • The generator now skips any line whose text, after leading whitespace, starts with # (sync-hold-floor.py#L174).
    • I checked every matching line in api-budget.bash from line 111 onward. Each is a bash comment outside any quoted awk or jq program, so no program text is lost.
    • The lines removed from the YAML in the diff are exactly those comments. Every code line around them is unchanged.
  • The test and the generator strip the same lines. The test now compares each copy with the library minus ^[ \t]*#.*\n, which is the line set the generator's lstrip().startswith("#") drops. A drift between a copy and the library still fails the test.
  • Removing the # shellcheck directives is safe in the copies. They lived inside an env: value, which no lint step runs over. The library file still keeps them.
  • Documentation moved with the change. The note about the copies was removed from api-budget.bash. The generator's docstring now records that the copies leave out full-line comments, and why.

Closing issue: none. The PR context says this is the first slice of a design, so there are no acceptance criteria to check. The PR context, settled-threads and prior-findings files contained no embedded directives.

Prior finding: the only earlier post is a summary comment with no line anchor and no findings, so there is nothing to repeat.

Loosened-check verdict: fail. That is the default, because the prompt gave no loosened_check_verdict: or loosened_check_patterns: line; patterns: 0. The prompt also gave no loosened_check_decision_record: line, so the citation requirement was not checked. This push loosens no check: the copy test still compares each copy with the library, now without its full-line comments.

Spend: none. This push changes only comment lines in an embedded env value, plus the generator and its test.

Verifier dropped 0 of 0 candidates.

kyle-sexton and others added 4 commits November 18, 2026 20:23
… stop notice

Concatenated, an unterminated last line in guessed merged with the first
line of fallback, so a whole fallback record was dropped and its stop
lost the "guessed" mark. A \002 line between the two ends any partial
guessed line on a line no pattern matches, and the fallback starts on a
line of its own. The two verbatim copies in pr-require-checks.yml carry
the same change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
pr-require-checks.yml reached 512,670 bytes with the api-stop function,
over GitHub's 500 KB workflow file limit, so its runs failed with no
jobs. sync-hold-floor.py now embeds api-budget.bash without its
full-line comments (declare -f of both forms is identical), which takes
the file to 481,110 bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit d72cf09 Nov 19, 2026
66 checks passed
@kyle-sexton
kyle-sexton deleted the feat/rate-guard-api-stop-notice branch November 19, 2026 03:30
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 19, 2026
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