Skip to content

fix(pr-pipeline): re-run floor-stopped ratings and stopped reviews - #17313

Merged
kyle-sexton merged 2 commits into
mainfrom
fix/reconcile-floor-and-switch-noop-reruns
Nov 19, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
fix/reconcile-floor-and-switch-noop-reruns

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: two stalls the 2026-11-18 rate-limit floor exposed in the lost-run reconciler.

Summary

The lost-run reconciler now re-runs, on its first pass after the token pool resets:

  • a merge-risk rating (pr-rate-merge-risk.yml) the GITHUB_TOKEN floor stopped, which it never listed before;
  • a head's hosted review runs a kill switch stopped green, in the same set as the floor or lanes-switch re-run of its pr-require-checks run, instead of a pass later.

Every floor kind now waits until a minute past the reset its refusals name, so its one re-run is not spent inside the floor.

Fix

Case 1, merge-risk runs 44402781806 (#17222) and 44402781658 (#17048): not covered. Rater runs are workflow_run runs on main, so the per-head listing never sees them, and the lane listing walked only RECORDED_LANES (pr-verify, pr-review-main). The rater's trigger check already takes the reconciler's record (pr-rate-merge-risk.yml:209,620, reconciler-workflow:) and mints no broker token, which is the admission rule RECORDED_LANES states. It joins with its own judge and write steps (Rate the pull request, Write the rating); holdReason now reads each lane's write step. LANE_TRIGGERS gets success only, matching the rater's job if.

Case 2, #17282 review runs 44403904742 and 44403904926: sequencing. At the 21:50 pass (44405621288) the head's pr-require-checks run 44403903762 took the Floor kind (Mark Lanes refused at the floor). The Review kind is skipped once a set is non-empty, and it keys on ci-status's "a kill switch was on when it started" note, which attempt 1's floored ci-status never wrote. Attempt 2 wrote it at 21:53. The 22:12 pass (44409258703) found the PR already at a new head (pushed 22:08), so a push, not the reconciler, recovered this one. Without that push the reviews would have gone one lane per pass, taking ci-status to attempts 3 and 4; attempt 4 is past RECONCILER_ATTEMPT_CAP (3), so pr-verify would refuse it.

Now a Floor or Switch set also carries the head's stopped reviews, read from their own jobs (reviewStopped, rateHeld), and both lanes go in one pass, so ci-status reaches attempt 3 at most. When the whole set does not fit the record uploads left, the floor re-run goes alone and the reviews wait a pass (a replay of the real 21:50 state is a test).

Reset wait. floorReset reads the latest reset the refusals name, counting the rate guard's guessed (fallback) times only when no refusal names a real one. The CI floor, the Verdict floor, and a lane run that ended within the last hour wait until RATE_RESET_GRACE_MS past it; a waiting run keeps the pass from writing clean.

Behavior changes to note:

  • Any lost attempt-1 rater run whose rating write never started is now re-run once (cancelled, timed out, or a failed rate step), spending a second rating.
  • A ci-status whose refusals name only a guessed reset waits up to about an hour past the real one.
  • The workflow file's copy of the Review paragraph, which said one lane per pass, is removed; reconcile.mjs's header describes it.
  • New doc comments are JSDoc blocks, an allowed shape under ADR 0108 decision 1 ("a doc comment").

Not done: a rater run a kill switch stopped ends green with no rating (pr-rate-merge-risk.yml:110-111) and is still not re-run. Detecting it needs a succeeded-run listing like the fault-held one (key leg: Check the kill switch success, Resolve the pull request skipped).

Verification

  • node --test .github/scripts/maintenance-reconcile-lost-runs/*.test.mjs: 259 pass, 0 fail.
  • New tests run on recorded API responses (fixtures/runs-floor-switch-2026-11-18.json: the rater run's jobs and annotations, test(source-control): give the capped-install case a 3s cap #17282's attempt-1 checks jobs with annotations, both review runs' jobs): the rater is re-run once at the 21:50 pass and not at 21:45 or at attempt 2 or after its write started; the floor plus both reviews go together at 21:50 and not inside the floor; reviews at attempt 2 are not re-run; the 21:50 replay; floorReset real versus guessed; every workflow taking the reconciler record is a recorded lane or excluded with a reason; the rater still names its steps and takes the record.
  • Mutants (rater removed, reviews not joined, no reset wait, guess beats real, no split) each fail at least one new test.
  • scripts/check-affected.sh: 13 passed, 6 skipped.

Related

  • Rate guard refusal text: .github/actions/log-api-budget/rate-guard.mjs.
  • No changelog fragment: the change touches no plugin and no listed convention (scripts/lib/changelog-fragments.sh).

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits November 18, 2026 18:23
…pped reviews on the first pass after the reset

The lost-run reconciler never listed pr-rate-merge-risk runs, so a rating
the GITHUB_TOKEN floor stopped stayed unrated. The rater's trigger check
already takes the reconciler's record, so it joins RECORDED_LANES with its
own judge and write steps (Rate the pull request, Write the rating).

A floor-failed pr-require-checks run took one pass and the head's
kill-switch-stopped reviews another, since the floored ci-status never got
to name them; with one review lane per pass, ci-status could reach attempt
4, past RECONCILER_ATTEMPT_CAP. A floor or lanes-switch set now carries the
head's stopped reviews, read from their own jobs, and both lanes go in one
pass.

Every floor kind now waits until a minute past the pool reset its
refusals name (floorReset, a guessed time only when none is real), so its
one re-run is not spent inside the floor; a waiting run keeps the pass from
writing clean.

The workflow file's copy of the Review paragraph, which said one lane per
pass, is dropped: reconcile.mjs's header is the description. New rationale
lives here rather than in new comments, under the comment lint.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A floor set carrying both stopped reviews holds three records. Placed
after another PR's floor set, it found two uploads left and was deferred
whole, so the 21:50 pass would have re-run less than it did before. When
the whole set does not fit and the set without its reviews does, the
floor re-run goes now and the reviews wait for the next pass; ci-status
then reaches attempt 3 at most, inside RECONCILER_ATTEMPT_CAP.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 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-18T23:50:03.211838Z 33f2f9c 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 33f2f9cc8a0101da1c6453611b3724bf58f85a6e: read 4 of 4 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #17313, lost-run reconciler re-runs floor-stopped ratings and stopped reviews

I found no security issues. I read all four changed files in full: the fixture, reconcile.mjs, reconcile.test.mjs and the workflow comment removal.

What I checked

  • The rater joins RECORDED_LANES (reconcile.mjs L1026-1051). This does not widen who is trusted. Every leg of pr-rate-merge-risk.yml already passes reconciler-workflow: .github/workflows/maintenance-reconcile-lost-runs.yml to check-trusted-trigger, at L209, L620 and L960. That check also requires the upstream actors and the PR author to be on the trusted-actor list. The reconciler now produces a record that the rater's existing gate already accepted. The PR changes neither the trusted-actor list nor the gate, and it adds no token scope. A re-run still passes through the rater's own Check the kill switch step and the Select the trusted PR text step.
  • The re-run guard for a finished judgment. holdReason now takes each lane's own write step. For the rater that is Write the rating, and a re-run is refused once that step started. All its return paths, L946-985, return an object, so the new held.reason !== undefined test cannot treat a hold as permission to re-run. The new test pins one write step per leg, gated on steps.rate.outcome == 'success'.
  • Kill switch. The new step that adds stopped reviews to a Floor or Switch set (L1243-1245) still goes through stoppedReviews. That function still checks each lane's REVIEW_SWITCHES environment value and gateHold() before adding an item (L1331, L1350). Re-runs are still attempt-1 only and recorded, and pr-verify's RECONCILER_ATTEMPT_CAP is unchanged.
  • Reset wait (floorReset, beforeReset, place split). These only delay or defer re-runs, and a waiting run keeps the pass from writing clean. The timestamp regex is bounded and reads annotation text written by the repository's own rate guard. Nothing here widens a merge hold.
  • Workflow file. The change only deletes a comment paragraph, which is not a standing instruction. Triggers, permissions: and steps are unchanged.
  • PR context. It contains no embedded instructions to the review lane.

Spend (not a finding): a lost attempt-1 rater run whose write never started is now re-run once, and each such re-run spends one more merge-risk rating from prepaid API credit or subscription usage.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #17313, lost-run reconciler re-runs floor-stopped ratings and stopped reviews

No blocking or advisory findings. I read all four changed files in full in .claude-lane/pr.diff: the new fixture, reconcile.mjs, reconcile.test.mjs, and the workflow file's doc removal. I also traced the changed lines into the unchanged code they call.

What I checked

  • holdReason's new return shape. A re-runnable run now gets { jobs } back where it used to get undefined. The only caller is the lane loop (reconcile.mjs#L1580), and it now branches on held.reason !== undefined. Every return path sets either reason or jobs. Carried jobs keep id through slimJob, so floorFailed can still read their annotations.
  • No duplicate stopped-review items. The new stoppedReviews() push at L1398 runs only when the set already holds a floor or switch item. The other push sits in an exclusive else if branch under set.length === 0, so one head never adds the same review twice. A floor-failed checks run that is waiting for its reset leaves the set empty. Because its failed jobs are not aggregate-only, the ci-status block still finds no status, so nothing is double-counted.
  • Rater admission. The rater uses workflow_run on PR Require Checks with conclusion == 'success' (pr-rate-merge-risk.yml:41,73), which matches LANE_TRIGGERS success. Its trigger checks name reconciler-workflow in all three legs. It is not in GATED_LANES, which is right because it runs no upstream-status gate. A pending run the concurrency group cancels is held as not started.
  • floorReset, beforeReset and place. A reset of 0 (no time named) never waits. The Verdict branch reorder keeps its old meaning. place splits off the reviews only when the floor or switch core fits and the whole set does not.

Loosened checks. Some expected values in existing tests changed:

  • the one-lane-per-pass test now expects both lanes in one pass;
  • the floor-plus-review test now expects one pass;
  • the read count rises from 2 * 2 to 3 * 2;
  • the older floor fixtures now carry a reset time that has already passed.

Each of these still asserts exact behaviour for a deliberate change of behaviour, and new tests cover the waiting-inside-the-floor case. None makes a check accept more than before, so none is a loosening.
Loosened-check verdict: fail (default; the prompt carried no loosened_check_verdict: or loosened_check_patterns: line); patterns: 0. The prompt had no loosened_check_decision_record: line, so the citation requirement was not checked.

Closing issue. The PR says it closes none ("No related issue"), so there are no acceptance criteria to check. The PR context file contains no embedded instructions.

Verification. The PR's own results (259 tests passing, mutants killed, check-affected passing) are the author's claims. I did not run them: this lane has no shell.

Spend (not a hold). An attempt-1 rater run that was lost before its rating write started is now re-run once, which uses a second merge-risk rating from prepaid API credit or subscription usage.

Verifier dropped 0 of 0 candidates.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 3406afc Nov 19, 2026
81 of 83 checks passed
@kyle-sexton
kyle-sexton deleted the fix/reconcile-floor-and-switch-noop-reruns branch November 19, 2026 00:22
@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