Skip to content

fix(pr-pipeline): let fix-ci take a job cancelled past its time limit - #10269

Merged
kyle-sexton merged 6 commits into
mainfrom
fix/stranded-cancelled-heads
Oct 26, 2026
Merged

kyle-sexton merged 6 commits into
mainfrom
fix/stranded-cancelled-heads

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Refs: #9828

Summary

A head whose CI job ran past its timeout-minutes stayed red with no lane acting on it. GitHub ends such a job cancelled. Only the job's check-run annotation says it hit the time limit. #9828's head c1184e03 shows this: pr-require-checks run 40118648493 ended cancelled on both attempts, because test-bash (3) passed its 9-minute limit each time. The reconciler re-runs a lost run at attempt 1 only. fix-ci-context fixes only failure, timed_out and startup_failure checks. So once attempt 2 ended, no lane would act on the head.

A timeout that repeats usually means a test is slow or hangs, so a code fix is the right response, not another blind re-run. This PR hands such a head to fix-ci, and the model's context carries the time-limit note.

Fix

  • infra-failure.mjs: timeLimitNoted reads GitHub's failure annotation "The job has exceeded the maximum execution time of ..." and matches it only at the start of the message. reconcilerOwns now makes fix-ci wait for the reconciler's one re-run of a lost first attempt, as it already does for an infra-only failure.
  • fix-ci-context.mjs: a cancelled check with that note counts as failing, and the note is passed into the context. A cancel without the note, such as a fail-fast matrix sibling, still has nothing to fix.
  • fix-ci-dispatch.mjs and dispatch.mjs: when the tested run ended cancelled and nothing else is fixable, the dispatcher reads each cancelled lane check's annotations. It takes the check id from the rollup's databaseId and reads through the new listAnnotations. A head with a time-limited check is dispatched, and the log names that check. Any other cancel keeps the existing skip.
  • reconcile.mjs: each CI run that is lost again after its one re-run is named in the summary, along with who takes it.

fix-ci's existing caps still end the retries: the per-head run cap, loop.fix-ci-rounds, then a ci-fix-round-cap or ci-fix-escalated escalation, which adds the human-gated label and posts a comment (report-escalation.sh). That comment states the reason class, not the check name. The cause appears on the PR as the red test-bash (3) check and its time-limit annotation.

Not closed here: a run cancelled at attempt 2 or later with no time-limit note, such as a person's cancel, still produces no PR-visible signal. The only traces are the reconciler's summary line and the dispatcher's skip fix-ci log line. A PR-visible signal for that case is an open design choice: a monitor detector, the reconciler failing its run on such a head, or accepting the pr-merge "held over 24h" signal.

Verification

New tests use #9828's recorded fields: the run at attempt 2 ended cancelled; check run 120950643531's two annotations are in fixtures/annotations-120950643531.json; ci-status failed. Each new test failed before the change.

  • infra-failure.test.mjs: 21 pass
  • reconcile.test.mjs: 76 pass
  • fix-ci-context.test.mjs: 29 pass
  • fix-ci-dispatch.test.mjs: 52 pass
  • Every suite under maintenance-reconcile-lost-runs/, pr-unblock/ and actions/resolve-config/, plus rate-guard.test.mjs: 1630 pass, 0 fail

Related

🤖 Generated with Claude Code

kyle-sexton and others added 6 commits October 25, 2026 23:37
…lled

fix-ci-context fixes only failure, timed_out and startup_failure checks,
so a head whose pr-require-checks run ended cancelled with none of those
got up to three Skipped: not-applicable runs before the per-head cap
stopped it (#9828's shape, cause "tested run completed/cancelled"). The
dispatcher now skips such a head and logs the run and attempt; a
cancelled run with a fixable check is still dispatched.

The #9828 loop itself (47 runs on one head) predates #10046, which moved
the per-head count from the newest-only GraphQL rollup to REST.

Refs: #9828

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GitHub ends a job that runs past its timeout-minutes with conclusion
cancelled, and only its check run's annotation ("The job has exceeded
the maximum execution time of 9m0s") says why. fix-ci-context counted
only failure, timed_out and startup_failure as failing, and the
reconciler re-runs a lost run at attempt 1 only, so #9828's head
c1184e0, whose test-bash (3) timed out on both attempts of run
40118648493, stayed red with no lane acting on it.

- infra-failure.mjs: timeLimitNoted reads GitHub's failure annotation,
  anchored at the start of the message; reconcilerOwns makes fix-ci wait
  for the reconciler's one re-run of a lost first attempt, as it does
  for an infra-only failure.
- fix-ci-context.mjs: a cancelled check with that note counts as failing,
  and the note reaches the model's context; other cancels stay out.
- fix-ci-dispatch.mjs: when the tested run ended cancelled and nothing
  else is fixable, the dispatcher reads the cancelled checks' annotations
  (rollup databaseId, dispatch.mjs listAnnotations) and dispatches a
  time-limited head, logging the check; any other cancel keeps the skip.
- reconcile.mjs: a CI run lost again after its one re-run is named in the
  summary with who takes it.

fix-ci's existing caps (per-head runs, loop.fix-ci-rounds, then
ci-fix-round-cap or report-escalation) end the retries. Based on
b6efed7 (fix/fix-ci-dispatch-cap), whose cancelled skip this narrows.

Refs: #9828

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ecks

A cancelled tested run's failed job that a later contract-only run skipped
shows only as SKIPPED in the rollup, so the cancelled-skip predicate held
fix-ci off for good. The dispatcher now reads the head's check runs as
fix-ci-context does and applies its exported failingChecks, so the two
cannot disagree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve onto the shared rule: the dispatcher judges a cancelled tested run
by fix-ci-context's exported failingChecks over the head's REST check runs,
and reads annotations by REST id only when every failing check is
cancelled, so a time-limited cancel still dispatches and a skipped-over
failure is no longer hidden. The rollup no longer queries databaseId.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d-heads

# Conflicts:
#	.github/scripts/pr-unblock/fix-ci-context.mjs
#	.github/scripts/pr-unblock/fix-ci-dispatch.mjs
#	.github/scripts/pr-unblock/fix-ci-dispatch.test.mjs
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T12:22:15.603860Z 1784c6e PR opened
ℹ️ 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 1784c6ed29058479b07f5506675e1e2ece9fb55f: 0 finding(s), 0 as inline comments.

No security issues found in this pull request. critical-findings: 0

I read the whole diff (11 files) and the PR context. The change lets fix-ci pick up a CI job that GitHub cancelled for passing its timeout-minutes. It detects that job from the check run's annotation and has the lost-run reconciler name a CI run lost twice in its run summary.

  • Trusted paths: no changed file matches a TRUSTED PATHS glob. I also checked whether the changed pr-unblock/ modules (fix-ci-context.mjs, fix-ci-dispatch.mjs, dispatch.mjs) are imported by the merge-hold scripts or pr-require-checks.yml. They are not, so this is not a change to a merge hold.
  • Manifests, instruction surfaces, workflows and pr-pipeline.yaml: none changed.
  • Spoofable annotation: timeLimitNoted matches annotation text that a PR's own step can emit, for example ::error::The job has exceeded the maximum execution time of …. The match is anchored to the start of the message and requires failure level. Spoofing it only makes fix-ci run on a head the author could already make fail with an ordinary failing test. The check runs and annotations belong to the PR's own head, so it gives no new authority. The annotation text reaches the model context as it already does for failing checks, via annotationOf and MAX_ANNOTATIONS.
  • New API call: listAnnotations validates the check run id (Number.isSafeInteger, at least 1) before building the URL, and the ids come from the GitHub API, so there is no path injection.
  • Dispatch gate: skipReason still skips when only non-time-limited cancels remain. The caps are unchanged (per-head run cap, loop.fix-ci-rounds, escalation). A rate-limited or failed annotation read dispatches nothing and is retried later, so the new read fails closed.
  • Reconciler: the new again bucket only logs to the summary. It re-runs nothing and widens nothing. The summary line interpolates only run id, workflow path, conclusion and attempt number, which come from the API.

Spend: a time-limited CI job can now trigger fix-ci model runs, which draw on prepaid credit or subscription usage and stay inside the existing per-head and round caps. That is not a hold and not a finding.

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 1784c6ed29058479b07f5506675e1e2ece9fb55f: 0 finding(s), 0 as inline comments.

No blocking or advisory findings. I read the whole diff and the PR context. I did not run the tests; the pass counts in the PR description are the author's claims and unverified.

What I checked

  • timeLimitNoted (infra-failure.mjs): it matches only a failure-level annotation whose message starts with GitHub's time-limit text. A step can emit that text itself, as the code comment says. That only gets fix-ci a look at a head the author's own code already made red, so it adds no new authority.
  • failingChecks (fix-ci-context.mjs): it now also returns cancelled checks, and it is called from two places. select drops any cancelled check without the time-limit note, so a fail-fast sibling still yields not-applicable. The dispatcher's skip test, headFailing.every(cancelled) && no timeLimited, matches select's outcome. An empty list still skips, as before.
  • The dispatcher reads annotations only when the tested run ended cancelled and only cancelled checks are failing. Rate-limit errors skip the head and a later run retries it. Any other error counts as failed and the head is left for a later run. A failed listCommitCheckRuns read still dispatches under fix-ci's caps, as before.
  • reconcilerOwns: the new wait for a lost attempt 1 ends at RERUN_DUE_MINUTES and is bounded by the lookback window. A missing or unreadable run makes due NaN, so it returns "" before run.status is read.
  • reconcile.mjs: LOST is now imported from infra-failure.mjs and re-exported. The existing LANE_LOST use and other importers keep working. The new again list only logs a summary line and never re-runs anything, so the one re-run per head still holds.
  • dispatch.mjs listAnnotations: it checks the id and returns the parsed array. That is the shape timeLimitNoted expects, and it matches address-feedback.mjs, which returns .data from its own wrapper.
  • Tests: the new tests cover the time-limited, cancel-only, and unreadable-annotation cases, plus the attempt 1 and attempt 2 boundary. The fixture matches the recorded feat(planning): open each interview round with a pinned restate card #9828 check run.
  • Change fragment: bump: patch fits a bug fix, and the fragment describes the shipped behavior.

Trusted paths: none of the changed files match a trusted-path glob.

Closing issues: the PR says Refs: #9828 and closes none, so there are no acceptance criteria to check.

Observations (not counted as findings)

  • The comment at fix-ci-dispatch.mjs:315 still names node.headCheckRuns, which this PR renames to node.headFailing.
  • The PR description says the dispatcher takes the check id from the rollup's databaseId. The code takes it from the REST listCommitCheckRuns rows instead.
  • The PR says it builds on fix/fix-ci-dispatch-cap and that branch must merge first. Check that ordering before merging.

Spend: this change adds a few REST annotation reads per stranded head and may dispatch extra fix-ci runs, capped by the existing per-head and round limits. That draws on prepaid API credits only, so it is not a hold.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit ad2eec8 Oct 26, 2026
38 checks passed
@kyle-sexton
kyle-sexton deleted the fix/stranded-cancelled-heads branch October 26, 2026 14:07
kyle-sexton added a commit that referenced this pull request Oct 26, 2026
Main's failingChecks now counts a cancelled check as failing (#10269);
merged into gate-source.mjs it also reaches clear-escalations, where a
cancelled lane keeps ci-status red once the label is off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
kyle-sexton added a commit that referenced this pull request Oct 26, 2026
…fter-kill-switch

reconcile.mjs takes both import sets: the PR's AGGREGATE_JOBS and FAILED
for the switch kind, and main's LOST for #10269's lost-again summary.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant