Repository navigation
fix(reconcile): re-run stopped reviews only when ci-status failed on review stops alone - #18763
Conversation
…review stops alone The full pass re-ran a head's stopped reviews when any one ci-status failure annotation was a review stop or rate hold, so a head whose ci-status also failed on an unrelated real failure got a wasted re-run. It now uses onlyReviewStopsNoted(), the follow-up tick's predicate, moved into reconcile.mjs beside the notes it reads and imported statically by followup.mjs. Refs: #17460 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d floor notes The strict check sent a head whose ci-status notes paired a review stop with a kill-switch or rate-limit floor note to the switch or floor branch, so a PR outside the lanes App got no re-run at all. The full pass now allows any gate note beside the review stop (reviewStopsAmidGateNotes) and still excludes a job or upstream failure. The follow-up tick keeps onlyReviewStopsNoted: on main it hands such a head to the full pass, which counts the re-run places. Refs: #17460 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r companions to their call The full pass's gate-note rule rejected ci-status's pending and missing review-lane notes, so a deferred lane beside a lane still running, or with no run yet, no longer re-ran as it did on main. Both are gate notes now. floorNoted's /^could not / companion let any local failure pass beside a floor note, such as the missing pr-pipeline.yaml error. For this decision a "could not" error counts only when the pull request number or commit it names is a path or query target of a floor note's call. The tests build their notes from the producers: switchHold's text and ci-status's echo lines with the current check names, with no consumer match constant in the fixture text. A direct predicate test pins that a switch, floor, pending or missing note alone is not a review stop. Refs: #17460 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 51059d1feb
ℹ️ 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".
|
claude-review reviewed Code review (incremental, blocking only): no blocking findingsThis review covers only the push since What changed. How I checked it.
Other checks.
Verifier dropped 0 of 0 candidates. |
|
claude-security-review reviewed Security review: PR #18763 (incremental, blocking only)I found no security issues in this push. Scope. This review covers only the change since
What changed. Two things changed in how a
What I checked.
Spend: whether a stopped review re-runs draws only on prepaid API and Actions usage. This is not a hold. critical-findings: 0 |
A stopped review beside a floor-held read of the other lane's jobs writes read_api's "could not read the jobs of run N; re-run this run." next to a floor note naming /actions/runs/N/jobs. The tie read only #N and commit SHAs, so it rejected that companion, and nothing re-ran the head. Each id a ci-status read_api description names now maps to its call's path: #N to pulls/N or issues/N, run N to actions/runs/N, job N to check-runs/N or actions/jobs/N, and a SHA to a /SHA or =SHA target. Every read_api companion shape in ci-status is pinned beside the floor note for its call, plus one naming another run. Refs: #17460 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ranch ci-status's read_api writes "could not read the push history of BRANCH; re-run this run." for the activity read, whose call carries the branch as ref=refs/heads/BRANCH, URI-encoded by jq's @uri. That companion named no id, so a floor-held push-history read beside a review stop re-ran nothing where main re-ran the stopped review. The companion's branch is now encoded the same way and matched against the call's ref parameter up to its end, so a different branch, or one that only shares a prefix, stays a real failure. Refs: #17460 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Post-merge mutation testingKilled 6, survived 1, timeout 0, no coverage 0, invalid 0, not run 0.
Surviving mutants
The run's summary has the full report. |
Refs: #17460
Summary
The reconciler's full pass reads the head's ci-status annotations. When they show a review stop (an API budget defer or a kill switch) or a rate hold, it re-runs the head's stopped reviews. On main the check is
reviewStopNoted(notes) || rateHeldNoted(notes), and both predicates match when any onefailureannotation matches. So a head whose ci-status also failed on a real failure, such as an upstream outage on the other review lane or a local read error, still had its stopped reviews re-run. That re-run is wasted: ci-status stays red on the other failure, so the re-run cannot turn the head green.#18757 closed the same gap in the follow-up tick with
onlyReviewStopsNoted(). Codex found the full-pass copy of the gap on that PR.Rule: the full pass is never stricter than main, except where a real failure is present.
Fix
reconcile.mjs: the full pass gates the stopped-review re-run onreviewStopsAmidGateNotes(notes). The head needs at least one review stop or rate hold, and every otherfailurenote, past GitHub'sProcess completed with exit code N.(EXIT_NOTE), must be a gate note:killSwitchNoted);PENDING_REVIEW_NOTE,MISSING_REVIEW_NOTE);FLOOR_NOTE);could notcompanion tied to a floor note's call.The tie: each target a ci-status read_api description names is matched to the path of the call in a floor note:
#Nmatches/pulls/Nor/issues/N;run Nmatches/actions/runs/N;job Nmatches/check-runs/Nor/actions/jobs/N;/SHAor=SHAtarget;the push history of BRANCHmatchesref=refs/heads/BRANCH, encoded as jq's@uriencodes it, up to the end of the parameter.Each match stops at the end of the id, so
#1does not match/pulls/12, andfeat/floordoes not matchfeat/floor-tie. Every GitHub API read that ci-status describes (pr-require-checks.yml:7500-8030) names one of these targets.Residual, by design: a
could noterror from a local read names no API call. Examples are thepr-pipeline.yamlkeys in the hold config and the trusted-actor list from a checkout. Such an error counts as a real failure, so a head with one gets no stopped-review re-run.onlyReviewStopsNoted()moved fromfollowup.mjsintoreconcile.mjs, next to the predicates it is built from.followup.mjsimports it through its existing static import ofreconcile.mjs, so there is no dynamic import and no new import edge. The follow-up tick keeps this narrower rule. On main it already hands a head with other gate notes to the full pass ("failed on more than a review stop"), and the full pass counts the re-run places such a head may need.A ci-status that fails on a real failure alone takes the same fall-through as before (kill switch, rate-limit floor, pending review).
It costs no extra API calls: the annotations are already read.
Verification
Each case is a subtest of "the full pass re-runs a head's stopped reviews only when every other ci-status failure is a gate note, past GitHub's exit-code note" in
reconcile.test.mjs. The notes come from their producers:switchHold()frommerge-holds.mjs, ci-status's echo lines with the current check namesPR Review / StatusandPR Review Security / Status, and read_api'scould not read <description>; re-run this run.beside gh_read's'gh api <call>' was not sent: GitHub's core API rate limit holds until .... Every case also ends with GitHub's exit-code note. The table lists the stopped reviews each check re-runs; review 201 is the stopped one.the files of #1) + stopcould not read docs/conventions/pr-pipeline.yaml ...) + stopactions/runs/301/jobs+could not read the jobs of run 301+ stopactions/runs/301+could not read run 301+ stopcheck-runs/9001/annotations+could not read the annotations of job 9001+ stopactions/runs?head_sha=SHA+could not read the pull_request runs on SHA+ stopworkflows/pr-review-security-hosted.yml/runs?head_sha=SHA+could not read the pr-review-security-hosted.yml runs on SHA+ stoppulls/1+could not read #1+ stoppulls/1/reviews+could not read the reviews of #1+ stopissues/1/comments+could not read the comments of #1+ stopactivity?ref=refs%2Fheads%2Ffeat%2Ffloor-tie+could not read the push history of feat/floor-tie+ stopcould not read the jobs of run 302+ stopfeat/floor-tie+could not read the push history of feat/floor+ stopMain's column was measured by restoring main's any-one check in the same tests. This PR differs from main only on the four "(wasted)" rows. Each of those carries a real failure.
Mutation proofs (each one was reverted after it ran):
actual [201], expected[]).onlyReviewStopsNoted) in the full pass, these cases fail: kill switch + stop (which also re-runs ci-status run 101), floor + companion + stop, stop + pending, and stop + missing.EXIT_NOTEskip removed, "defer alone" fails in both the full-pass and follow-up tests (actual [], expected[201]).causes.some(stopCause)) removed, the direct predicate test fails. It checks that a kill-switch, floor, pending or missing note alone is not a review stop.could notbeside a floor note", the local-error case fails.run Nandjob Nforms removed, the three run and job companion cases fail.Suites:
node --test --test-concurrency=4over the reconciler suites (reconcile.test.mjs,recent-pass.test.mjs,reset-tick.test.mjs,followup-main.test.mjs, the child-process e2e test) and the importer suites (jobs-batch.test.mjs,guard-coverage.test.mjs,pr-review-main/workflow.test.mjs,component-status.test.mjs,infra-failure.test.mjs): 387 pass, 0 fail.scripts/check-affected.sh --no-fetch: 17 passed, 7 skipped over 3 changed files.Related
onlyReviewStopsNoted()for the follow-up tick.🤖 Generated with Claude Code