Skip to content

feat(pr-pipeline): re-run PR CI runs lost to a GitHub outage - #8505

Merged
kyle-sexton merged 5 commits into
mainfrom
feat/outage-reconciler
Oct 20, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
feat/outage-reconciler

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #8468

Summary

Step 1 of #8468 for PR CI: a scheduled reconciler (maintenance-reconcile-lost-runs.yml, every 30 minutes) re-runs CI runs a GitHub outage ended without a result, so nobody has to re-run them by hand.

  • Detection: for each open, non-draft PR into main from a branch of this repository, it lists the runs on the PR's current head (one REST call per PR) and takes the newest run of each workflow. A CI workflow (pr-require-checks, pr-test-windows, pr-check-managed-files-hosted) whose newest run ended cancelled, timed_out or startup_failure, on attempt 1, created in the last 24 hours, is lost.
  • Once only: the run's attempt number is the record. A run at attempt 2 or later was already re-run (by the reconciler or a person) and is never touched again; the run is re-read just before the write, so one re-run since the listing is left alone. No marker comment or artifact is needed.
  • Pacing: at most 3 PRs with a re-run in flight, counting re-runs already running; auto-merge PRs first, then oldest; writes at least 1 s apart; the first rate-limit error stops the run.
  • Incident gate: nothing is read from GitHub while githubstatus.com/api/v2/components.json shows Actions as anything but operational, or the page cannot be read.

Fix

  • .github/scripts/maintenance-reconcile-lost-runs/reconcile.mjs: the rules above, no model, using the job's own token (actions: write, pull-requests: read). That is the same authority pr-merge.yml's post-merge-dispatch job and the hourly triage sweep already use unattended. No new secret, App permission or broker activity.
  • .github/workflows/maintenance-reconcile-lost-runs.yml: schedule plus dispatch, main only, checks the lanes kill switch, pinned actions, no PR checkout.
  • scripts/outside-node-packages.txt: registers the package so CI runs its tests.

Not covered here, listed in the run summary or left as today:

  • Lost lane runs (review, verify, refine): their trigger check refuses a re-run that github-actions[bot] starts, so the reconciler lists them for a person and does not act on them. Re-firing them unattended needs new authority (an Actions-capable lanes App token, or a trusted re-run record in the trigger check), so it is an owner decision this PR leaves open.
  • Merge-group ejections: a re-run does not put a PR back in the queue. pr-merge re-enqueues its own PRs once their checks pass; a PR a person enqueued stays theirs.
  • Known gap: a contract-only pr-require-checks run (a label or edit event) that lands after a lost full run becomes the newest run on that head, so the lost full run is not re-run.

Verification

  • node --test .github/scripts/maintenance-reconcile-lost-runs/reconcile.test.mjs: 15 pass. The suite covers: a re-fired run (attempt 2) is not re-fired; a run re-run between the listing and the write is left alone; every non-operational Actions status, and an unreadable page, makes no GitHub call at all; the in-flight cap and auto-merge order; writes at least 1 s apart; the first rate-limit error stops the run; the kill switch; lane, draft, fork and stale runs left alone.
  • Nine hand mutants of reconcile.mjs (attempt check, status gate, write gap, in-flight count, fresh read, newest filter, merge order, rate-limit stop, lane exclusion): all killed.
  • actionlint and zizmor on the workflow: clean. scripts/affected-tests.sh --run: every selected suite passes (ci-test-node-stop-commands.test.sh run with PyYAML through uv). check-changelog-fragments.sh --check-required origin/main: no fragment needed (no plugin files changed).

Related

#8446 (broker 5xx / token 403 re-fire; this covers the CI half), #8447 (scheduled pr-unblock-dispatch), #8445.

Hold: a human merges this

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits October 19, 2026 15:25
A scheduled reconciler, every 30 minutes, re-runs a CI workflow whose
newest run on an open PR's current head ended cancelled, timed_out or
startup_failure on its first attempt. The attempt number is the
once-only record: attempt 2 or later is never touched again.

It reads nothing from GitHub while githubstatus.com shows Actions as
anything but operational or the page is unreadable, keeps at most 3 PRs
with a re-run in flight (auto-merge PRs first), spaces writes at least
1 s apart, and stops on the first rate-limit error. It uses the job's
own token; lost lane runs, whose trigger check refuses a
github-actions[bot] re-run, are listed in the run summary for a person.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 20, 2026 05:10
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 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-20T05:12:27.338938Z 5e5ffe6 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

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed fcb41766bba0c83922d2b32290f1a52ff8efbf06: 0 finding(s), 0 as inline comments.

Incremental security review of PR #8505 at fcb4176, covering only the two test files changed since 6f0b2f9.

The change swaps hand-built fake fetch responses for real Response objects in report-check-run.test.mjs and callers.test.mjs. Both are test-only edits. They add no production code path, trust boundary, token handling, injection surface or workflow permission change.

No security issues found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e5ffe64ec

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

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

Incremental review of fcb4176 (since 6f0b2f9): no findings.

The change swaps two hand-built fake fetch responses for real Response objects. One is fakeFetch in report-check-run.test.mjs. The other is postNotRunCheck in callers.test.mjs.

  • fakeFetch(status) in report-check-run.test.mjs is called only through run(env, status). I found no test in that file that passes a non-default status. The default 201 is a valid status for new Response(body, { status }).
  • The callers.test.mjs fake uses a fixed 201, which is also valid.
  • A non-null body with status 204, 205 or 304 would make Response throw. No test in the changed files passes one of those.
  • The code under test (report-check-run.mjs) never reads the response's ok, status or json (grep matched none), so the stricter fake cannot change any assertion.

I did not run the tests myself. The PR's stated verification is the author's claim and I did not independently confirm it.

@kyle-sexton

Copy link
Copy Markdown
Member Author

Security pass note (N1), traced at 5e5ffe6: when a github-actions[bot] re-run of pr-verify stops in check-trusted-trigger with untrusted-actor, the gate writes proceed=false and exits 0 (check-trusted-trigger.mjs :605/608, :675-686); every later step in pr-verify.yml is skipped (:101, :119, :309-312, including "Fail without a verdict"), so the check-intent job (:49) concludes success, not failure or neutral. pr-verify.yml writes no commit status itself, so the verdict status is untouched; the green job is a stop, not a verify pass.

kyle-sexton and others added 3 commits October 20, 2026 01:20
… re-running

The workflow re-run endpoint answers 201 with no body, which createGitHub
parsed as JSON and threw on after GitHub had accepted the re-run. Any success
with an empty body now returns null.

The reconciler now re-reads the PR right before each re-run and skips it when
the head moved, or the PR closed or went draft, since the listing: re-running
an obsolete run would cancel the new head's CI in the PR concurrency group.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xk7Lz7d2twxvA3LfRxnLkT
createGitHub now reads the body with response.text() so a bodiless 201
returns null. The fake fetches in callers.test.mjs and
report-check-run.test.mjs returned plain objects with only json(), so
every POST through them threw and reportCheckRun exited 1. Return a
Response, which carries both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xk7Lz7d2twxvA3LfRxnLkT
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.

pr-pipeline: recover lane and CI work lost to a GitHub outage without a person

1 participant