Files
ops-docs/incidents/2026-11-09-stale-image-deploy.md

90 lines
4.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Incident 2026-11-09 — a gateway deploy shipped the previous build's image; every surface said it succeeded
Backfilled 2026-11-11 (self-reported by the audit's missing-write-ups list;
facts from the steward skill's deploy reference, verified there on 2026-11-09,
and re-confirmed by a live recurrence on 2026-11-11 — see the end).
## What happened
During the 2026-11-09 gateway upgrade window, the LiteLLM gateway was updated
expecting the new build. Two distinct mechanisms of this platform's update
path combined to ship the WRONG code while everything reported success:
1. **`cloudron update --image <tag>` was a silent no-op for this app.** The
CLI exited 0, printed `App is updated.`, recreated the container, wrote the
tag into the app record — and the running code was unchanged. The builder
pushes images to the registry (`registry.inference.coop/<repo>`), never
into the host's docker, so a bare `local/…` reference cannot be pulled.
`cloudron status --app` also reported the new tag, so **every surface agreed
with the lie**.
2. **`cloudron update` without `--image` reuses the LAST builder build.** The
update does not build on-server; it takes the previous build package. A
deploy performed before (or without) a fresh build ships the PREVIOUS
commit's image under a fresh manifest. That day: new manifest shipped, old
image ran, both looked like success.
## Blast radius
- The gateway ran the **previous commit's code** after a deploy that was
believed to carry the new code — the deploy's intended change (and any
verification done against it) silently proved nothing.
- No data loss, no downtime: the old image was healthy. The damage was
epistemic — a deploy recorded as done that had not happened, which the next
session would have inherited as fact.
## Detection gap
`App is updated.` and a green health check are the platform's success story,
and they are true even for a wrong deploy. Nothing in the flow forced the
question "is the NEW code actually running?" — the check that catches this
(grep the RUNNING container for something only the new code contains) existed
as a rule but was not wired into the deploy itself.
## Resolution and the fix that now exists
The working deploy order, verified 2026-11-09 and again 2026-11-11:
1. **Commit first** — the build context is the git checkout; an uncommitted
overlay edit silently reverts on rebuild.
2. **Build FIRST**, always, via
`~/.hermes/scripts/cloudron_builder_build.sh <repository> <yyyymmdd>-<gitsha>`
from the app's OWN repo dir (the auth triple is not optional).
3. **Then update**: for an app whose repo manifest pins `dockerImage`
(librechat-custom, member-portal), write the built tag into the manifest,
commit, and `cloudron update --app <id> --force` (no `--image` — the pin
wins). For an app with NO pin (litellm's local/… manifest), update from the
app's own repo dir; a bare `--image` with a non-registry path is a no-op.
4. **Verify two facts, never the CLI's output**: the app record's
`manifest.dockerImage` equals the built tag, AND the running container
contains something only the new build produces (`cloudron exec --app <id> --
grep -c <marker> <path>` / an md5 of a changed file / a boot-log line the
new start path prints).
Rollback is the same command with the previous tag — record the running tag
before any deploy.
## Recurrence caught live (2026-11-11) — the trap is broader than "stale"
The 2026-11-11 validator deploys hit the same mechanism from the other side:
a **bare `cloudron update --app <gateway-id> --force`** (no `--image`, run
from a neutral cwd, with no pin in the gateway manifest) deployed **the last
build package globally — which was a different app's build** (the chat
overlay), replacing the gateway's image AND installed manifest. The app
reported healthy the whole time because the wrong image was itself a healthy
web app; the deploy verification battery (manifest tag check) caught it
within minutes and the gateway was redeployed correctly with an explicit
registry-path `--image` from its own repo dir (downtime ≈ 9 minutes,
03:55–04:04 UTC).
Standing rules this recurrence adds:
- A bare `cloudron update` deploys the LAST BUILD PACKAGE — manifest
included — and the "last build" tracking is **global, not per-app**. Never
run it for an app whose own build was not the immediately preceding build.
- An app whose manifest has no `dockerImage` pin must be updated from its own
repo directory; `--image` takes the full registry path
(`registry.inference.coop/<repo>:<tag>`), never a bare `local/…` reference.
- The two-fact verification (manifest tag + in-container marker) is what turns
this trap from an incident into a caught-in-minutes event; do the second
fact every time.