Skip to content

fix(pr-pipeline): re-run merge-risk runs the lanes kill switch stopped - #17315

Merged
kyle-sexton merged 7 commits into
mainfrom
fix/reconcile-switch-stopped-ratings
Nov 19, 2026
Merged

kyle-sexton merged 7 commits into
mainfrom
fix/reconcile-switch-stopped-ratings

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Refs: #17313

Summary

Follow-up to #17313, based on its branch. A merge-risk run the lanes kill switch stopped now gets re-run once, on the reconciler's first pass after the switch lifts. Before this, the run ended green with no rating (pr-rate-merge-risk.yml:110-111), and its PR stayed Merge-Risk: unrated.

Fix

  • pr-rate-merge-risk.yml joins FAULT_HELD_LANES. Its succeeded first attempts are listed and read the same way a held pr-verify run is:
    • from FAULT_HELD_HOURS back, or from the carried held_since;
    • only runs that follow an open head's newest checks run;
    • inside the shared cap of FAULT_HELD_READS per pass.
  • A run counts as stopped when every leg that ran shows Check the kill switch run and Resolve the pull request skipped. The rater's check-kill-switch call passes no budget, so only the switch skips the resolver. A stopped run is re-run whole, recorded as reconcile-rerun-<id>-2-<main tip>, at attempt 1 only.
  • Any other succeeded rater run is settled, so its jobs are read once.
  • The reconciler reads nothing while the switch is on (main's KILL_SWITCH stop), so the re-run comes on the first pass after the switch lifts.
  • MAX_IN_FLIGHT and the record-upload cap are unchanged.

Cost: up to three more read calls per pass (one held-run listing, plus job reads for new succeeded rater runs, each read once and then carried as settled).

Verification

  • node --test .github/scripts/maintenance-reconcile-lost-runs/*.test.mjs: 263 pass, 0 fail.
  • The new tests run on recorded runs (fixtures/runs-switch-stopped-rater-2026-11-18.json):
  • Mutants each fail at least one new test: never held, resolver ignored, rater not listed.
  • scripts/check-affected.sh: 13 passed, 6 skipped.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 3 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]>
A rater run the lanes kill switch stopped succeeds with no rating (its
report-only stop), so the lost-run listing never sees it and the PR stays
"Merge-Risk: unrated". The rater joins FAULT_HELD_LANES: its succeeded
first attempts are listed and read like a held pr-verify run, inside the
same FAULT_HELD_READS cap and followsNoOpenHead filter, and one whose
every leg that ran shows the kill-switch step run and the resolver skipped
is re-run once, whole, recorded. Any other succeeded rater run is settled,
so its jobs are read once. The reconciler reads nothing while the switch
is on, so the re-run comes on the first pass after it lifts; attempt 2 is
never taken again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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-19T01:05:59.099653Z 9bb6a25 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.

Resolved reconcile.test.mjs: kept this branch's RATER_RESOLVE_STEP and
RATER_SWITCH_STEP imports, its third held-run listing (pr-rate-merge-risk)
in the read count, and its switch-stopped rater tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/resolve-conflicts
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none (read lane)
Run 44434458042

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-conflict-patch
Model rung 0
Leg base
Run job success
Activity step skipped
Commits pushed none recorded
Run 44434458042

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review needs no new review of c9f002568e4954dfc87dee0ccfb8c82a8e2c08d3: no file of this pull request changed since the review of 0deb08f.

Security review: PR #17315

I found no security issues. I read every hunk of all 3 changed files. This lane already reviewed an earlier head, so this review was blocking only: it would report only CRITICAL and IMPORTANT findings, and none came up.

What changed since the last review. The reconciler used to require that every leg showed the switch stopped it. It now decides on the last leg that ran, taking the legs in key → subscription → fallback order (RATER_LEGS, reconcile.mjs#L1107-L1120). A run counts as stopped when that last leg shows Check the kill switch succeeded and Resolve the pull request skipped. If a job that ran has a name outside RATER_LEGS, the run is not called stopped. This change fixes the settled thread on the between-legs switch window, as the thread suggested. A new test pins the three leg names to the workflow.

Trust-boundary checks

  • Which runs can be picked. Only runs that pass isFaultHeld (reconcile.mjs#L680-L688) can be re-run. It requires:

    • event === "workflow_run"
    • head_branch === "main"
    • a valid SHA
    • conclusion === "success"
    • run_attempt === 1

    A re-run therefore executes main's own rater workflow. No fork code and no new actor reaches the rater's credentials.

  • Kill switch. The change cannot revive a paused lane:

    • The reconciler still stops before any read while KILL_SWITCH is on, and a test checks this.
    • The re-run rater checks its own kill switch again, and that check still gates its resolver in all three legs (pinned by a test).
  • Gates the re-run still passes. The rater's Check the trigger and Select the trusted PR text steps are unchanged and still run on the re-run.

  • Untouched. No token scope, trusted-actor list, merge hold, permissions: block or plugin manifest is touched.

Settled thread. The between-legs window thread is resolved, and its fix is the change described above. I am not raising it again.

Spend. Each stopped rater run is re-run once after the switch lifts. That spends prepaid model credit for one rating, plus a few extra GitHub API reads per pass. Neither can start a real charge.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-review: 1 inline finding(s) on 474d64f1ff9e121c4840b65a58ecb76f664352c3; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

claude-review needs no new review of c9f002568e4954dfc87dee0ccfb8c82a8e2c08d3: no file of this pull request changed since the review of 0deb08f.

Code review: re-run merge-risk runs the lanes kill switch stopped

No blocking findings at 0deb08f9. This lane already reviewed an earlier head, so this review reported blocking findings only.

The PR adds pr-rate-merge-risk.yml to FAULT_HELD_LANES. It also adds a rater-only branch to faultHeld that reads each first attempt that ended green:

  • Stopped run: the last leg that ran (key, subscription, fallback order) shows Check the kill switch success and Resolve the pull request skipped. The run is held and re-run once, with a reconcile-rerun-<id>-2-<head> record.
  • Any other green run: it is settled, so its jobs are read once.

Earlier finding is fixed. My earlier comment was about a switch turned on between legs leaving a run unrated and then settled. That thread is resolved, and the fix is in the head code (reconcile.mjs#L1107-L1120):

  • last is now the furthest leg in RATER_LEGS among the jobs that ran.
  • A job that ran under a name not in RATER_LEGS makes the run not stopped.
  • With no job run, Math.max() gives -Infinity, the index is -1, so last is undefined and the run is not stopped.

A new test covers the handoff case, and the workflow pin test now asserts that the three job names equal RATER_LEGS.

What I checked in the code:

  • Definitions exist. RATER is defined at line 370, before FAULT_HELD_LANES uses it at line 403. key, wholeListing, stepsKnown and slimJob are all in scope inside faultHeld.
  • Held path. A held run's carried entry has held: true, so a later pass hits the carry short-cut and makes no second read. The plan loop over FAULT_HELD_LANES gets a map for RATER because it is already in RECORDED_LANES. The fault-held item keeps its record, and isFaultHeld still limits re-runs to attempt 1.
  • Test count. The read count moving from + 2 to + 3 matches the one new held-run listing. It is not a loosening.

I did not run the tests myself. The author's results (263 pass, the mutants, check-affected.sh) are claimed and unverified.

Spend: no cost hold. Each reconciler pass makes up to three more GitHub API reads. Each recovered run costs one more rater run, paid from prepaid API credits or subscription usage.

Other checks:

  • Closing issue: the PR says Refs: #17313 and closes no issue, so there are no acceptance criteria to check.
  • Rules: I found no .claude/rules/ rule or paved-path entry that applies.
  • PR text: the PR context, settled-threads and prior-findings files hold no embedded instructions.
  • Security: left to the separate security lane.

Loosened-check verdict: fail. This is the default, because the prompt had no loosened_check_verdict: or loosened_check_patterns: line, so no consumer entries apply. No loosening found. The prompt had no loosened_check_decision_record: line, so the citation requirement was not checked.

Verifier dropped 0 of 0 candidates.

kyle-sexton and others added 3 commits November 18, 2026 22:18
A switch set between legs stopped the subscription or fallback leg after
the key leg's resolver had run and handed off, so the every-leg test read
the run as rated and settled it unrated. The run now counts as stopped
when the last leg that ran (key, subscription, fallback order) shows the
switch step passed and the resolver skipped; an earlier leg hands off only
when it did not rate. A test pins the leg names to the workflow's jobs.

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 a6da31c Nov 19, 2026
45 checks passed
@kyle-sexton
kyle-sexton deleted the fix/reconcile-switch-stopped-ratings branch November 19, 2026 04:47
@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