Skip to content

fix(pr-pipeline): read a job with missing steps as unknown in the post-merge and refire checks - #9812

Merged
kyle-sexton merged 4 commits into
mainfrom
fix/empty-job-steps
Oct 24, 2026
Merged

kyle-sexton merged 4 commits into
mainfrom
fix/empty-job-steps

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: GitHub jobs API returning empty step lists since 2026-10-24 16:44Z

Summary

The Actions jobs API (GET /repos/{o}/{r}/actions/runs/{id}/jobs) has been answering completed jobs with steps: [] or a cut list. In run 40113930671, kill-switch shows 0 steps and claude-review-key shows 3 of its usual 19 to 21. Three readers decided things from job.steps and misjudged a failed job whose failed step was missing. This PR treats a failed job that lists no failed step as having unknown steps, and fails closed.

Fix

  • babysit_postmerge.failing_checks: a failed job that lists no failed step now counts as a check of its own. Before, a job with gates and empty steps counted only through its gates, and an all-branches gate (gitleaks failed) was dropped, so a real red check could disappear. When the step list shows only the hygiene aggregator as failed, it still excuses as before.
  • babysit_postmerge.failing_suites: unchanged; it still returns None for such a job, and a new test pins that. A fallback that reads the job log was rejected. With no step name there is no suite kind, and a log cannot show that the suite step was the only step that failed. A fallback would excuse a leg that today demotes.
  • refire-refused.mjs refusedFile: when a failed job's step list lacks Request the lane token entirely, it now reads that job's annotations and applies the existing refusal match. A job that lists the token step as passed is still skipped. The read is bounded as before: failed jobs only, one annotation page per job, inside the existing jobs page.
  • red-main.mjs failingChecks (dry-run only): the same rule as the Python reader.

Verification

  • New tests for each reader cover a failed job with empty steps, a cut list missing the failed step, and the full list. The empty and cut cases failed before the fix (Python: [] != ['schedule']; red-main: [] vs ['lint-repo']; refire: 0 pushes, expected 1). failing_suites is a pin that passes before and after.
  • pytest -q plugins/source-control/skills/babysit-prs/scripts/tests: 2879 passed. node --test .github/scripts/pr-merge/*.test.mjs: 326 passed. node --test .github/scripts/post-merge-demotion-alert/*.test.mjs: 55 passed. scripts/run-ruff.sh format|check: clean.
  • scripts/check-affected.sh --tests: 13 passed, 1 skipped (shellcheck, no changed shell) over 9 changed files.
  • Left out: no live run against the jobs API; the fixtures are shaped like its answer.

Related

  • Out of scope: .github/scripts/maintenance-reconcile-lost-runs/** and maintenance-audit-lane-runs/collect.mjs, which reads job.steps for reporting only.

🤖 Generated with Claude Code

kyle-sexton and others added 4 commits October 24, 2026 13:19
…t-merge and refire checks

The jobs API can answer a completed job with an empty or cut step list.
A failed job that lists no failed step now counts as a whole check in
babysit_postmerge.failing_checks and red-main failingChecks, so a
gitleaks-only gate no longer hides it. refire-refused reads a failed
job's annotations when the token step is missing from its list.
failing_suites keeps returning None for such a job; a test pins that.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ad only write-runner jobs on refire

A job counted whole only because its steps were unknown no longer
excuses a later failure as a baseline entry. refire-refused reads
annotations only from a pr-unblock write-runner job (`<caller> / run`),
never from a read-runner job that runs the model over PR content.
Adds the review's regression and mutant-killing cases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…main's rule

The alert step's shell and jq copy of the failing-checks rule dropped a
failed job whose steps were listed empty or cut short. It now calls
failing-checks.mjs, which applies red-main.mjs failingChecks with the
alert's job conclusions. A judged run counts an unknown-steps job whole;
the baseline leaves it out, as babysit_postmerge.py's _baseline does.

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

chatgpt-codex-connector Bot commented Oct 24, 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-24T18:12:10.229932Z 0c6a4d2 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 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-security-review: 1 inline finding(s) on 0c6a4d23768d4a507eac7dc216c8feb4a09638ee; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions

Copy link
Copy Markdown
Contributor

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

Security review of PR #9812 at 0c6a4d2. I read the full diff, the PR context, refire-refused.mjs, and the write-runner steps in pr-run-activity-write.yml.

There is 1 finding (SUGGESTION), on the loosened refire gate. It is inline on .github/scripts/pr-merge/refire-refused.mjs.

critical-findings: 0

No changed file matches a trusted path (trusted-actors, check-trusted-trigger, CODEOWNERS, .gitmodules). No plugin manifest changed, so there are no manifest <field> lines. No hold applies.

Checked and clean

  • failing-checks.mjs takes the run id and attempt through strict regexes, and checks GITHUB_REPOSITORY against an owner/repo pattern. It calls gh with execFileSync and an argument array, so no shell is involved. A failed read exits non-zero and fails the step.
  • The workflow calls node .base/..., which is main's checkout. The script is not taken from the PR head.
  • The red-main.mjs and babysit_postmerge.py changes make the checks stricter. A failed job with no failed step is now charged whole, and as a baseline it excuses nothing. That is fail-closed for the demotion alert and the post-merge check, and I found no weakening.

Cost: this PR spends nothing billable.

@github-actions

Copy link
Copy Markdown
Contributor

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

No blocking or advisory findings on head 0c6a4d2.

I read the full diff (.claude-lane/pr.diff) and the PR context. I also read the surrounding babysit_postmerge.py (failing_checks, baseline), the alert step in post-merge-demotion-alert.yml, and the .claude/rules/* frontmatter. I ran no tests or tools myself. The test counts in the PR body are author-claimed and unverified.

What I checked

  • Python and JS agree. babysit_postmerge.failing_checks and red-main.mjs failingChecks implement the same rule:
    • A failed job with gates but no failed step is charged whole.
    • A full list showing only the hygiene aggregator still excuses the job.
    • As a baseline entry, a job counted only for unknown steps excuses nothing (unknown_checks in Python, baseline in JS).
    • The ci-status skip and the "no failed jobs" check are unchanged from the old shell.
  • Alert step. The new failing_checks() wrapper in the alert step runs node from .base, which is main's checkout. That matches the judge, which also runs from .base. The --baseline flag is passed only for the baseline attempt.
  • Refire. refire-refused.mjs now reads annotations only for a failed <caller> / run write-runner job whose step list has no token step, or whose token step failed. The test derives the caller list from pr-unblock.yml, so a new write caller that is missing from writeCallers fails the test.
  • Closing issue. None; the PR states "No related issue", so there are no acceptance criteria to check.
  • Path-scoped rules. The only rule matching a changed file is ruff-pin.md (**/*.py). Nothing in the diff breaks it. The armed_pull reformat in test_babysit_postmerge.py is a no-op for behaviour.
  • Manifests and docs. The diff changes no plugin manifests, so there are no manifest <field> lines. Both changelog fragments are bump: patch, which fits a fix. I found no doc references to the removed shell failing_checks.
  • Trusted paths. No changed file matches the trusted-path globs.
  • Cost. No new model call, schedule, or trigger, and no cost-bearing change, so I set no hold.

Observation, not counted: when a write-runner job's step list is cut short, the refire path now trusts that job's annotations without the token-step name check. That is the intended trade-off. It is limited to <caller> / run jobs of the write runner and to failed jobs. The existing refusal match, actor check, and trusted-trigger check still apply.

Left undone: I did no live check against the jobs API. The PR states it did none either.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit 9b356a7 Oct 24, 2026
66 checks passed
@kyle-sexton
kyle-sexton deleted the fix/empty-job-steps branch October 24, 2026 18:31
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