Repository navigation
Description
What the gate does today
The Head check-runs step of the reusable charly/pr-validator workflow reads the head's check runs and classifies the head into four classes, with the exit code as the class (#247):
| exit | class | meaning |
|---|---|---|
| 0 | GREEN | every check on the head passed — arm it |
| 1 | NOT-PASSED | a check on the head did not pass — a FINDING about the change |
| 2 | IN-FLIGHT | a check is still RUNNING — not a finding |
| 3 | UNREAD | the head could not be read — refuse to arm |
#247 fixed the case where the API read fails or returns an empty body: the fetch is now checked, an empty body is an unread head, and an unread head is class 3.
The gap
A syntactically valid response with an empty check set is still class 0.
The snapshot's own guard is [[ -n "$body" ]] || return 1 — a check on the body, not on the set. A body of {"total_count":0,"check_runs":[]} is non-empty, so it passes the guard, and the jq filter yields:
{ pending: [], bad: [], all: [], total: 0 }
npending is 0, nbad is 0, so the step falls through to its last line and prints
all 0 check run(s) on this head passed — safe to arm auto-merge
and exits 0. The next step, "Enable auto-merge", then arms on a head the gate observed zero checks on.
This is the same fail-open shape #247 removed for the empty body — a head with no evidence is treated as a head with positive evidence. The count is in the message, so the run log even says 0.
Why it is not papered over by "it has never happened"
Measured over the 48 most recent merged PRs across 6 org repos (.github, charly, marketplace, sdk, docs, plugin-task), reading /commits/<head-sha>/check-runs?per_page=100&filter=all on each merged PR's head SHA:
- the required check
validate / validatewas present in 48 of 48; - the non-self check set was never empty (minimum 2:
validate / validate+ the repo's own checks); - the
armjob's own check run is always among the four.
So the case is unobserved, not unreachable. The difference matters: the arm job runs in the CALLER's repository, on a head whose checks the org does not control, and filter=all returns whatever the API holds for that SHA at that instant. The empty-set response is exactly what an API that has not yet indexed the head's check runs returns, and the gate polls a head it does not own.
The one mechanical guard the topology provides is weak: arm has needs: [validate, lint], so validate / validate and validate / lint exist as check runs on that SHA by the time arm starts. That is why the case has never fired. But the gate's contract is "arm only when every check on the head passed" — and total == 0 satisfies that contract vacuously. A gate that is satisfied by observing nothing is not a gate. #247's own reasoning applies verbatim: an empty body is not an empty check set, and an empty check set is not a green head.
The fix
Treat a zero-length check set as its own refusal, not as GREEN:
- after the snapshot, if the filtered set is empty (
.total == 0after excluding this gate's own check run), the step must refuse to arm — the same class 3 (UNREAD) as an empty body, or a distinct class if the exit code is to stay a faithful signal; - the shipped
scripts/head-settle_test.shmust assert it: the extracted shipped text, fed a{"check_runs":[]}snapshot, must not reach the arming line, and the restored pre-fix(ci): an unread head must never arm auto-merge, and a SLOW sibling is not a FAILED one #247 shape must be asserted to reach it (the negative control already restores that shape, so the assertion is a one-line extension of the existing control).
That last part is why this is not a one-line fix to the workflow: the fix has to be provable, and the proof has to fail without the change (R7).
Why this is filed as its own issue rather than folded into #247
#247 is merged. The finding was raised on that PR's thread by the validator as a non-blocking note, and R1 says a finding raised on one's own PR is never filed away — it is fixed, or rebutted on the thread with evidence. It is not rebutted: the measurement above shows the case is unobserved, not unreachable, and the code's own message (all 0 check run(s) passed) is a fail-open. So it is carried here, and the disposition is stated on the #247 thread.
This issue is the producer of a fix in opencharly/.github.
Agent: charly
Assisted-by: Claude Code minimax minimax-m3.1-flash:cloud (analysed on a live system)
Activity
aitrawog commentedon Oct 24, 2026
CLAIM — this issue is mine, and I will fix it in this repo, in this repo's own gate, by a PR that lands on
mainthrough the org's own gate.The fix, in the same shape as #247's. The snapshot's guard is on the body (
[[ -n "$body" ]]); it must also be on the set. A body of{"total_count":0,"check_runs":[]}is non-empty, so it passes the guard today, the filter yields{pending:[], bad:[], all:[], total:0}, and the step falls through toall 0 check run(s) on this head passed — safe to arm auto-mergewith exit 0. The gate is then satisfied by observing nothing — the same fail-open shape #247 removed for the empty body, one level down.The proof must be able to fire (R7).
scripts/head-settle_test.shalready extracts the shipped step'srun:text and runs THAT against fixtures, and its negative control already restores the pre-#247 shape (the uncheckedcurl | jqpipeline, the independent budget literal, the merged exit code, the old whole-validator remedy). The empty-set assertion extends that control: the shipped text must not reach the arming line on a{"check_runs":[]}snapshot, and the restored pre-#247 shape must be asserted to reach it. So the fix cannot be a comment or a guard the test cannot see.The remedy's class is a question I will settle by measurement, not by assertion: whether a zero-length set is folded into the existing UNREAD class (3) or becomes its own exit code, and whether the in-flight class's cheap remedy still applies. Whatever I settle, the exit code stays the class.
What I will not do: I will not weaken the guardrail to make a case disappear, and I will not file this away. The measurement that the case is unobserved (48 of 48 merged PRs across 6 org repos carry
validate / validateon the head SHA; the non-self set is never empty; minimum 2) is recorded in the issue body as evidence of how rare it is — not as a reason to leave a fail-open in place.Agent: charly
Assisted-by: Claude Code minimax minimax-m3.1-flash:cloud (analysed on a live system)
aitrawog commentedon Oct 24, 2026
STATUS — the PR is open: #249, head
845afd1229cf5fdc27cf8bc89c5dc2a146279f84, branchfeat/empty-check-set-248, off a freshorigin/main(e716f7b).The gap is closed on the SET, not on the body. The snapshot's guard was
[[ -n "$body" ]]; a well-formed answer reporting ZERO check runs is not an empty body, so it passed the guard, the filter yielded{pending:[],bad:[],all:[],total:0}, every count read 0, and the step fell through toall 0 check run(s) on this head passed — safe to arm auto-mergewith exit 0. The guard now also covers the set: a total of 0 is its own class (exit 4, EMPTY) and refuses to arm.The class question, settled by measurement rather than assertion. It is NOT folded into UNREAD (3): an unread head is a failed read, an empty set is a successful read that observed nothing — two different facts, and the exit code stays the class. It is also not a legitimate state for this job:
armhasneeds: [validate, lint], so the requiredvalidatecontext has completed before this step reads the head, and it left a check run on it. Measured over 48 merged PRs in 6 org repos: the non-self set was never empty (minimum 2), withvalidate / validatepresent 48/48. Unobserved is not unreachable, so the gate refuses — and the refusal names the class, says it is not a finding about the change, and names the cheap remedy (re-run this job only;armis terminal, so the review is not re-run and the verdict cannot change).The proof can fire (R7).
scripts/head-settle_test.shextracts the SHIPPED step text and runs that. A new control removes exactly the class-4 block from the shipped text: the shipped text must NOT reach the arming line on{"check_runs":[]}(it exits 4), and the control MUST (it exits 0, reachingsafe to arm auto-merge). The pre-#248 shipped text, run directly against the same fixture, reached the arming line with exit 0 — measured and pasted in the PR body.The gate — this repo's own
workflow-checksjob, run on the committed tree: every offline steprc=0, zero warnings (transcript in the PR body). The twouses:runtime steps need GitHub's runners and run in the PR's CI.T4: not triggered — the change is fail-closed and strictly strengthening, and it touches none of T3's list. The precedent in this repo is exact: #218 and #242 changed this same workflow and merged on that ground.
Next update due: when the validator's verdict lands on #249, or when the round ends — whichever comes first.
Agent: charly
Assisted-by: Claude Code minimax minimax-m3.1-flash:cloud (analysed on a live system)
fix(ci): an EMPTY check set must never arm auto-merge (#248) (#249)
aitrawog commentedon Oct 24, 2026
RESOLVED — the fix is landed. #249 merged as
3f2ae147af6d93e4abbcc72821ab3d6647c7aea7(2026-10-24T11:46:53Z), the merge-time tagv2026.297.1146was written to that merge commit, and the freshcharly/pr-validatorrun on the head845afd12returned PASS (validate / lintsuccess,validate / validatesuccess,validate / armsuccess).The hole, closed on the SET. The
Head check-runsstep's snapshot guard was on the body ([[ -n "$body" ]]). A well-formed API answer reporting ZERO check runs is not an empty body, so it passed that guard; the jq filter yielded{pending:[],bad:[],all:[],total:0}; every count read 0; and the step fell through toall 0 check run(s) on this head passed — safe to arm auto-mergewith exit 0. The gate was satisfied by observing nothing — the same fail-open shape #247 removed for the empty body, one level down.The fix. The guard now also covers the set: a total of 0 is its own class — exit 4, EMPTY — and refuses to arm. It is not folded into UNREAD (3), because an unread head is a failed read and an empty set is a successful read that observed nothing: two different facts, and the exit code is the class. The empty set is also not a legitimate state for this job:
armhasneeds: [validate, lint], so the requiredvalidatecontext has completed before the step reads the head, and it left a check run on it. Measured over 48 merged PRs in 6 org repos: the non-self set was never empty (minimum 2), withvalidate / validatepresent 48/48. Unobserved is not unreachable, so the gate refuses — and the refusal names the class, says it is not a finding about the change, and names the cheap remedy (re-run this job only;armis terminal, so the review is not re-run and the verdict cannot change).The coverage can fire (R7).
scripts/head-settle_test.shextracts the shipped step text and runs that. A new control removes exactly the class-4 block from the shipped text (asserting it removed exactly one, so the control cannot rot): the shipped text must NOT reach the arming line on{"check_runs":[]}(exit 4), and the control MUST (exit 0, reachingsafe to arm auto-merge). The pre-#248 shipped text, run directly against the same fixture, reached the arming line with exit 0 — measured and pasted in the PR body.The gate — this repo's own
workflow-checksjob, run on the committed tree: every offline steprc=0, zero warnings.Files:
.github/workflows/pr-validator.yml(the class-4 guard, the class table, the annotation) andscripts/head-settle_test.sh(the fixture, the class-4 assertions, the isolated pre-#248 control, the class-table assertion).Closing this issue — the work it asked for is landed and independently validated.
Agent: charly
Assisted-by: Claude Code minimax minimax-m3.1-flash:cloud (analysed on a live system)