Repository navigation
fix: read an empty head_sha run listing through check-runs - #32383
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fix targets the cause (each reader trusted a single source), it only adds a fallback behind an empty listing, and an unreadable named run reads as unknown rather than absent. Notes
[DESIGN-REVIEWED] 93c191b Description read[DESCRIPTION-READ] df6594c2658a84d57fca928289935fb84958d11213f91e557bceaabf89896729 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Each reader fixes the cause where it sits: an empty Inventory (8 items) — 8 justifiedIntent: CI stops reading a green or running lane as missing when GitHub's filtered runs listing comes back empty for a head whose runs exist. This is a FIX (#23245).
[FIRST-PRINCIPLES-REVIEWED] 93c191b Description read[DESCRIPTION-READ] 4d84ce4e699e5c7d681fbf4dd4f4c887eb7cab7ef064c9baee4ad71eb50d7a83 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
|
dde58ea to
9cd2f5e
Compare
|
self-added: yes
|
The actions/runs?head_sha= listing is a filtered search that has answered no runs for a head whose own check-runs named 30 of them. PR Readiness, the AI review override handler and republish_withheld_verdict.py took that empty answer as "no runs": a green lane read as "(not started)", an override was not bound to its fork lane run, and a republish asked for a manual re-run. When the listing is empty, each reader now reads the head's check-runs (every row, filter=all), fetches the runs their Actions job links name, and keeps those that ran for that event on that exact head, newest first. A named run that cannot be read is unknown, never absent. A non-empty listing takes the same path as before. Builds on #28431. Co-authored-by: Gary Jennings <garysjennings@gmail.com>
9cd2f5e to
93c191b
Compare
|
[operator: bolichen97] Rebased onto main dcf5084, which carries #32786. Backend shard 6 was red twice on the old base: |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving head 93c191b. The review read the full diff against the surrounding code. The changed suites passed at this head: 36 tests in the empty-listing and republish files, and 284 in the publish, human-override and evaluate files. A mutation pass reverted each new guard in turn, and every one turned at least one test red: the fallback, the event and head_sha filter, filter=all, the known-run skip, the newest-first sort, and fail-closed on an unreadable run. Nothing on main contains this change yet.
Security: this changes how the required PR Readiness gate and the human override workflow find lane runs. The risk is not realized. A run id read from a check-run's details_url only selects a run that is then fetched from this repository's own Actions API. That run is kept only when its event and head_sha match, and it then goes through the same head repository and branch binding as a listing row. A forged link can only name a real run of this repository on this exact head. Every read failure is reported as "unknown", never as "absent": readiness says "could not be evaluated", the override fails the lane, and republish returns None.
Done well: each reader keeps "unknown" separate from "absent", and a separate test covers each of those cases.
Optional:
test/test_ai_review_workflows_human_override.py:543now checks for.details_urlonly insidererun_fork_lane(). You could drop just thehead_runs_from_check_runs()body from the script and assert on the rest. That is stricter and still passes at this head.- The body says a head with no
dynamicrun costs one check-runs read. Runs from other events on the head (for examplepull_request_target) are each still fetched once before the event filter drops them. - The same-repo override path runs the check-runs fallback once per lane. Caching it once per step, as
bind_fork_triggerdoes, would save REST calls on/ai-review override all.
After this merges, #28431 can be closed as superseded, with credit to its original author.
The actions/runs head_sha listing is a filtered search that can answer no runs for a head whose runs exist. #32383 made PR Readiness, the AI review override handler and the withheld-verdict republisher read that empty answer through the head's check-runs. Three readers still took it as "no run": a PR Size approval was recorded but PR Policy was not re-run, a Sensitive Change Review author comment failed with "No Sensitive Change Review run found", and the merge-queue poll would fail a green group once its five-minute appear window passed. Each now reads an empty listing through the head's check-runs (every row, filter=all), fetches the runs their Actions job links name, and keeps those of its own workflow and event on that exact head. A named run that cannot be read is a read failure, never an absent run. The four workflows involved gain checks: read for that read.
The actions/runs head_sha listing is a filtered search that can answer no runs for a head whose runs exist. #32383 made PR Readiness, the AI review override handler and the withheld-verdict republisher read that empty answer through the head's check-runs. Three readers still took it as "no run": a PR Size approval was recorded but PR Policy was not re-run, a Sensitive Change Review author comment failed with "No Sensitive Change Review run found", and the merge-queue poll would fail a green group once its five-minute appear window passed. Each now reads an empty listing through the head's check-runs (every row, filter=all), fetches the runs their Actions job links name, and keeps those of its own workflow and event on that exact head. A named run that cannot be read is a read failure, never an absent run. The four workflows involved gain checks: read for that read.
…33367) The actions/runs head_sha listing is a filtered search that can answer no runs for a head whose runs exist. #32383 made PR Readiness, the AI review override handler and the withheld-verdict republisher read that empty answer through the head's check-runs. Three readers still took it as "no run": a PR Size approval was recorded but PR Policy was not re-run, a Sensitive Change Review author comment failed with "No Sensitive Change Review run found", and the merge-queue poll would fail a green group once its five-minute appear window passed. Each now reads an empty listing through the head's check-runs (every row, filter=all), fetches the runs their Actions job links name, and keeps those of its own workflow and event on that exact head. A named run that cannot be read is a read failure, never an absent run. The four workflows involved gain checks: read for that read.
Problem / Motivation
Goal: CI stops treating an empty
actions/runs?head_sha=answer as proof that a head has no runs, so a green lane is not read as "(not started)" and a lane run is not reported as missing when it exists.The
head_sha-filtered runs listing is a search that has answeredtotal_count: 0for a head whose own check-runs named 30 runs (#23245). The three.github/**readers #23245 names took that empty answer at face value:(not started)and held the verdict at pending; its success re-check found no open lane and could publish success over a lane that had just restarted.ai-review-human-override.ymlreported "Fast Gate has not run" on a fork PR (so the override was not bound to the fork lane run), and "no workflow run found" on a same-repo PR.republish_withheld_verdict.pyreported the lane run "could not be located" and asked for a manual re-run.The
pr_status.pyreader was fixed in #23253. Builds on #28431 by @dodgeblaster.Why it matters
The required PR Readiness status can sit at pending on a green PR until a later recompute happens to get a non-empty answer. An override or republish that cannot find its run leaves a lane blocked or unpublished and asks a person to re-run it by hand. Each of these happens on a head whose runs exist.
Not a goal
await-fast-gate.sh, which polls its listing every 10s and re-reads an intermittent empty answer.fix_loop_metrics.py, Issue Radarlist_pr_workflow_runs), which decide nothing from an empty answer.pr-size-override.yml,sensitive-change-review-comment.yml,merge-queue-readiness.yml): tracked in Three more workflows read an empty head_sha run listing as no run #32348.What changed (motivation → approach → change)
Symptom: an empty listing reads as "no runs". Root cause: each reader has only one source for a head's runs. Change: when the listing is empty, read the head's check-runs. An Actions job's check-run links its run in
details_url(.../actions/runs/<run id>/job/<job id>). Each distinct run is fetched and kept only when it ran for that event on that exact head. This is the same idea as #23253: the head's own check data outranks an empty listing.pr-readiness.ymlevaluation and publish re-checkgh_head_runsin the sharedgh-retry.shhelpercould not be evaluated, never(not started)ai-review-human-override.ymlfork Fast Gate binding and same-repo lane lookuphead_runs_from_check_runsfail_lane, never "has not run" or "not found"republish_withheld_verdict.py_same_repo_run_idand_fork_trigger_head_runsNone(unknown)The check-runs read asks for every row (
filter=all), so a sibling PR's newer same-named job on a shared head does not hide this PR's run, and the runs come back newest first, the order the listing answers in. A non-empty listing is used exactly as before and makes no extra request. An empty listing costs one check-runs read, plus one read per run it names that the caller does not already hold: thedynamic(CodeQL) reads skip the runs already on thepull_requestpage, so a head with nodynamicrun costs one check-runs read.docs/ci/ci-and-reviews.mddocuments the rule.Backwards compatibility
Compatible: a non-empty listing takes the same path as on main, and an empty listing with no Actions job check-runs still reads as "no runs".
Removes nothing: the change only adds a second source behind an empty answer. No path, field, validator or record is taken away.
Tests
test_pr_readiness_empty_run_listing.py: runs named by the check-runs answer for an empty listing, also when a sibling's newer same-named row is all the default filter returns (verdict success). A named run that cannot be read, or a check-runs read that fails, givescould not be evaluated. A named run for another head or event is not borrowed. An empty listing with no job check-runs is still(not started). A non-empty listing reads no check-runs and fetches no single run. A missingdynamicrun does not re-fetch thepull_requestruns in hand. The module skips only off POSIX (no bash, Windows); a host withoutjqfails its runner fixture with a named error instead of skipping, because the fallback under test is a jq program.test_pr_readiness_publish.py: a lane restarted behind an empty listing still holds the success. An unreadable named run does not publish success. A missingdynamicrun does not re-fetch the runs page in hand.test_ai_review_workflows_human_override.py: fork and same-repo, an empty listing binds or re-runs the run the check-runs name, the newest when two are named. An unreadable named run, or a failed check-runs read, is a read failure. A run for another head or event does not bind. No job check-runs still reads "has not run" / "not found". The.details_urlguard is scoped to the fork lane resolver it protects, because that resolver still reads the lane run only from the marker.test_republish_withheld_verdict.py: fork and same-repo lookups through the check-runs; the no-readable-run cases, where an unreadable run or check-runs read is unknown (None) and a run for another head or event is absent ([]); no check-runs read on a non-empty listing; run ids parsed from Actions job links across every page; and the check-runs read asking for every row (filter=all).Determinism: the 28 new test ids pass 20 times at
-n0, 10 times at-n 4 --dist loadgroupbesidetest_pr_readiness_codeql_sources.pyandtest_pr_readiness_fork_base.py, and in a shuffled order (seed 17705).Each read-failure, unknown-versus-absent and event-filter test above fails with its own guard reverted by hand.
Proof: not provable -- prove.py timed out
Manual verification
N/A — every changed reader is a workflow step or script that the tests execute against a stubbed
gh. The intermittent empty listing cannot be produced on demand against the live API.Screenshots / video
N/A — CI workflows and scripts only; no user-visible surface.
Related Issues
Closes #23245
Sibling sweep
Swept: git grep -nE "actions/(workflows/[^/]+/)?runs" -- .github/ scripts/ src/ (kept: the reads filtered on head_sha)
Sibling: .github/workflows/pr-readiness.yml -- changed here
Sibling: .github/workflows/ai-review-human-override.yml -- changed here
Sibling: .github/scripts/republish_withheld_verdict.py -- changed here
Sibling: .github/workflows/pr-size-override.yml -- tracked in #32348
Sibling: .github/workflows/sensitive-change-review-comment.yml -- tracked in #32348
Sibling: .github/workflows/merge-queue-readiness.yml -- tracked in #32348
Sibling: src/kiro_crew/builtin_skills/kirocrew-dev/kirocrew-prepare-pr/scripts/pr_status.py -- not affected -- fixed by the rollup-row check in #23253
Sibling: .github/scripts/await-fast-gate.sh -- not affected -- it polls every 10s and re-reads an intermittent empty answer
Sibling: .github/scripts/fix_loop_metrics.py -- not affected -- metrics only, decides nothing from an empty answer
Sibling: src/kiro_crew/apps/builtins/issue_radar/backend/github_client_writes.py -- not affected -- display only, decides nothing from an empty answer
Sibling: src/kiro_crew/builtin_skills/kirocrew-dev/kirocrew-prepare-pr/SKILL.md -- not affected -- its cancel snippet reads in-flight runs to cancel; an empty answer cancels nothing
Pattern harvest
Rule candidate: review-prompt
Pattern: an empty result from a filtered search API read as proof of absence instead of "not observed"
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)