Repository navigation
Description
Category
category:delivery
Type
type:fix
Remedy / files the remedy will touch
the build's base-builder resolution — reuse a pinned/existing builder tag when its content is unchanged instead of minting a new CalVer tag per invocation
Cited design decision or org-rulebook rule (or none)
AGENTS.md R3, R7
Classification
Non-blocking — genuinely separable; left unclaimed for a later session to pick up.
Evidence (verified: commands with output, file:line, measurements)
$ podman images --format '{{.Repository}}:{{.Tag}} {{.CreatedAt}}' | grep arch-builder | sort -k2 | tail -4
ghcr.io/opencharly/arch-builder:2026.330.2011 2026-11-26 20:14:15 UTC
ghcr.io/opencharly/arch-builder:2026.330.2035 2026-11-26 20:37:42 UTC
ghcr.io/opencharly/arch-builder:2026.330.2137 2026-11-26 21:39:27 UTC
ghcr.io/opencharly/arch-builder:2026.330.2152 2026-11-26 21:53:03 UTC
# the openwebui Containerfile's base changed between two identical builds:
build A (contentstaging-2135): FROM ghcr.io/opencharly/arch-builder:2026.330.2035
build B (contentstaging-2135-b, same tree, same candy content): FROM …:2026.330.2152
wall: A 869 s, B 758 s — no layer reuse despite the content-addressed candy staging
Mechanism
Each charly box build that composes the arch-builder produced a NEW arch-builder image tag (four within 100 minutes), and the generated Containerfile's FROM resolves the newest store tag. Two builds of the SAME tree and the SAME candy content therefore used different base images (2035 then 2152), so every downstream layer was invalidated: 869 s and 758 s wall, with no reuse — even after the candy staging dir became content-addressed (verified: .build/_candy/openwebui.3dcd95a9ec44e5eb in both).
Missed control
Nothing asserts that the resolved base image ref is stable across builds of unchanged inputs, and the build summary does not show the base ref it resolved, so the churn is invisible in the logs.
Blast radius
Every image build that composes a builder (all CDI images): the builder stage and everything above it re-execute on every build, which is the dominant cost the pixi cache cannot offset.
Root fix
Resolve the builder to an existing tag whose content matches the current builder inputs (content-addressed or input-hash keyed), or record and reuse the resolved base ref; surface the resolved base ref in the build summary so churn is visible.
Spike (its result, or none with the reason)
Control: the same candy staging dir (content hash unchanged) produced two builds with different FROM refs and no layer reuse — the variable is the base ref, not the candy ref.
Agent: cdi-audit · Claude Code session f760307f-53b4-4f48-87da-00f95e5300ed
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)
Activity
aitrawog commentedon Nov 27, 2026
CLAIM
Taking this. I reproduced the mechanism on this host and the issue's stated cause is only partly right: the per-invocation CalVer is real, but a changed tag alone does NOT invalidate BuildKit's cache (controlled child build with the same bound digest → same manifest, CACHED), and two same-tree builds with a warm cache produced identical image IDs. A cold rebuild of the same tree DID change both digests (
arch3d4f50→0cfb2d,arch-builder6ec0a3→83f8a7), because the base/builder layers runpacman -Syuand fetch yay viareleases/latest.Implementing the agreed option B: always rebuild, and reuse the existing ref only when the freshly built artifact's digest is unchanged (compare the archive's image ID via
buildkitdrive.ImageIDwith the newest local ref for that repo), plus surface the resolved base/builder ref and the reuse/mint decision in the build output. The floating-upstream non-reproducibility is a separate finding I will file RCA-complete. Working in plugin-build first (self-contained), then the charly pin bump + R10 bed.Agent:
jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5· OpenCode sessionses_de3fa473bffeFiBo62whHxDPE5Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)
aitrawog commentedon Nov 27, 2026
STATUS
STATUS — verified RCA (supersedes the issue's stated mechanism)
I reproduced the churn and measured what actually invalidates the cache. The per-invocation CalVer is real, but a changed tag alone does NOT invalidate BuildKit; the layer loss comes from cache eviction + floating upstream inputs.
Verified on this host (binary 2026.330.1332, buildkitd 0.35.1)
1. Tag churn is real. Two
box generate openwebuiruns, same tree, 1 minute apart:diffof the two Containerfiles: only the tag suffix (arch, cachyos, intermediate, arch-builder).--tag probe-1292givesarch:probe-1292+arch-builder:<clock>(borrowed node keeps a clock tag).2. A changed tag with an unchanged digest does NOT invalidate. Controlled buildctl with the drive's own binding shape (
--oci-layout ... --opt context:<ref>=oci-layout://...@<digest>): two children differing only in theARG BASE_IMAGEtag text, bound to the same digest -> same manifest, second run#6 CACHED. A warm-cache rebuild of arch twice (tags 0809/0812) gave identical image IDs (3d4f502d / 6ec0a323).3. A real consumer DOES rebuild, because its parents' digests change. Tiny pixi-composing box, two builds (Containerfile diff = the two tag lines only):
Both builds ~5m; the pixi stage re-ran.
4. What actually re-runs (captured per-step output, which the drive currently discards; #1202). With a
buildctlwrapper in PATH forbox build arch.arch --tag gap-d:Same parent digest (arch config 53f3ea52f802; store payload
sha256:3292800...). The builder's large RUN layers re-executed while the small arch RUN stayed cached - selective cache loss, not the tag. The evicted layers then re-run the floating inputs (below) and produce different bytes, which mints a new digest and a new tag.5. The cache is pruned by BuildKit's own GC default. buildkitd 0.35.1 started with no gc flags and a rendered config with no gc section (
sdk/buildkitdrive/paths.godeliberately leaves GC unset: 'GC is ... UNPROVEN, so it is not invented'). The effective default is:This host has 247 GB free (1.9T at 87%). BuildKit's GC tries to keep the 373 GB free target, so it prunes reclaimable cache toward the 10 GB Reserved floor. Observed:
buildctl dufloors at ~8-10 GB across builds; the hit/miss pattern is 'builds within the window hit, a build after the GC gap misses'. (The GC event itself is not in the default log level; the cache floor + the selective re-execution above are the direct observations.)6. Labels are already at the END, and their position is not the trigger. Generated files:
Controlled test on buildkitd 0.35.1 (real arch base, real store binding): a
LABELwhose value changed, placed top vs end, left theCOPY/RUNlayers CACHED in both positions. So label position does not re-run layers. (A label change does change the image config digest, so a CHILD that builds FROM it sees a new base digest - that is content change, not label placement.) The only tag-bearing top-of-file tokens areARG BASE_IMAGE=<ref>and the builderFROM <ref>:<tag>, and those resolve to a digest (point 2).7. The floating inputs guarantee a re-execution changes the artifact. Generated Containerfiles:
pacman -Syu(arch bootstrap; builder layers for nodejs/toolchain/base-devel - the embedded pac template ischarly/charly/charly.yml:606),task_linux_${ARCH}.tar.gzfrom.../releases/latest(arch bootstrap), yay fromapi.github.com/.../releases/latest(layer-yay;sdk/kit/builder_resolve.go:48alsosudo pacman -Syu+yay -S).Corrected mechanism
-Syu/lateststeps change the bytes.Fix directions (in order of measured impact)
charly.yml(requested by @atrawog). Removes the eviction that makes every cold build re-run.-Syu-> snapshot/pin;latest-> version) so a cold rebuild is reproducible - separate finding.Note on
buildctlvs the Go BuildKit clientThe drive shells out to
buildctlby design (sdk/buildkitdrive): the buildkitd daemon is a separate rootless process charly manages, the CLI is a stable versioned boundary, and importingmoby/buildkit/clientwould put the BuildKit/containerd dependency surface intosdkand every plugin binary. The daemon's GC is a daemon config concern, so the Go client would not change point 5. The CLI's captured output is currently discarded on success (#1202) - that is the real cost, and the per-step capture above is the evidence it should be surfaced.Next: the GC default +
charly.ymlconfigurability, then the tag reuse, with the R10 bed on a disposable target.Agent:
jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5· OpenCode sessionses_de3fa473bffeFiBo62whHxDPE5Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)
aitrawog commentedon Nov 27, 2026
STATUS
STATUS — GC/config implementation opened; the cache trigger is confirmed
Implementation of the measured fix is in flight (producer-first):
sdk/buildkitdrive: an explicit 100 GB GC budget by default (reservedSpace=100GB,maxUsedSpace=100GB,minFreeSpace=10GB) plus the full[worker.oci]daemon surface onDaemonOptions(process mode, max-parallelism, snapshotter, noProcessSandbox, gcpolicy entries, registry mirror, rawextraTOML). Module CI green (build/vet/gofmt/full test). The rendered config was validated against a throwaway buildkitd 0.35.1: the daemon started and answereddebug workers, so the new GC keys parse.#Buildkit(defaults.buildkit) +#BuildResolveReply.buildkit, generated with the in-process schemagen;TestGenReproduciblegreen.feat/buildkit-daemon-config(local commit f478cb2): resolve carriesdefaults.buildkitinto the reply, the drive maps it ontoDaemonOptionswith the stage-parallelism/env fallbacks. Unit tests green; its PR opens after the sdk/spec tags (producer-first).A running buildkitd keeps the policy it started with;
Ensurenow reports the mismatch on stderr and never fails the build, so applying the budget is a daemon restart (and it is written for the next start).Filed: #1300 — the charly workspace cannot build against spec main because spec#446 removed the Android/apk types while charly's go.mod still pins the pre-removal plugin/spec releases. This blocks the charly pin-bump + R10 bed leg of this wave; the producer PRs are unaffected.
Still owed: the plugin-build PR (after the tags), the charly pin bump + the bed (two builds with a daemon restart and a gap, asserting the cache persists), and the tag-reuse (option B) leg.
Label position — tested, and it is not the trigger
The generated Containerfiles already emit every LABEL at the END (arch: first LABEL line 38 vs last RUN/COPY 34; arch-builder 115 vs 111; cachyos 61 vs 57). A controlled test on buildkitd 0.35.1 with the real arch base and the real store binding — change a LABEL value with the LABEL at the TOP vs the END — left the
COPY/RUNlayers CACHED in both positions. The only tag-bearing top-of-file tokens areARG BASE_IMAGEand the builderFROM <ref>:<tag>, and a changed tag bound to the same digest was CACHED too. The invalidation comes from the cache eviction (default GC free target 373 GB > 247 GB free) + the floating-Syu/lateststeps, as measured above.buildctlvs the Go BuildKit clientIt is a deliberate thin-contract choice (
sdk/buildkitdrive): the buildkitd daemon is a separate rootless process charly manages, the CLI is a versioned boundary, and importingmoby/buildkit/clientwould pull the BuildKit/containerd dependency surface intosdkand every plugin binary. The daemon GC is a daemon-config concern, so the Go client would not have changed the pruning. The real cost of the CLI shape is that the per-step output is captured and discarded on success (#1202) — the captured CACHED/DONE lines above are exactly what that hides.Agent:
jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5· OpenCode sessionses_de3fa473bffeFiBo62whHxDPE5Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)
aitrawog commentedon Nov 27, 2026
STATUS
STATUS — three producer PRs open; option B proven live
[worker.oci]daemon surface onDaemonOptions(module CI green; the rendered config starts buildkitd 0.35.1 and answersdebug workers).#Buildkit(defaults.buildkit) +#BuildResolveReply.buildkit(schemagen +TestGenReproduciblegreen).base=<ref> builders=<refs>and thereused|builtdecision. Child Containerfiles are rewritten with the published refs.Live proof of B (charly binary built against the branch; minimal external-base probe, two back-to-back builds, both fully CACHED):
No new tag on the second build; the child's base ref was substituted to the reused one. Two defects were found by that spike and fixed:
LocalImageInfo.IDis bare hex vsImageID'ssha256:prefix, andplugin-boxalways sends a computed CalVer so an explicit--tagis only distinguishable by the tag grammar.Still owed: the plugin-build daemon-config PR (local commit f478cb2) opens after sdk#650 + spec#447 merge/tag; then the charly pin bump + the R10 bed (two builds with a daemon restart and a gap), which #1300 currently blocks for a workspace build against spec main.
A watcher is armed over the three PRs.
Agent:
jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5· OpenCode sessionses_de3fa473bffeFiBo62whHxDPE5Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)
aitrawog commentedon Nov 27, 2026
WAITING
The remaining legs of this wave are blocked on two producer PRs, which are the blocking side:
HOLDINGthere naming this issue andopencharly/spec#447.#Buildkit/defaults.buildkit+#BuildResolveReply.buildkit.What waits on them here: the
opencharly/plugin-builddaemon-config PR (local commitf478cb2, which mapsdefaults.buildkitontobuildkitdrive.DaemonOptions) opens once both merge and tag, because it consumes their shapes; then theopencharly/charlypin bump + the R10 bed (two builds across a daemon restart with a gap, asserting the cache and refs persist).NOT blocked, and already open:
opencharly/plugin-build#70— the ref-reuse change (option B) is independent of both producer PRs and is being reviewed on its own thread.Agent:
jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5· OpenCode sessionses_de3fa473bffeFiBo62whHxDPE5Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)
feat(schema): add defaults.buildkit, the buildkitd daemon settings (#447
feat(build): reuse an unchanged build's ref instead of minting a new …
aitrawog commentedon Nov 27, 2026
STATUS
STATUS — wave state after the first merges, and one real defect the validator caught.
Merged and tagged
8306efb, Go tagcandy/plugin-build/v0.2026331.1306.#Buildkit,defaults.buildkit,#BuildResolveReply.buildkit) — merged, Go tagv0.2026331.1221.Auto-closed, continued cleanly
keepStoragewhile buildkitd's legacy worker key is all-lowercasegckeepstorage, so the guard could never fire. Fixed and re-cut as feat(buildkitdrive): a 100 GB GC budget by default, and every daemon setting configurable sdk#653 on a fresh branch off currentorigin/main(one squash, full module gate green), with the red arm pasted (gckeepstorage = "10GB"injected → FAIL). batch: bed steps under concurrent-host load — the never-hang ceiling kills legitimately-slow probes (status fan-out, cold box pull) and resolution stalls #650 carriesRESOLVED — superseded by #653.Filed, not fixed
pacman -Syuandreleases/latestmake an unchanged tree build different bytes sdk#652 — the bootstrap step is not reproducible: the pac template runs an unpinnedpacman -Syuanddeploykit/bootstrap.gofetches go-task fromreleases/latest. Measured: one unchanged probe tree produced three different image config digests (2289e7b3,4a96c580,7e4752f4). This is why an unchanged tree still builds different bytes even after the tag-churn fix.check-tmux-pod'stmux-roundtriphas notimeout:(linked to its umbrellacharly#650).podman pullruns unconditionally.Not repinned —
charlystill pins plugin-buildv0.2026328.1, sdkv0.2026328.1805, specv0.2026329.803; no pin-bump PR exists, so no shipped binary has any of this. Remaining order: #653 merges+tags → plugin-build daemon-config PR (branch rebased onto the merged #70 main, local) → one coherent charly pin advance (including #1300's plugin pins) → consumer bed (two builds across a daemon restart).Agent:
jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5· OpenCode sessionses_de3fa473bffeFiBo62whHxDPE5Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)
feat(buildkitdrive): a 100 GB GC budget by default, and every daemon …
feat(build): render defaults.buildkit into the buildkitd daemon setti…
chore(deps): adopt sdk v0.2026331.1440, spec v0.2026331.1553, plugin-…
aitrawog commentedon Nov 28, 2026
RESOLVED — the wave landed, producer-first, and the consumer pins it.
Producer legs merged and tagged
candy/plugin-build/v0.2026331.1306-2/-3)v0.2026331.1440reservedSpace/maxUsedSpace100 GB,minFreeSpace10 GB), full[worker.oci]/gcpolicy surface,GCConfigMismatchseamv0.2026331.1221/v0.2026331.1553#Buildkit+defaults.buildkittyped in#NodeDoc;mergeBoxConfigcarries it through the walk→materialize mergev0.2026331.1456defaults.buildkitreachesDaemonOptions; daemon-config render testConsumer — #1307 merged (
7f89ab36), andmaincarries the result (verified today):Measured behaviour, not just pins
sha256digest per invocation (2289e7b3…then4a96c580…).Total 1.19GBafter the restart and the next build hit it.defaults.buildkitreaches the daemon: a project authoringmax_parallelism: 2, reserved_space: 50GB, max_used_space: 60GB, min_free_space: 7GBproduced exactly those lines inbuildkitd.toml(before the loader fix:4and100/100/10).Filed from the wave, still open by design
Every other finding the wave surfaced is closed: #1300, #1306, #1308, #1309 (this session), distro-arch#84/#75, sdk#655.
Agent:
jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5· OpenCode sessionses_de3fa473bffeFiBo62whHxDPE5Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)