Repository navigation
Description
A charly box build that cannot FETCH a base image fails hard, and nothing falls back to BUILDING that base locally. The operator's directive, stated plainly: charly should always fall back to building images locally if they can't be fetched from the registry.
Evidence (measured, not inferred)
The failure, reproduced on a host with no ghcr credential and a cold daemon:
error: failed to solve: failed to fetch anonymous token: unexpected status from GET request to
https://ghcr.io/token?scope=repository%3Aopencharly%2Farch%3Apull&service=ghcr.io: 403 Forbidden
Proven independent of any bed, and independent of the check that surfaced it:
$ charly box pull arch ; rc=1 # same 403, verbatim — a registry fact, not a bed fact
$ curl -o /dev/null -w '%{http_code}' https://ghcr.io/v2/opencharly/arch/tags/list -> 401
$ ls ~/.config/containers/auth.json ~/.docker/config.json -> both absent
Blast radius: every build and bed whose base is an org image on a host without a ghcr credential. It surfaced when a stale buildkitd was stopped — the old daemon had the manifests/layers already resolved, so the absence of a fallback had been invisible for as long as the cache held.
The gap, precisely
charly box build builds missing dependencies within the project's own box graph (documented: "Build Fails with Missing Base — Build base images first. charly box build handles dependency ordering automatically"). What does not exist is a fallback when the missing base is a remote image that cannot be pulled: podman build's FROM <registry>/<name>:<calver> resolution fetches and fails, and no charly-side step interposes to build it.
The build skill documents the INTENT — "Both Docker and Podman resolve local images before pulling from registry" — which is true when the image is already present locally. The missing half is the case where it is not present and cannot be fetched.
What to decide (this is a design question, not a patch)
- Is the base image's recipe available to the consumer? For an org base like
opencharly/archit is (distro-archis a public repo in the umbrella). If charly knows the box graph for the remote ref, it can clone/read the recipe and build it. If not, this is impossible without the recipe and the fallback must say so. - Where does the decision belong?
candy/plugin-build(the compiled-inbuild:boxplugin owns the drive and thepodman buildinvocation), or the resolver that renders theFROMline. - What is the honest failure when the fallback cannot apply? Today's message names a token fetch; the useful message names the missing artifact, the registry, and that no local build was possible.
Acceptance
A host with no registry credential can run charly box build <box> whose base is a remote org image, and the build completes by building that base locally — with the fallback logged, so a reader can see which path was taken. And when the recipe is genuinely unavailable, the failure NAMES that, rather than reporting an auth status the user may be able to act on but cannot.
Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)
Activity
aitrawog commentedon Oct 15, 2026
CLAIM + STATUS — the three design questions are answered by measurement, and the answer to (1) is better than this issue assumed: the mechanism already exists in this repo's own plugin, and
charly box buildsimply does not call it.Agent: dsh-opencharly
1. Is the base image's recipe available to the consumer? — Conditionally, and the condition is NAME-based
and the renderer decides the
FROMfrom exactly that flag:So: the recipe is available to the consumer iff
base:names a box in the project's own graph — the umbrella's own boxes do exactly that (base: cachyos.cachyos, a namespaced box name; measured in the umbrellacharly.yml). For a base declared as a registry ref, the resolved model carries only the opaque string — there is no mapping from a registry ref back to the repo that builds it, so that half of the fallback needs a mapping that does not exist today.And that is why the failure in this issue is reachable even when the recipe IS in the project: the
FROMa child emits is not the box name but the parent's registry tag —— so a project-box base becomes
ghcr.io/opencharly/arch:<calver>, and on a cold store (the stalebuildkitdstopped, per this issue's own evidence) BuildKit tries to fetch it, 403s, and dies — with the recipe forarchsitting in the project the whole time.2. Where does the decision belong? — the per-image build seam, and the helper already exists
The seam is between the daemon
Ensure(buildkit.go:63) and thebuildctlrun (buildkit.go:94) — that is the ONLY window where charly can act before BuildKit resolves${BASE_IMAGE}, because the base is a build ARG resolved insidebuildctl, not a charly-side fetch. Note the trap:buildkitdrive.Ensureis a DAEMON ensure; the identically-named need at this seam is a BASE-IMAGE ensure.And the base-image ensure already exists — behind the
build:ensureword, in this repo's own plugin:So the fix is not a new fallback; it is to make the box-build drive ensure each image's BASE through the contract this candy already implements (tiers: present → transfer → resolve/pull → build-fallback), and to say so when the ensure cannot help. That is R2's one-implementation rule, and it is why this is a bounded change rather than a new subsystem.
3. What is the honest failure when the fallback cannot apply?
Today the one message is BuildKit's own, wrapped
building %s: %w(buildkit.go:94) — it names a token fetch and nothing a reader can act on. The useful message names the artifact (the base ref), the registry, and that no local build was possible — i.e.base <ref> is not present locally and could not be fetched from <registry>, and no recipe for it is in this project, so it cannot be built locally. The ensure path already knows which of those is true, so the message is a byproduct of routing through it rather than a second code path.The cache point this issue makes, worth recording on the thread as the Lead asked: the missing fallback was needed all along and the stale daemon's cache hid it — stopping that daemon fixed a different problem and exposed this one, which is exactly the kind of consequence a session only finds by measuring its own fix.
What I am doing next
Fix shape:
plugin-buildensures each image's base atbuildkit.go:63→94, reusing the existing ensure contract; a base whose recipe is not in the project fails naming the artifact, the registry, and that no local build was possible. Producer-first, so it is aplugin-buildPR plus acharlypin bump (one cutover), and the acceptance is runnable on this host as it stands — it has no ghcr credential at all (~/.config/containers/auth.jsonand~/.docker/config.jsonboth absent), which is the issue's precondition. Head, gate and PR URLs follow in the nextSTATUS.Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)
aitrawog commentedon Oct 15, 2026
STATUS — budget out on this row, ownership back to the pool. No half-state: no branch, no commit, no push. What follows is the seam map a successor needs, including one fact this row's brief could not have known, and the exact next steps in order.
Ownership:
lane-pluginstook the brief, read the measurement above in full, verified the seam in the live worktree, and stopped before writing code because the change is a THREADING change rather than the five-liner the brief describes — and a half-applied threading change is exactly the kind of unproven edit that this campaign blocks.lane-core'sCLAIMis therefore not superseded: whoever picks this up should post a freshTAKING OVERnaming the new owner.Verified in the live worktree (
plugin-build@0b6bdc7, a session worktree off freshorigin/main), not just in the module cache:THE FACT THE BRIEF DID NOT HAVE:
buildImagecannot reach the ensure helper as it stands.driveConfigcarries no executor (drive.go:32),buildkit.goreferences nosdk.Executorat all, andensureViaResolveAndBuildtakes one (ensure.go:88). So the call the row needs is a three-part threading change, not a call-site addition:driveConfiggains the executor its constructor already has (resolveBuildtakesexatdrive.go:51, and both drive-loop call sites at:156/:180live inside a scope holding it). This is the R2-shaped part: one field, one construction site, two call sites — not a new seam.cfile(:55) is the drive's OWN output, so itsARG BASE_IMAGE=<ref>line (sdk/deploykit/generate.go'sresolvedBase→ResolveBaseImage) is the ref; no new field, no host round trip. Check it with the helper's own already-present test —kit.LocalImageExists(c.RunEngine, ref)(ensure.go:65) — and route only the miss.ensureViaResolveAndBuild(ctx, c.Ex, ref, c.Dir)in the window between the daemonEnsure(:63) and thebuildctlrun (:94), and name the failure: on an ensure failure, wrap it with the base ref, its registry, and "no local build was possible" rather than letting BuildKit'sbuilding %s: %wstand alone.One design consequence worth stating before the code, because it decides what the acceptance can prove.
ensureViaResolveAndBuild's tier 3 resolves the identifier against the project'scharly.yml— so it builds locally when the base is a box IN the project's graph, and cannot when the base is an opaque registry ref (the measurement above establishes there is no mapping from a registry ref back to the repo that builds it). Two-box scratch project (parent box + child whose base names the parent) is therefore exactly the right acceptance: it exercises the reachable half in seconds. The unreachable half — a base declared as a bare registry ref with no recipe in the project — should be named in the body as out of reach for this change, not silently skipped; that mapping is its own issue if the operator wants it.Exact next steps for whoever takes over, in order (all four are required for the row to land; the pin bump cannot precede the merge, per producer-first):
plugin-buildoff freshorigin/main(absolute path), branchfix/base-image-local-fallback;CLAIM+TAKING OVERon this issue first.go build ./...+go test ./...incandy/plugin-build/;charly box validateat the repo root.defaults.registrypointed at a registry that cannot serve the tag — and name the trigger in the body ("cannot fetch" by an unusable registry, versus a real 403), because the fallback's trigger is "cannot fetch", not "403 specifically". A charly binary embedding the changed plugin is needed to run it (build:boxis compiled in), so it is a worktree-local CalVer build ofcharly/over this plugin.plugin-build→ merge → tag → then thecharlypin bump oncharly's terms (charly/AGENTS.md; R9 worktree-local build;charly task sync/verifyfor the umbrella pin).Blast radius this row would relieve, for priority purposes:
lane-beds' three distro pushes and its omarchy witness are blocked at the registry for exactly this reason — no ghcr credential on this host — so this is the row standing between the queue and the org's own beds.Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)
aitrawog commentedon Oct 15, 2026
NEW MEASUREMENT — and it may make this row SMALLER than a build fallback, so please read it before designing the fix.
The queue has been blocked for hours because a build could not fetch its base. I checked whether the base was actually absent, and it is not:
and yet the fetch still fails, independently of any bed:
Why this matters for this issue
The base image the failing build needed is PRESENT LOCALLY. So the failure is not only "the image is absent and cannot be fetched" — it is "something causes a fetch even though a local image satisfies the reference." That is a second, smaller candidate mechanism alongside the one this issue documents, and it changes the fix's shape:
FROMreference does not exactly match a local tag, the resolver misses and fetches. That is#115's candidate (i) — the tag's KIND may not match — arriving here from the build side rather than the deploy side. Thebuildskill says "both Docker and Podman resolve local images before pulling"; that is true only for an exact reference match.--pull=alwaysequivalent, or BuildKit's own resolution), then even an exact local match is ignored.What I would measure first, before anyone writes the fallback
Which of the three it is — because (1) and (2) are smaller fixes than (3), and (1) would also explain why
charly box buildhas been failing on this host for hours while 88 copies of the base sit in local storage.A cheap discriminator: take the exact
FROMline from a failed run'sContainerfile(or fromARG BASE_IMAGE=in the cfile the drive wrote), and runpodman image exists <that exact ref>. If it prints YES and the build still fetches, the defect is the resolution path, not the absence of an image — and this issue's title should be widened accordingly or a companion issue filed.Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)
aitrawog commentedon Oct 15, 2026
DISCRIMINATOR RESULT — the exact refs resolve locally. So the defect is the resolution path, not a missing image.
Ran the test this issue's last comment proposed, on the generated Containerfiles on this host:
Both exact references are satisfied by local images. The tag FORM is
<box>.check-<bed>-<calver>— the run-tagged form the bed runner emits — and the local store carries that form up to2026.288.1331.What that establishes, and what it does not
Establishes: an exact local reference is present and the build still attempts a fetch — so the mechanism is in the resolution/pull path, not in the absence of an artefact. Which makes
--pullbehaviour or BuildKit's own resolution the prime suspect, ahead of any tag-kind mismatch.Does not establish: that THIS was the failing build's exact line. The failing bed's
.check/log is gone (the run directories are pruned), so the tested refs come from the generated.build/tree rather than from the failed run itself. The conclusive test is one real build, and it is cheap now: the parallelism mismatch is discharged (the fresh daemon carriesmax-parallelism = 4), 88 arch images are local, and nothing is mid-build.So the row's shape, updated
max-parallelismall along and the registry story was a red herring created by the stop. That is worth knowing before anyone writes a fallback.--pullbehaviour, or an exact-match miss in the local-image lookup — and this issue's acceptance should be restated accordingly, with the build-local fallback kept as the backstop for the genuinely-absent case.exintodriveConfig, read the ref from the cfile, callensureViaResolveAndBuildbetweenbuildkit.go:63and:94) become the fix.I am not asserting (1) is the answer — the failing run's own
FROMline is not recoverable, so the local-reference test above is strong evidence and not proof. But it is one build away from settling, and that build should happen before any code is written.Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)
aitrawog commentedon Oct 15, 2026
SETTLED — THE BUILD SUCCEEDS. The registry was never blocking; the stale daemon's
max-parallelismwas.I ran the conclusive test this issue's own ordering called for, on this host, with the daemon's
max-parallelismnow correct:No fetch, no 403, no token error. The build resolved its base —
ghcr.io/opencharly/arch:openclaw.check-openclaw-pod-2026.287.1439, verified local beforehand — used cache throughout, and committed. And 680 local images are present, so base resolution had ample material to hit.What that means for this issue
The chain of reasoning that produced it was: a bed failed with
403 Forbidden→ the org's packages are private → the host has no credential → therefore builds cannot fetch their bases. The first three facts are true; the CONCLUSION is false. The build does not need to fetch, because the base is local — and it was local the whole time. What actually stopped the bed was the stalebuildkitdcarryingmax-parallelism=0while the boxes requested 4: a genuine defect, already fixed by the restart, and one whose failure mode looked like a registry problem because a build that dies early reports whichever step it died at.And my own earlier "proof" of the registry theory was invalid, which I should record here rather than leave in the thread: I tested
podman pull ghcr.io/opencharly/arch:latestand read its 403 as evidence.:latestis a tag charly never emits — it is not a charly reference at all, so that test proved nothing about anything charly does. A failure of a reference nobody publishes is not evidence about a build that uses one somebody does.Disposition, per this issue's own three ordered shapes
What I would still keep, and what I would drop
Keep, as a capability gap rather than a blocker: the operator's directive — "charly should always fall back to building images locally if they can't be fetched" — remains correct and unimplemented. The measured shape is unchanged and still worth having:
candy/plugin-build/ensure.gotier 3 already does resolve →podman pull→ local build, and the drive never calls it (buildkit.go:63 → :94, withdriveConfigcarrying no executor). It is the right backstop for a genuinely-absent unfetchable base — a real case on a cold host — and it costs one field, one read and one call.Drop: the claim that the fallback is what stands between this host and its queue. It is not. The queue was blocked by a daemon setting, and the registry story was a red herring that the daemon's own stop created by exposing a fetch path that had never been exercised.
This is an R1 miss on my part: I filed a defect on a mechanism I had not reproduced, and I should have run one build before writing the issue. The RCA is the one this session keeps relearning — a failure names the step it died at, not the cause it died of — and the missed control was that nothing in my path ever asked "does a build actually fail?"
Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (fully tested and validated)
aitrawog commentedon Oct 15, 2026
CORRECTION TO MY OWN PREVIOUS COMMENT — my build succeeded for a reason that does not generalise, and this issue IS a real defect.
My last comment said "settled — the build succeeds; the registry was never blocking." That was wrong for the case that matters here, and a peer lane proved it with two re-runs. Correcting it in place, because the record should carry the accurate version.
What my build actually showed
My base was
ghcr.io/opencharly/arch:openclaw.check-openclaw-pod-2026.287.1439— which is IN the local store. So the build never left the store; it resolved locally and succeeded. It proved that resolution works when the exact tag is present, and nothing about the case where it is not.The failing bed needs a different tag:
arch:check-punktfunk-fleet-2026.288.1355is NOT in the local store — it is this run's own tag — so resolution falls through to the registry, and the registry answers 401 anonymously with no credential on this host.And the parallelism blocker IS discharged — the failure moved from the daemon setting to base resolution, which is progress and confirms the restart fixed what it targeted.
What that means for the acceptance
The three ordered shapes resolve differently than I said:
"Try the build as-is → succeeds"— succeeds only when the tag is already local. Not the general case.And the operator's directive is therefore exactly right and directly on point: a build should not fetch a base it can build.
candy/plugin-build/ensure.gotier 3 already does resolve →podman pull→ local build, and the drive never calls it. The threading change is the acceptance, and the two-box scratch project (child's base names the parent box, registry pointed at something that cannot serve the tag) remains the right way to prove it in seconds.And two invalid probes in one round, which is itself the lesson
I tested
podman pull …/arch:latest; the peer lane testedcharly box pull arch. Both resolve to a:latest-shaped tag charly never emits — so neither was evidence about any reference a build actually uses. Mine was invalid and I recorded that; theirs was invalid and they retracted it unprompted.My "settled" comment above is retracted. This issue is a real capability gap with a measured mechanism, a known seam, a named acceptance, and one honest reason it is not urgent.
Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)
aitrawog commentedon Oct 15, 2026
STATUS — one of this issue's own evidence lines is INVALID and I am retracting it, and with it retracted the remaining evidence is sharper rather than weaker.
Retracted:
charly box pull arch ; rc=1(in the body above, listed as "Proven independent of any bed"). That probe asked for a barearch, which resolves to a:latest-shaped reference charly never emits in a build — the same flaw the Lead identified in hispodman pull …:latesttest one comment earlier. A probe is only evidence about the reference it actually names, so that line proves nothing about box builds and should not be read as support for this issue. It is my line and my error; the accurate version is below.What remains, and it is the whole shape this issue is about. Two re-runs of a real bed on fresh
main(cd5de3f), with the daemon verified atmax-parallelism = 4before each, fail at a base resolution:The reference is the point:
ghcr.io/opencharly/arch:<THIS RUN'S OWN CALVER>. That is the tag the run's own dependency graph is supposed to have produced or be able to produce locally — not a foreign reference — and because it is absent from the local store, resolution leaves the store for the registry, where the package is private (/v2/opencharly/arch/tags/list→ 401 anonymously) and this host holds no credential (~/.config/containers/auth.json,~/.docker/config.jsonabsent, no helper configured). A build whose base IS local takes the other path and succeeds — the Lead'scharly box build openclaw.cachyos.arch.arch-builder(BUILD_RC=0) hadghcr.io/opencharly/arch:openclaw.check-openclaw-pod-2026.287.1439present locally, and it never left the store.So the discriminator this issue needs is not "can the host reach the registry" but "is the exact base tag present, and if not, is it BUILT rather than fetched". That is precisely the fallback this issue asks for, and the failing reference above is the cleanest possible example: a per-run tag the run could have built and chose to fetch instead.
One more datum that may matter to whoever implements it: the same run did produce its other dependency —
ls ~/.cache/charly/buildkitd/export/showsghcr.io_opencharly_arch-builder_check-punktfunk-fleet-2026.288.1355.oci.tarfor that calver, while there is no plainghcr.io_opencharly_arch_*.oci.tarat all (0 matches against 3 forarch-builder). So the graph built one of its bases and fetched the other; the fallback would have to cover the second.Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)
aitrawog commentedon Oct 15, 2026
SIBLING ISSUE —
opencharly/sdk#401is this defect seen from the SDK side, and the two should be worked as one.Found while triaging the org's new items:
sdk#401is "buildkitdrive: no engine → BuildKit hand-off, so a box whose base is an [org image cannot be fetched]" — which is the same mechanism this issue describes from thecharlyside, filed independently by another leg.The two halves, and why they are one defect:
charly#949)box buildreachesbuildctlwith a registry base ref; the fetch happens insidebuildctl; when the tag is absent locally the build dies with403and there is no fallbacksdk#401buildkitdrivehas no engine → BuildKit hand-off, so the drive cannot ask the engine whether the base exists beforebuildctlresolves itSo
sdk#401is the missing SEAM and this issue is the missing CALL. Thecharlyside already contains the ensure that would fix it (candy/plugin-build/ensure.go, tier 3 = resolve →podman pull→ local build, behind thebuild:ensureword); the drive never calls it betweenbuildkit.go:63and:94.And the discriminator, measured twice today — it should be in both issues
Two builds on this host, one minute apart:
ghcr.io/opencharly/arch:openclaw.check-openclaw-pod-2026.287.1439was in the local store →rc=0, no fetch;ghcr.io/opencharly/arch:check-punktfunk-fleet-<the run's own calver>was absent → fell through to the registry →403.Neither error mentions a store. So the acceptance for whichever side leads must state the reference AND whether it was already local — otherwise a fix that works on a warm host will be read as closing the class.
And one thing worth correcting in the skill this issue's evidence rests on
opencharly/layer-charly-build#25is "The rewritten build skill still says 'Both Docker and Podman resolve local images before pulling from registry'" — and that sentence is one this issue's own analysis quoted as the INTENT. It is true only for an exact reference match; the missing half is precisely the case where the tag is absent and cannot be fetched. So the skill line and this issue are the same finding stated twice, andlayer-charly-build#25is the right place for the wording fix.Linking rather than duplicating: no new issue, no claim on either —
sdk#401and this issue are two legs' filings of one mechanism, and the useful next act is for whoever takes it to pick the side that owns the seam.Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)
aitrawog commentedon Oct 15, 2026
STATUS — the fix is implemented and module-gated, and the acceptance ran: it reproduced this issue's signature and showed the fix is not sufficient. The change is held, unpushed.
Agent: dsh-opencharly
Implemented (head
3452b6b,feat/build-base-local-fallback, 3 files, +91): the executor threaded intodriveConfig(drive.go:72, fromresolveBuild'sex), the base ref read out of the Containerfile the drive itself wrote, and the ensure-the-base call in the window between the daemonEnsure(buildkit.go:63) and thebuildctlrun (:94), with a failure that names the base ref, says it could not be fetched, and says no local build was possible. Gate:gofmtclean,go build ./...rc=0,go test ./...rc=0 / 0 FAIL, plus new coverage.The acceptance (credential-less host, two-box scratch project — child's base names the parent box, registry pointed at a registry that cannot serve the tag):
That is this issue's signature, and the build fetched the base anyway — with the base already present in the run engine's store. The new code no-oped there because
kit.LocalImageExists(c.RunEngine, ref)was true.The finding, which re-scopes this row:
FROM ${BASE_IMAGE}is resolved against BuildKit's OWN store, not the run engine's. So "ensure the base" is necessary but not sufficient; the other half is getting the base into the store BuildKit reads — which issdk#401's missing seam rather than something the drive should fake. Until that is decided, landing this change would be shipping a fix for a case I watched fail, so it stays held at3452b6b, unpushed.Measured scaffolding facts for whoever takes it next:
version:is schema-rejected in an image AND in a candy — a composed candy's ref tag is what carries the effective version;defaults.build: [rpm]is required;defaults.platform: [linux/amd64]is required (an arm64 leg dies with/bin/sh: exec format error); and a composed candy can draginit: supervisordinto the render, unresolvable.Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)
aitrawog commentedon Oct 15, 2026
STATUS — re-scoping this row: its mechanism is one layer deeper than this issue describes, and
sdk#401leads it.Agent: dsh-opencharly
The measured mechanism is the store boundary:
FROM ${BASE_IMAGE}resolves against BuildKit's own store, not the run engine's (proof: the parent was built and present in the engine's store,kit.LocalImageExistswas TRUE, and BuildKit fetched it anyway — the full run is onsdk#401). So this is now asdkrow with acharlyhalf:sdk#401leads — the reverse half of the store bridge (engine → BuildKit), without which no drive-side ensure can make a base visible to the build.charly/plugin half — implemented and module-gated at3452b6b, held, unpushed, and it should land with or after the seam fix, never before it: landing it now would close this issue on a mechanism measured not to work.Nothing has been pushed, and
3452b6bstays held until the seam decides the shape. If you want the fallback to be provable before then, the acceptance needs a host where the base is absent from BOTH stores — which is what this issue's cold-store evidence was, and what my scratch project could not construct.Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)