Repository navigation
Description
Category
category:delivery
Type
type:fix
Remedy / files the remedy will touch
candy/plugin-build/ref_reuse.go chooseBuiltRef/decideRef (rule 3 and the newest-by-Created selection), plus a test with two alternating contents in one repository
Cited design decision or org-rulebook rule (or none)
none
Classification
Non-blocking — genuinely separable; left unclaimed for a later session to pick up.
Evidence (verified: commands with output, file:line, measurements)
One fully cached charly box build comfyui-cdi (plugin-build v0.2026335.2349) builds the arch base twice, once under each of two namespace paths. They have different contents, and both publish to the same repository:
25.63 --- arch.arch -> ghcr.io/opencharly/arch:2026.336.0231 (built; image sha256:7d13f2b32b9c084c2db6c89f50daaaeaf79a25aa60abf70ae5bd923375e13d64
30.33 --- arch.arch-builder -> ghcr.io/opencharly/arch-builder:2026.336.0231 (built; image sha256:7c0de9d1c114cb42daf40ddd1a20ab71d0599727ec13d35d
31.63 --- podcdi.arch.arch -> ghcr.io/opencharly/arch:2026.336.0006 (reused; image sha256:f12ffde2659b0423d638ed03db12107cf4f09de3dd24a9f84960f1db
34.16 --- podcdi.arch.arch-builder -> ghcr.io/opencharly/arch-builder:2026.336.0008 (reused; image sha256:9f99d1a5f29dc19cbc7357737c67d4f400b42765
39.28 --- podcdi.pod-cdi -> pod-cdi:2026.336.0231 (built; image sha256:2ec17449582f7406f1047553763cc3f3c4e99d739a24b5442d47777f1511d75a; previous
$ podman images --format "{{.Repository}}:{{.Tag}} {{.ID}}" | grep opencharly/arch:
ghcr.io/opencharly/arch:2026.335.2230-2 b92b27e8472a
ghcr.io/opencharly/arch:2026.335.2342-2 b92b27e8472a
ghcr.io/opencharly/arch:2026.335.2350 e50f19a02020
ghcr.io/opencharly/arch:2026.336.0003 7d13f2b32b9c
ghcr.io/opencharly/arch:2026.336.0006 f12ffde2659b
ghcr.io/opencharly/arch:2026.336.0029 7d13f2b32b9c
ghcr.io/opencharly/arch:2026.336.0231 7d13f2b32b9c
The content 7d13f2b32b9c already existed as :2026.336.0003 and :2026.336.0029. It was reported built again and got a third tag, :2026.336.0231. The other content, f12ffde2659b from podcdi.arch.arch, is reused. The decision is candy/plugin-build/ref_reuse.go chooseBuiltRef (rule 3) via decideRef (ref_reuse.go:199), called from buildkit.go:266.
Mechanism
chooseBuiltRef picks bestRef as the newest local ref of the repository by img.Created, which is a property of the IMAGE, not of the tag. When two namespace paths (arch.arch from the root pin, podcdi.arch.arch from pod-cdi's distro-arch pin) build different contents into ghcr.io/opencharly/arch, the content created later always wins 'newest'. The other content never satisfies rule 3, so every build mints a fresh CalVer for it and reports 'built', even when the identical image already carries two tags.
Missed control
No test covers two contents alternating in one repository. The reuse tests use a single content stream.
Blast radius
Every project whose closure reaches one distro or base box at two pins (the 'resolved to multiple git tags' notices): unbounded tag growth in the engine and the charly image store (61 GB reclaimable on this host), misleading 'built' lines, and charly update's newest-local resolution flipping between the two contents depending on which path built last.
Root fix
Either reuse any local tag that already names the same content (and only then re-point 'newest' semantics), or publish each namespace pin's build to its own ref, so two contents never compete for one repository's newest. Add a test with two alternating contents that asserts a stable tag per content.
Spike (its result, or none with the reason)
none: the decision function is pure, and the mechanism is read directly off its inputs. img.Created for 7d13f2b32b9c predates f12ffde2659b's, so bestRef is always the f12f… tag and rule 3 (sameDigest(bestID, newImageID)) can never hold for 7d13…. The two remedies (reuse by matching content against any local tag vs. one repository per namespace pin) change what charly update's newest-local resolution deploys. That is a decision for the plugin-build owner, so it is not spiked here.
Agent: vol-cdi · Claude Code session 8daa865c-d43e-447b-90b3-7d16ccc921d7
Assisted-by: Claude Code Anthropic Claude Opus 5.5 (analysed on a live system)
Activity