Skip to content

fix(ci): carry a fault-held run's hold so each pass stops re-reading it - #17023

Merged
kyle-sexton merged 1 commit into
mainfrom
perf/reconcile-carry-fault-held
Nov 18, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
perf/reconcile-carry-fault-held

Conversation

@kyle-sexton

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

Copy link
Copy Markdown
Member

Refs: #16642

Summary

The lost-runs reconciler re-read every fault-held run's attempt-1 jobs and the held job's check-run annotations on every pass. A held run stays listed until its re-run takes one of the 3 re-run places, so a standing backlog of about 14 runs was read again pass after pass (2 calls each). Measured on the 11-17 brake hours: 13-16 annotation reads per pass, and 23-25 "deferred, all 3 re-run places taken" lines per pass. Expected saving: about 40-55 GITHUB_TOKEN REST calls per hour while a backlog stands.

Fix

faultHeld in .github/scripts/maintenance-reconcile-lost-runs/reconcile.mjs now uses the carry holdReason already uses for its attempt-1 reads:

  • A hold found on a whole listing whose every job's steps listed goes into the carried job reads (keepJobs, key <run id>:1), with the slim jobs and held: true.
  • On the next pass, a carried entry with held: true and the same head and updated_at returns the hold without any read. A changed updated_at reads again.
  • parseSettled accepts the optional held: true field. SETTLED_VERSION is unchanged, since the rules that settle a run did not change and an old carry still parses.

No behavior change: a carried run still counts against FAULT_HELD_READS, still moves heldSince, still waits on gateHold, and still goes through the same re-run choice (places, MAX_IN_FLIGHT, RECONCILER_ATTEMPT_CAP, kill switches). Only a hold from a whole, step-complete listing is carried, so a cut listing that might later show a verdict write is read again as before.

Verification

  • New test: a second pass over the same held run, given the first pass's carry, makes no /actions/runs/301/attempts/1/jobs or /check-runs/7001/annotations read, re-runs the same run with the same records, and carries the hold on. The first pass is asserted to make both reads.
  • New test: the same run with a changed updated_at is read again (both calls) and still re-run.
  • Each new test fails with its guard removed (hit branch disabled; updated_at comparison dropped), and passes with it in place.
  • node --test over the folder's four test files: 241 pass, 0 fail.
  • Pre-commit and pre-push hooks pass.

Remaining

What is still open on #16642 after this PR:

Related

🤖 Generated with Claude Code

faultHeld read a held run's attempt-1 jobs and the held job's
annotations on every reconcile pass, and a held run stays listed until
its re-run takes one of the places, so a standing backlog was re-read
pass after pass. A hold found on a whole listing whose every job's
steps listed now goes into the carried job reads, marked held, and is
read from the carry while the run shows the same head and updated_at,
as holdReason already does for its attempt-1 reads.

Verdicts, re-run choices and gates are unchanged: a carried run still
counts against FAULT_HELD_READS, still moves heldSince and still waits
on gateHold.

Refs: #16642

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 18, 2026 03:46
@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-18T03:48:50.010110Z 7b40fb0 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 7b40fb00b8c2197d2b4403941357807237c1091b: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review: no security issues found.

I read both changed files in full: .github/scripts/maintenance-reconcile-lost-runs/reconcile.mjs and its test file. Neither matches a trusted-path glob. The only trusted path in that folder is infra-failure.mjs, and this PR doesn't change it. No trust control, kill switch, token request, merge hold, plugin manifest or instruction file is changed.

What I checked:

  • Where the carried hold comes from. The new held: true entry is read from the settled-runs artifact. readSettled only takes that artifact from newestTrustedArtifact, scoped to the reconciler's own workflow (reconcile.mjs#L474-L483). parseSettled checks the field's shape: held must be missing or exactly true (L429). No pull request, fork or comment author can write that artifact, so nobody outside can supply a carried hold.
  • Whether skipping the read loses a safety check. A carried hold applies only when the run's head SHA and updated_at both still match (L926). A hold is saved only after the written check has already ruled out a started verdict write, and only from a complete listing where every job's steps are listed (L935-L942). A completed attempt-1 listing can't later show a verdict write. A re-run or any other change to the run updates updated_at, which forces a fresh read. So skipping the read can't lead to a second judgment of the same head.
  • Re-run path still gated. Carried holds still go through the FAULT_HELD_READS cap, gateHold and the existing re-run selection (L1558-L1579). No new run can be re-run and no new permission is used.

Spend: the change lowers GITHUB_TOKEN REST calls (no attempt-1 jobs or annotations read for a carried hold). There's no billing impact.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings

This PR makes the lost-runs reconciler keep (carry) a fault-held run's hold from one pass to the next. It uses the same <run id>:1 job-read carry that holdReason already uses, so later passes don't re-read the run's jobs or annotations.

What I checked

  • Hit condition. faultHeld uses a carried entry only when it has held === true and its head and updated_at match the run (reconcile.mjs#L926).
    • The listed runs already pass isFaultHeld, which requires run_attempt === 1, status completed and conclusion success (L559-L567).
    • A re-run at attempt 2 changes updated_at and drops out of the listing, so a stale hold can't be reused.
  • Key shared with holdReason. holdReason reads the same key, but only for failed lane runs. A run's attempt-1 conclusion is fixed, so a success entry and a failure entry can't both exist for one run. An old reconciler reading the new carry ignores the extra held field, so keeping SETTLED_VERSION unchanged is safe.
  • No write-started case is carried. The written early return runs before anything is stored. The hold is stored only from a whole listing where every job's steps were listed, which is the same rule holdReason follows, so a cut listing is still read again.
  • Behavior around the cache. The read cap (FAULT_HELD_READS), the move of heldSince, the gateHold wait and the choice of where to re-run all run the same way after a cache hit.
  • Size of the carry. keepJobs holds only entries touched in the current pass, so the carry can't grow without limit.
  • Tests.
    • The new tests check both the reads skipped on a hit and the re-read after updated_at changes.
    • The heldRun helper's opts pass updated through to verifyRun (reconcile.test.mjs#L778).
    • The PR's test results (241 pass) and its guard-removal checks are claimed by the author. I could not run them here.

Other checks

Loosened-check verdict: fail (default; the prompt gave no loosened_check_verdict: line, so no resolved setting); patterns: 0. No loosening: carriedJobsEntry now rejects more input, not less.

Verifier dropped 0 of 0 candidates.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The pr-verify verifier failed head 7b40fb00b8c2197d2b4403941357807237c1091b. What it wrote, as data:

What it wrote (21 lines)
Summary: Issue #16642 is linked with `Refs:`, so this PR only has to deliver part of it. The part it
  delivers is within the issue's scope: it lowers the GITHUB_TOKEN's hourly spend, which is
  done-when item 2. The change is in
  `.github/scripts/maintenance-reconcile-lost-runs/reconcile.mjs`. `faultHeld` now carries a hold it
  found on a complete listing, with every job's steps listed, to the next pass, stored as `held:
  true` in keepJobs. The next pass reuses that hold without any reads only if the run's head and
  `updated_at` are unchanged; otherwise it reads again. `carriedJobsEntry` accepts the optional
  `held` field, so an older carry still parses. The code looks correct. A run that is not held, or
  whose listing was incomplete, is read as before, and the order of re-runs is unchanged. Two new
  tests cover the reuse and the re-read after a change, and the Test Node job passed on the judged
  head
  (https://github.com/melodic-software/claude-code-plugins/actions/runs/44232790540/job/134561814217).
  The capture is not applicable. Nothing in the change touches the takeover set, secrets or the
  owner's holds. The one blocking defect is the PR body: a `Refs:` PR must say what part of the
  issue is left for later, and this body does not.
- PR body: the PR is linked to #16642 with `Refs:` but never says what part of the issue is left for
  later. Add a short 'Remaining' section that names the open work, for example: done-when item 2 is
  still not met (hourly spend is still above the floor, and steps that hit the floor still fail
  instead of waiting or being re-run), and item 3 (review lanes and Mark Lanes should run without a
  manual re-run while the token is at its floor) is still open. Also name any other spend fixes
  still in progress, such as the pr-verify Check Intent Fallback read carry.

This pull request leaves the merge queue, and ci-status holds it out while it carries pr-verify-failed. A pr-verify pass removes the label, at a new commit or at this same head: once a trusted person edits the body, and only trusted people have edited it since the fail, this head is judged again, so a fail on the body or the issues it links needs only the body fixed, no new commit.

@github-actions github-actions Bot added the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Nov 18, 2026
@github-actions github-actions Bot removed the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Nov 18, 2026
Merged via the queue into main with commit 2f46669 Nov 18, 2026
90 of 91 checks passed
@kyle-sexton
kyle-sexton deleted the perf/reconcile-carry-fault-held branch November 18, 2026 04:05
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 18, 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