Skip to content

fix(ci): cancelled image builds shipped yesterday's binary all day - #599

Merged
athvin merged 1 commit into
mainfrom
bm/ci-images-never-cancel-on-main
Nov 5, 2026
Merged

athvin merged 1 commit into
mainfrom
bm/ci-images-never-cancel-on-main

Conversation

@athvin

@athvin athvin commented Nov 5, 2026

Copy link
Copy Markdown
Owner

What happened

No er-api image was built on 2026-11-05. The newest in ECR is from the
previous evening, and four deploys reported success rolling it.

commit what it carried images
0c455d41 P12 metrics cancelled
96d4f796 P15 structured logging cancelled
d4dae454 P22 allowlist gate cancelled
73421208 workflow only success (er-api correctly skipped)

images.yml had cancel-in-progress: true on a group that, for a push,
collapses to the ref alone — its own comment said so. The er-api build takes
~58 minutes, so in a burst of merges every build was cancelled by the next
merge
before it could finish.

The consequence

P12's metrics, P15's structured logging and P22's Rust-side gate were merged,
green, and absent from the running binary.

Confirmed by reading the live pod rather than inferring it:

"OTLP span export installed"   ← present
"OTLP metric export installed" ← absent

Same log level, same module, endpoint set. The binary predates P12.

The fix

An image is the artifact a commit needs, not a check on it. Cancelling one
does not save work — it removes the thing the deploy is supposed to roll, and
the deploy then reuses whatever digest is newest and succeeds.

That is the reasoning deploy.yml already applies to itself:

"Never cancel a deploy. See the header: cancelling one is how the previous
arrangement silently skipped deploying at all."

So pushes never cancel. workflow_dispatch still cancels its own group, which
is keyed on the dispatched ref and never collides with a push.

The cost is queued builds during a burst rather than cancelled ones: slow
and correct instead of fast and silently wrong.

How it was found, and the follow-up

The deploy's stale-digest ::warning:: fired on every one of those four
deploys. That is the only reason this was findable — and it is a warning in a
run summary, where nobody was looking, including me, having added it.

A deploy that refuses when the Rust tree moved in a commit with no image
for it would turn this class into a red check instead of a warning. That is the
follow-up, not this change.

🤖 Generated with Claude Code

No er-api image was built on 2026-11-05. The newest in ECR is from the
previous evening, and four deploys reported SUCCESS rolling it.

`images.yml` had `cancel-in-progress: true` on a group that, for a push,
collapses to the ref alone — its own comment said so. The er-api build takes
~58 minutes, so in a burst of merges every build was cancelled by the next
merge before it finished. The commits that DID complete were the ones where
`detect` correctly skipped er-api because no Rust changed.

The consequence is the part that matters: P12's metrics, P15's structured
logging and P22's Rust-side allowlist gate were merged, green, and absent from
the running binary. Confirmed by reading the live pod — "OTLP span export
installed" is there and "OTLP metric export installed" is not, at the same log
level from the same module, with the endpoint set.

An image is the ARTIFACT a commit needs, not a check on it. Cancelling one
does not save work; it removes the thing the deploy is supposed to roll, and
the deploy then reuses whatever digest is newest and succeeds. That is the same
reasoning `deploy.yml` already applies to itself — "Never cancel a deploy. See
the header: cancelling one is how the previous arrangement silently skipped
deploying at all."

So pushes never cancel. `workflow_dispatch` still cancels its own group, which
is keyed on the dispatched ref and never collides with a push.

The cost is queued builds during a burst rather than cancelled ones: slow and
correct, instead of fast and silently wrong.

The deploy's stale-digest `::warning::` fired on every one of those four
deploys, which is the only reason this was findable at all. It is a warning in
a run summary, and nobody was looking there — including me, having added it.
A deploy that refuses when the Rust tree moved in a commit with no image for
it would turn this class into a red check instead of a warning; that is the
follow-up, not this change.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin added a commit that referenced this pull request Nov 5, 2026
…hip (#600)

The stale-digest `::warning::` was not enough, and the evidence is specific:
it fired on four deploys on 2026-11-05 — P12's metrics, P15's structured
logging, P22's gate and P7's action header all merged, green, and absent from
the running binary — and nobody read it, including the person who added it for
exactly this failure. Something that must not be missed has to fail a check,
not annotate one.

So the digest step now REFUSES when the tree that builds an image actually
moved between what is running and what is being deployed.

The question is answerable because the reused digest carries the sha it was
built from: `git diff <that sha>..<DEPLOY_SHA>` over the image's own source
paths (`rust`, `Dockerfile`, `entities` for er-api; `frontend` for er-web)
says whether this deploy would ship older code than it claims. No image tag
and no source change is the legitimate case — #587's platform-only path, or a
tree that genuinely did not move. No image tag WITH a source change is the
bug, and it is now red.

Validated against the real incident rather than a hypothetical: the running
er-api was built from `8360868d`, main had moved to `17db1dde`, and 51 files
under the watched paths changed between them. The guard fires.

`fetch-depth: 0` on the checkout is load-bearing, not hygiene. The default of
1 clones a single commit, so the diff cannot resolve its left side and the
guard would take its "cannot verify" branch on EVERY deploy — a check that
always abstains, which is worse than no check because it looks like one. That
flaw was in the first version of this change and caught before pushing.

A tag that is not a commit in the checkout still only warns: that is a real
state for a hand-pushed image, and refusing on it would block a legitimate
deploy on a bookkeeping gap.

Companion to #599, which stops the builds being cancelled in the first place.
This is the guard for when something else swallows one.

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin merged commit 34223a5 into main Nov 5, 2026
44 checks passed
@athvin
athvin deleted the bm/ci-images-never-cancel-on-main branch November 5, 2026 18:01
athvin pushed a commit that referenced this pull request Nov 8, 2026
…es paths

#587's push trigger was added to fix a cause that was misdiagnosed — the real
reason #507 never deployed was cancel-in-progress, fixed by #599 and this
file's queueing. The trigger never fired on a platform-only commit and only
raced image builds on mixed commits, leaving noise-red deploy runs on main.
Removed with PLATFORM_ONLY and the notice fork; the header now carries the
correct diagnosis. deploy is reachable only through images, so images.yml's
push paths gain scripts/ci/deploy-*.sh (the hole the removal would open) and
deploy_reachability.rs holds all five surfaces in the required test context —
both directions observed failing under mutation.
athvin pushed a commit that referenced this pull request Nov 8, 2026
…es paths

#587's push trigger was added to fix a cause that was misdiagnosed — the real
reason #507 never deployed was cancel-in-progress, fixed by #599 and this
file's queueing. The trigger never fired on a platform-only commit and only
raced image builds on mixed commits, leaving noise-red deploy runs on main.
Removed with PLATFORM_ONLY and the notice fork; the header now carries the
correct diagnosis. deploy is reachable only through images, so images.yml's
push paths gain scripts/ci/deploy-*.sh (the hole the removal would open) and
deploy_reachability.rs holds all five surfaces in the required test context —
both directions observed failing under mutation.
athvin added a commit that referenced this pull request Nov 8, 2026
…mages paths (#661) (#899)

* wip: claim #661 — remove deploy.yml's misdiagnosed push trigger

* fix(ci): remove deploy.yml's misdiagnosed push trigger; gate the images paths

#587's push trigger was added to fix a cause that was misdiagnosed — the real
reason #507 never deployed was cancel-in-progress, fixed by #599 and this
file's queueing. The trigger never fired on a platform-only commit and only
raced image builds on mixed commits, leaving noise-red deploy runs on main.
Removed with PLATFORM_ONLY and the notice fork; the header now carries the
correct diagnosis. deploy is reachable only through images, so images.yml's
push paths gain scripts/ci/deploy-*.sh (the hole the removal would open) and
deploy_reachability.rs holds all five surfaces in the required test context —
both directions observed failing under mutation.

* style: cargo fmt

* style: clippy map_or

* chore(skills): regenerate required-checks for the deploy condition

* chore(skills): regenerate post-merge reference for the deploy trigger change

---------

Co-authored-by: bmoore813 <[email protected]>
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.

2 participants