Repository navigation
Description
What happened
A merged PR in a pod-crabbox-* variant repo produced two image runs on the same head, and the concurrent base-image pull failed one of them.
Measured on opencharly/pod-crabbox-code after PR #1 merged (merge commit bf8b985f8f0342dd6da67fc9bdfffb24f9456f20, tag v2026.309.0049):
$ gh run list --repo opencharly/pod-crabbox-code --limit 6 --json databaseId,name,event,conclusion,headSha,createdAt
41944191711 image workflow_run success 9fc857b3 2026-11-05T00:49:38Z
41944161642 image workflow_run failure 9fc857b3 2026-11-05T00:49:23Z
41944147253 tag-on-merge push success 9fc857b3 2026-11-05T00:49:17Z
41944025333 tag-on-merge workflow_run success 4f3a8953 2026-11-05T00:48:17Z
The failing run (41944161642) failed while fetching the pinned base, not while building this image:
image / build ... failed to extract layer (application/vnd.oci.image.layer.v1.tar+gzip sha256:88ce6f55f333d06f1cee320d6f3ad444f48d808248e252801469cddb39b10c6a) to overlayfs as "extract-675267696-5Ysf ...": mount callback failed on /var/lib/containerd/tmpmounts/containerd-mount701355380: failed to Lchown "/var/lib/containerd/tmpmounts/containerd-mount701355380/usr/bin/gdb" for UID 0, GID 0: lchown ...: no such file or directory
image / build ... ensure-image: pull ghcr.io/opencharly/pod-crabbox:2026.307.1828 failed: exit status 1
image / build ... charly: error: command "build": building pod-crabbox-code: base image ghcr.io/opencharly/pod-crabbox:2026.307.1828 is not present locally, could not be fetched from its registry ...
The publish itself SUCCEEDED on the sibling run: ghcr.io/opencharly/pod-crabbox-code:2026.309.0049 resolves anonymously (skopeo inspect --no-tags, rc=0, digest sha256:237598d9bd83743f76264eba2386a1eae45290156d52af358f0c135d2c6a5d7f), so no release was lost.
RCA
Mechanism (two parts).
- Two triggers, two tag-on-merge completions. The org dispatcher
.github/workflows/tag-on-merge.ymlfires onworkflow_run(pr-validator completion),pushtomain, andschedule. For this merge both theworkflow_run-driven run (41944025333) and thepush-driven run (41944147253) completed successfully. - The caller fires on EVERY tag-on-merge completion. The variant caller
.github/workflows/image.ymlhason: workflow_run: workflows: ["tag-on-merge"] types: [completed]with no dedupe by tag, so two completions started twoimageruns on one head. The two runs then raced on the runner's rootful containerd store while extracting the same base layer; one lost the extraction (lchown … /usr/bin/gdb: no such file or directory) and failed.
Blast radius. This is not specific to pod-crabbox-code: opencharly/pod-crabbox-systemd shows the same pair on one head (41935033023 and 41934997140, both image workflow_run, head 7b2f27fa), which happened to survive because both pulls won. Every repo carrying this caller wastes a full duplicate build per merge and can lose one of the pair to the race. The published tag is not lost when one sibling succeeds, but a repo whose only surviving run is the failed one publishes nothing.
Missed control. Nothing dedupes or serialises the caller's runs — neither by the resolved tag nor on the workflow-run event id — and the reusable image-build.yml does not no-op when the target image tag already exists.
Proposed fix
Either (a) make the caller trigger only on the push path (or dedupe by the resolved tag / github.event.workflow_run.id), or (b) make image-build.yml skip when :<tag> already exists. Option (a) removes the duplicate work; (b) makes the race harmless. A concurrency group keyed on the repo+tag would also serialise them.
Filed from
Found post-merge while landing the W5.2 variant image pod-crabbox-code (opencharly/pod-crabbox-code#1); the image published, so this did not block that landing.
Agent: containerd-crabbox-program/w5b · session 8b1c01cf-7f79-4a75-bff8-240415a06208
Assisted-by: Claude Code ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
Activity
aitrawog commentedon Nov 5, 2026
Additional evidence — the duplicate runs do not just waste work, they MOVE THE TAG.
Measured on
opencharly/pod-crabbox-nested, merge8828123e04b0ec9c436fa1bbb8ca4c03e23f7dd8(tagv2026.309.0149):All three completed/success, and they published different content under the same tag:
sha256:29a17b9c…sha256:ac96d62248de21e2ba2f7a1bbe568977f9f1f46e1b147f043a912e5191616e59So
ghcr.io/opencharly/pod-crabbox-nested:2026.309.0149is stable by name and not by digest — the last writer wins. That is the same set of concurrent runs this issue was filed for, and it upgrades the severity:import: '@github.com/opencharly/pod-crabbox:v2026.x'andghcr.io/opencharly/pod-crabbox:2026.xmust name the same build. With N concurrent publishes of one commit, two consumers can resolve the same tag to different image digests at different times.pod-crabbox-codeis the same concurrency: one of a pair failed onensure-image: pull … failedwhile its sibling published. Here all three succeeded — so the race is intermittent, which is worse for diagnosis, not better.pod-crabbox-nested:2026.309.0149as itsbase:may build against29a17b9c…and later pullac96d622…— different bytes, same reference.The fix is the dedupe this issue already asks for, and it should be judged by whether the tag is written exactly once per merge. A publish that runs N times against one commit cannot be made safe by retrying; it has to not run N times.
Reproduce: merge anything to a
pod-crabbox*repo, thengh run list -R opencharly/<repo> --json name,event,status— theimageentries withev=workflow_runfor a single merge are the tell.Agent:
containerd-crabbox-program· session8b1c01cf-7f79-4a75-bff8-240415a06208Assisted-by: Claude Code ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
aitrawog commentedon Nov 5, 2026
The mechanism —
tag-on-mergetriggers itself once, andimagefans out on every completion.Measured on
opencharly/pod-crabbox-k3s, merge091ec9cb(tagv2026.309.0459), 2026-11-05. Literal output:Read the two together. The
workflow_runarm runs at 04:59:37 against head0c4dc393. The squash lands at 04:59:58 (091ec9cb). At 05:00:12tag-on-mergewrites its ownCHANGELOG/2026.309.0459.mdcommitf3ceffecand pushes it tomain. Two seconds later there is atag-on-mergerun withev=pushon exactly that commit. The workflow has re-entered on its own push.That is the whole of it:
tag-on-mergedeclarespushas a secondary trigger for human and contents-API merges, and theCHANGELOGcommit it writes on the primary path is itself a push tomain. The second run is a no-op — the sweep is idempotent and finds nothing — but it is a real run and it completes.Why that doubles the image.
imagekeys onworkflow_run: workflows: [tag-on-merge], so it fires on the completion of everytag-on-mergerun rather than on the merge. Two completions, twoimageruns, 16 s apart, both on headf3ceffec— two concurrent publishes to one tag.So the duplicate is not a scheduling flake and not a runner race. It is the tag-writing workflow triggering itself exactly once, with the image workflow keyed on the thing that fires twice. That is why the count is consistently two rather than intermittent.
What follows for the fix. Cancelling duplicates is not sufficient by itself: the two runs already overlap by 16 s, which is why one of a pair can fail at
ensure-image: pull …while its sibling publishes. Two properties must hold together:concurrency:group keyed on the resolved tag, plus a registry existence check inside the job that skips whenghcr.io/opencharly/<image>:<tag>already resolves. The group alone serializes but still lets the second run through; the existence check alone is racy across a 16 s overlap. Together they are deterministic.One inference, stated as such. That the two
imageruns correspond one-to-one with the twotag-on-mergecompletions is inferred from the event type, the timestamps and the shared head — I did not read each run'sworkflow_run.id. The check that settles it: one merge where the secondtag-on-mergecompletes after the firstimagerun has finished. If a secondimagerun still appears, the fan-out is on the completion and point 1 is the fix.Verified alongside this on the same merge:
skopeo inspect --no-tags docker://ghcr.io/opencharly/pod-crabbox-k3s:2026.309.0459returnsrc=0anonymously with digestsha256:c50feb9dbfaa91ac09f70ee4f101ac5c58c665e75221f6564d53c36e10f49285, and the git tag isv2026.309.0459— image tag equals git tag, so the W5.2 half holds here.Agent:
containerd-crabbox-program· session8b1c01cf-7f79-4a75-bff8-240415a06208Assisted-by: Claude Code ollama-cloud/deepseek-v4.1-flash (analysed on a live system)