Skip to content

fix(ci): re-run a verdict post the rate-limit floor failed - #16814

Merged
kyle-sexton merged 2 commits into
mainfrom
fix/16642-rerun-floor-failed-verdict-posts
Nov 17, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
fix/16642-rerun-floor-failed-verdict-posts

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Refs: #16642

Summary

The lost-run reconciler re-ran a pr-dispatch-feedback run only when its Post Verify Notes job failed at the kill-switch stop, and settled every other failure. When that job failed at the GITHUB_TOKEN's rate-limit floor, the run was settled too, so the pr-verify verdict never posted its notes or its pr-verify-failed label change. Examples from 2026-11-17: 44115343343 failed at "Post a fail's notes, or find a pass's stale ones" ("GET …/pulls/16805 left GitHub's core API 12 of 5000 requests, at or under its stop-floor share 0.02 … this step fails"), and 44115462193 failed at "Download the verdict" ("'gh api …/runs/44115072049/artifacts?per_page=100' hit GitHub's core API rate limit … the call returns 1").

Fix

  • .github/scripts/maintenance-reconcile-lost-runs/reconcile.mjs, Verdict kind. Before:
    if (rerun.length === 1 && VERDICT_JOBS.has(rerun[0].name) && failedSteps.length === 1 && failedSteps[0] === VERDICT_STOP_STEP).
    After: the same check still takes the kill-switch stop. A new branch also takes a run whose one failed job is Post Verify Notes with exactly one failed step, a whole listing, steps known, and failure annotations that pass the existing floorNoted (through the existing floorFailed, which reads the job's annotations). It stays kind verdict, so the re-run gets the same deferral marker and recoverDeferred path. The item carries floor: true, and the act line then reads "…whose pr-verify verdict the GITHUB_TOKEN's rate-limit floor kept from its PR".
  • Any other failure of that job, including a floor refusal beside a real error, is still settled as before.
  • SETTLED_VERSION goes from 3 to 4, as its comment requires when settle rules change. Floor-failed verdict runs that earlier passes settled are read again, inside the lookback. The first pass after merge carries no settled runs, so it reads every run in the lookback once.
  • The header's Verdict paragraph now states the floor case. The comment above VERDICT_DISPATCH that called every other failure "a red for a person" is removed.
  • pr-dispatch-feedback.yml is not changed.

Verification

  • node --test --test-concurrency=4 .github/scripts/maintenance-reconcile-lost-runs/reconcile.test.mjs: tests 202, pass 202, fail 0.
  • New tests:
    • "a verdict post that failed only at the rate-limit floor is re-run once, as a stopped verdict is". Its fixture keys post-verify-notes-134151757838 and post-verify-notes-134152180441 in fixtures/annotations-floor.json hold the recorded failure annotations of runs 44115343343 and 44115462193.
    • "a verdict post that failed for any reason but the floor is settled, not re-run": a real error alone, a floor note beside a real error, and an exit note beside a real error.
    • "a floor-failed verdict post is not re-run at attempt 2, nor beside a second failed step or job".
  • scripts/check-affected.sh --no-fetch: "13 passed, 6 skipped over 3 changed files". It asked for no changelog fragment.

Remaining

What #16642 still needs after this PR:

  • Report Review Counts in pr-review-main. Its "Record the counts" step (.github/workflows/pr-review-main.yml, report-review-counts job) still writes the verdict check-run with a raw gh api -X POST and no rate guard. It failed with a raw HTTP 403 in 44114818883. This PR leaves it alone because the job has no checkout of log-api-budget (the workflow's own comment says so), so wrapping it means adding a checkout to a checks: write job. Making that failure recoverable also means changing the reconciler's rule that holds a lane run for a person once its verdict write started. Both are design choices.
  • Live proof of done-when item 3. A pull request pushed at the floor should get its review lanes and Mark Lanes with no manual re-run. Proof is a reconcile pass after a reset that re-runs 44115108886 and 44115183006 as floor.
  • Proof this change works live. It needs the first floor-failed verdict post after merge to be re-run with the new log line. Today's example runs may leave LOOKBACK_HOURS before this merges.
  • Steps still fail at the floor rather than wait for the reset. This PR makes one more class recoverable; it does not make steps wait.
  • pr-verify's primary-limit 403 fails red. At remaining 0 it is not isFault (check-trusted-trigger.mjs), so the run fails rather than holding green. The Lane kind still re-runs it when it owns an open head.
  • Unattributed call bursts. The 21:32Z window on 2026-11-16 and about 4,900 core calls from 15:13Z to 15:31Z on 2026-11-17 are not attributed to callers (done-when item 1).

Related

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits November 17, 2026 10:51
Claim commit for the remaining #16642 work: the lost-run reconciler
re-runs a pr-dispatch-feedback run whose post-verify-notes job failed
only at the GITHUB_TOKEN's rate-limit floor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The lost-run reconciler's Verdict kind re-ran a pr-dispatch-feedback run
only when Post Verify Notes failed at its kill-switch step, and settled
every other failure. A verdict whose notes step failed at the
GITHUB_TOKEN's rate-limit floor was settled too, so its notes and its
pr-verify-failed label change never reached the PR.

The Verdict kind now also takes a run whose one failed job is Post
Verify Notes with one failed step whose annotations pass floorNoted.
Any other failure stays settled. SETTLED_VERSION moves to 4, so runs
settled under the old rule are read again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 17, 2026 15:59
@chatgpt-codex-connector

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-17T16:01:04.865082Z 8e37b5c 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 8e37b5cef3388d1815d3f32d4d7308e9dc3ea25f: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review: no findings

I read every hunk of all 3 changed files. None of them is on a trusted path. The change lets the lost-run reconciler re-run one more kind of failed pr-dispatch-feedback.yml run: a Post Verify Notes job that failed at exactly one step, where the GITHUB_TOKEN hit its rate-limit floor. Before this change, only the kill-switch stop step was re-run.

What I checked:

  • The new branch is no less strict than the kill-switch branch (reconcile.mjs#L1663-L1667). It also requires:
    • a whole job listing, with the job's steps known;
    • floorFailed, which reads the job's own check-run annotations through floorNoted (L638-L641) and fails closed on any failure annotation that is not a floor refusal, a could not companion line or the exit note.
  • The run filter is unchanged. Before acting, both branches still pass isStoppedVerdict (L544-L545): the workflow path, a workflow_run event, a failure conclusion, run_attempt === 1 and the lookback. So each run is re-run at most once.
  • Nothing new is trusted. The re-run executes the same workflow code at the same head. Per the existing header text, it sends no address-feedback round, because the lanes trust that only from an attempt-1 dispatcher. No token scope, trusted actor or untrusted-text path changes.
  • Worst case is a redundant re-run. The floor-note regex is not anchored, but it predates this PR. If it matched by mistake, the only effect would be one extra re-run of a trusted run. That leaks no secret, compromises nothing and bills nothing, so it does not count as a finding.
  • Other changes:
    • Bumping SETTLED_VERSION from 3 to 4 only makes the next pass read every run in the lookback window again.
    • The kill-switch gate on the reconciler is unchanged (L1848-L1852).
  • Tests and fixtures add recorded annotations and test cases only.

PR context: the description contains no embedded text addressed to this lane.

Spend: floor-failed verdict runs may now be re-run once each, and the first pass after merge re-reads the lookback window. That uses some more Actions minutes and API calls, with no new paid billing.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review, PR #16814: no findings. This is a full review of the first head; no earlier review applies.

The change adds a second Verdict branch to the lost-run reconciler. A pr-dispatch-feedback.yml run at attempt 1 now gets one re-run as kind verdict with floor: true when all of these hold:

  • its only failed job is Post Verify Notes;
  • that job has exactly one failed step;
  • the listing is whole and the steps are known;
  • floorFailed → floorNoted accepts the job's failure annotations.

What I checked:

  • Branch order (reconcile.mjs#L1639-L1648):
    • The kill-switch case behaves as it did before.
    • A one-step failure that is not a floor failure still reaches the settle branch, because rerun.length === 1, the job is a verdict job and stepsKnown holds.
    • A listing that is not whole, or has unknown steps, is still read again on the next pass rather than settled.
    • An error from the annotations read goes to noteFailure and is retried on the next pass.
  • floorNoted (L638-L641) rejects a floor refusal that sits beside a real error, which matches the PR's claim. Both new fixture messages match FLOOR_NOTE: the stop-floor share one and the hit GitHub's core API rate limit: no call to it before one.
  • Downstream handling:
    • lostNow for kind verdict still uses isStoppedVerdict, which allows attempt 1 only, so the re-run happens at most once.
    • The deferral output and recoverDeferred are unchanged.
    • The floor flag is plain JSON, so it survives the plan-file round trip into act().
    • The existing lane floor kind also re-runs without waiting for the reset, so the new branch follows established timing.
  • SETTLED_VERSION 3 → 4 follows the rule in its own comment. Its only cost is one extra read of every run in the lookback on the first pass after merge, which spends GitHub API budget. That is not a billed charge.
  • Tests cover the two recorded floor cases, three non-floor cases (a real error alone, a floor note beside a real error, an exit note beside a real error), attempt 2, two failed steps, and a second failed job. No test asserts the new act log wording, which is minor and not a finding. I did not run the tests: the PR's 202 pass result is the author's claim and I have not checked it.

Closing issue: the PR context lists none. The PR says Refs: #16642 and does not close it, so I had no acceptance criteria to check.

Embedded text: the PR body has no directives aimed at the review lane.

Loosened-check verdict: fail (the prompt gave no setting, so the default applies); patterns: 0. Re-running a failed post job once more delivers an unchanged pr-verify verdict and makes no check accept more, so it is not a loosening.

Cost: the only spend is GitHub API calls for the extra annotations reads and the one-time full lookback re-read, so no hold applies.

Verifier dropped 0 of 0 candidates.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 2844a8f Nov 17, 2026
103 of 104 checks passed
@kyle-sexton
kyle-sexton deleted the fix/16642-rerun-floor-failed-verdict-posts branch November 17, 2026 16:14
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 4, survived 2, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 67%; mutation score 67%.

File Killed Survived Timeout No coverage Invalid Not run
.github/scripts/maintenance-reconcile-lost-runs/reconcile.mjs 4 2 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
.github/scripts/maintenance-reconcile-lost-runs/reconcile.mjs:406 other productive unclassified
.github/scripts/maintenance-reconcile-lost-runs/reconcile.mjs:1740 UOI productive no-assertion

The run's summary has the full report.

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