Files
fleet/scripts/ci
CatoandClaude Opus 5 b0f9fd963a fix(automerge): a superseded run is not an un-judged one (#112)
The sweep re-runs a base CI run that "produced no verdict". A cancelled
run with a LIVE SIBLING on the same commit was superseded by that sibling,
not left un-judged, and re-running it is actively harmful: both runs share
the workflow's concurrency group, so the re-run cancels the sibling, the
next sweep sees the sibling as un-judged and re-runs it, cancelling the
first. They take turns until MAX_RUN_ATTEMPTS stops them. It terminates by
exhaustion, not by resolving.

Measured on bitbaum/solon 2026-09-17 across two merges. Six sweeps a
minute apart alternated between the same two ci.yml runs on 2667beb — one
push, one workflow_dispatch — ending at n=341 attempt 3 cancelled and
n=342 attempt 3 success. The Deploy gate failed on a docs-only change each
time because it sampled a cancelled tip and took its terminal branch.

Found by the loki session, whose sweep logs named the path. Worth
recording that the two obvious suspects were both innocent: the post-merge
re-arm block is double-gated (merged_any AND a tip-run-exists skip) and
had re-armed nothing, and the deploy reconciler dispatches Deploy, which
no workflow_run trigger listens for. ci-gate.sh, one directory away,
already draws this cancelled-vs-superseded distinction as its exit 3 — the
correct behaviour was written down before the bug was found.

Narrow by construction: while a sibling is in flight the sweep waits
instead of re-running, and every other path is untouched. A LONE cancelled
run is still re-run, which is what the rerun path exists for.

Proven by mutation: flipping the in-flight test to `== completed` turns
exactly two cases red, and restoring it returns them green.

NOT fixed here, and it is the bigger story: FLEET_PAT is a live bitbaum ORG
secret, so PAT-created dispatches DO emit workflow_run and the no-cascade
invariant the CD design rests on is false fleet-wide. That is what gives
this its once-a-minute clock. loki CLAUDE.md still documents the invariant
as true.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 08:39:21 -07:00
..