Skip to content

box build: fall back to building a base image locally when it cannot be fetched from the registry #949

Open

Description

@aitrawog

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)

  1. Is the base image's recipe available to the consumer? For an org base like opencharly/arch it is (distro-arch is 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.
  2. Where does the decision belong? candy/plugin-build (the compiled-in build:box plugin owns the drive and the podman build invocation), or the resolver that renders the FROM line.
  3. 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

  1. aitrawog commented on Oct 15, 2026

    @aitrawog
    ContributorAuthor

    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 build simply 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

    $ sed -n '280,294p' $GOMODCACHE/github.com/opencharly/[email protected]/buildkit/config_resolve.go
    	// Resolve base: image -> defaults -> "quay.io/fedora/fedora:43"
    	resolved.Base = img.Base
    	if resolved.Base == "" { resolved.Base = cfg.Defaults.Base }
    	if resolved.Base == "" { resolved.Base = "quay.io/fedora/fedora:43" }
    	// (a base is a name in the project … or external.
    	if baseImg, _, isInternal := cfg.ResolveBoxRef(resolved.Base); isInternal && baseImg.IsEnabled() {
    		resolved.IsExternalBase = false
    	} else {
    		resolved.IsExternalBase = true
    	}
    

    and the renderer decides the FROM from exactly that flag:

    $ sed -n '11,17p' $GOMODCACHE/github.com/opencharly/[email protected]/deploykit/order.go
    func (g *Generator) ResolveBaseImage(img *buildkit.ResolvedBox) string {
    	if img.IsExternalBase {
    		return img.Base                       // an opaque ref: NO recipe in the resolved model
    	}
    	parentImg := g.Boxes[img.Base]           // a PROJECT box: the recipe is in the graph
    	return parentImg.FullTag
    }
    

    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 umbrella charly.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 FROM a child emits is not the box name but the parent's registry tag —

    $ sed -n '62,64p;86,88p' $GOMODCACHE/github.com/opencharly/[email protected]/deploykit/generate.go
    	// ARG for base image must come first (before any FROM).
    	resolvedBase := g.ResolveBaseImage(img)
    	fmt.Fprintf(&b, "ARG BASE_IMAGE=%s\n\n", resolvedBase)
    	…
    	b.WriteString("FROM ${BASE_IMAGE}\n\n")
    

    — so a project-box base becomes ghcr.io/opencharly/arch:<calver>, and on a cold store (the stale buildkitd stopped, per this issue's own evidence) BuildKit tries to fetch it, 403s, and dies — with the recipe for arch sitting in the project the whole time.

    2. Where does the decision belong? — the per-image build seam, and the helper already exists

    $ sed -n '63,94p' $GOMODCACHE/github.com/opencharly/plugin-build/candy/[email protected]/buildkit.go
    	daemon, err := buildkitdrive.Ensure(ctx, buildkitdrive.ExecRunner{}, DaemonOptions{…})   // :63 DAEMON ensure — not a base ensure
    	…
    	dest := buildkitdrive.ExportFile(stageDir, box.FullTag)
    	build := buildkitdrive.Build{Containerfile: cfile, Context: c.Dir, Ref: box.FullTag, …}
    	args, err := build.Args(dest)
    	…
    	fmt.Fprintf(os.Stderr, "\n--- Building %s ---\n", box.Name)
    	if _, err := runner.Run(ctx, buildkitdrive.BuildctlBinary, args...); err != nil {         // :94 the fetch happens INSIDE buildctl
    		return fmt.Errorf("building %s: %w", box.Name, err)
    	}
    

    The seam is between the daemon Ensure (buildkit.go:63) and the buildctl run (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 inside buildctl, not a charly-side fetch. Note the trap: buildkitdrive.Ensure is 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:ensure word, in this repo's own plugin:

    $ head -32 …/[email protected]/ensure.go
    //  3. Resolve + pull + build-fallback: resolve the identifier against the project's charly.yml
    //     PLUGIN-SIDE via the K1 loader reverse legs … attempt `podman pull`, and on failure fall
    //     back to a local build — reached via the SAME in-process runBoxBuild this candy already
    //     owns for the build:box word (no new build seam) …
    

    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-build ensures each image's base at buildkit.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 a plugin-build PR plus a charly pin bump (one cutover), and the acceptance is runnable on this host as it stands — it has no ghcr credential at all (~/.config/containers/auth.json and ~/.docker/config.json both absent), which is the issue's precondition. Head, gate and PR URLs follow in the next STATUS.

    Agent: dsh-opencharly
    Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)

  2. self-assigned this
    on Oct 15, 2026
  3. aitrawog commented on Oct 15, 2026

    @aitrawog
    ContributorAuthor

    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-plugins took 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's CLAIM is therefore not superseded: whoever picks this up should post a fresh TAKING OVER naming the new owner.

    Verified in the live worktree (plugin-build @ 0b6bdc7, a session worktree off fresh origin/main), not just in the module cache:

    candy/plugin-build/buildkit.go:42   func (c driveConfig) buildImage(ctx, box spec.BuildResolveBox, containerfile string) error
                                  :55   cfile := filepath.Join(c.BuildDir, box.Name, "Containerfile")   ← the drive writes it
                                  :63   buildkitdrive.Ensure(ctx, buildkitdrive.ExecRunner{}, …)        ← DAEMON ensure, not a base ensure
                                  :94   runner.Run(ctx, buildkitdrive.BuildctlBinary, args...)          ← the fetch happens INSIDE buildctl
    candy/plugin-build/ensure.go :51   func runBoxEnsure(ctx context.Context, ex *sdk.Executor, req spec.BuildEnsureRequest) error
                                  :60   the three-tier contract is spelled out in its own header comment
                                  :65   if kit.LocalImageExists(runEngine, req.Image) { … }              ← the already-present short-circuit
                                  :88   func ensureViaResolveAndBuild(ctx context.Context, ex *sdk.Executor, image, dir string) error
    candy/plugin-build/plugin.go :182  ensureErr := runBoxEnsure(ctx, ex, ereq)                          ← the ONLY caller, and it HAS an executor
    candy/plugin-build/drive.go  :32   type driveConfig struct { RunEngine, Platform, Cache, Push, NoCache, Jobs, StageParallelism, Dir, BuildDir }
                                  :51   func resolveBuild(ctx context.Context, ex *sdk.Executor, req spec.BuildRequest, generateOnly bool) (…)
                                 :156   if err := c.buildImage(ctx, box, containerfiles[name]); err != nil {   ← the drive loop's caller HAS ex
                                 :180   (the second call site, same shape)
    

    THE FACT THE BRIEF DID NOT HAVE: buildImage cannot reach the ensure helper as it stands. driveConfig carries no executor (drive.go:32), buildkit.go references no sdk.Executor at all, and ensureViaResolveAndBuild takes one (ensure.go:88). So the call the row needs is a three-part threading change, not a call-site addition:

    1. Thread the executor: driveConfig gains the executor its constructor already has (resolveBuild takes ex at drive.go:51, and both drive-loop call sites at :156/:180 live inside a scope holding it). This is the R2-shaped part: one field, one construction site, two call sites — not a new seam.
    2. Read the base ref from the artifact the drive itself wrote: cfile (:55) is the drive's OWN output, so its ARG BASE_IMAGE=<ref> line (sdk/deploykit/generate.go's resolvedBase → 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.
    3. Call ensureViaResolveAndBuild(ctx, c.Ex, ref, c.Dir) in the window between the daemon Ensure (:63) and the buildctl run (: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's building %s: %w stand 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's charly.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):

    1. Session worktree for plugin-build off fresh origin/main (absolute path), branch fix/base-image-local-fallback; CLAIM+TAKING OVER on this issue first.
    2. The three-part change above; go build ./... + go test ./... in candy/plugin-build/; charly box validate at the repo root.
    3. The two-box scratch acceptance with defaults.registry pointed 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:box is compiled in), so it is a worktree-local CalVer build of charly/ over this plugin.
    4. Producer PR in plugin-build → merge → tag → then the charly pin bump on charly's terms (charly/AGENTS.md; R9 worktree-local build; charly task sync/verify for 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)

  4. aitrawog commented on Oct 15, 2026

    @aitrawog
    ContributorAuthor

    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:

    $ podman images --format '{{.Repository}}:{{.Tag}}' | grep 'opencharly/arch' | wc -l
      88                                            # 88 local opencharly/arch images on this host
    $ podman images --format '{{.Repository}}:{{.Tag}}' | grep 'opencharly/arch:' | head -1
      ghcr.io/opencharly/arch:check-punktfunk-fleet-2026.288.1328      # <- the very bed that failed
    $ podman image exists ghcr.io/opencharly/arch:check-punktfunk-fleet-2026.288.1328 && echo YES
      YES
    

    and yet the fetch still fails, independently of any bed:

    $ podman pull ghcr.io/opencharly/arch:latest ; rc=125
      Error: unable to copy from source docker://ghcr.io/opencharly/arch:latest: initializing source ...
    $ ls ~/.config/containers/auth.json ~/.docker/config.json
      both: No such file or directory
    

    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:

    1. If the FROM reference 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. The build skill says "both Docker and Podman resolve local images before pulling"; that is true only for an exact reference match.
    2. If a pull policy forces the fetch regardless (a --pull=always equivalent, or BuildKit's own resolution), then even an exact local match is ignored.
    3. And the build-local fallback this issue asks for is still the right backstop — but its acceptance should not assume the image was missing.

    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 build has been failing on this host for hours while 88 copies of the base sit in local storage.

    A cheap discriminator: take the exact FROM line from a failed run's Containerfile (or from ARG BASE_IMAGE= in the cfile the drive wrote), and run podman 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)

  5. aitrawog commented on Oct 15, 2026

    @aitrawog
    ContributorAuthor

    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:

    $ grep -m1 -oE 'BASE_IMAGE=ghcr[^ ]+' .build/*/Containerfile | head -2
      ARG BASE_IMAGE=ghcr.io/opencharly/cachyos:openclaw.check-openclaw-pod-2026.287.1439
      ARG BASE_IMAGE=ghcr.io/opencharly/arch:openclaw.check-openclaw-pod-2026.287.1439
    $ podman image exists ghcr.io/opencharly/arch:openclaw.check-openclaw-pod-2026.287.1439     -> YES
    $ podman image exists ghcr.io/opencharly/cachyos:openclaw.check-openclaw-pod-2026.287.1439  -> YES
    

    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 to 2026.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 --pull behaviour 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 carries max-parallelism = 4), 88 arch images are local, and nothing is mid-build.

    So the row's shape, updated

    1. Try the build as-is. If it succeeds now, the blocker was the stale daemon's max-parallelism all along and the registry story was a red herring created by the stop. That is worth knowing before anyone writes a fallback.
    2. If it still fails on the fetch, the fix is in the resolution path — --pull behaviour, 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.
    3. Only if a base is genuinely absent AND unfetchable does the threading change (thread ex into driveConfig, read the ref from the cfile, call ensureViaResolveAndBuild between buildkit.go:63 and :94) become the fix.

    I am not asserting (1) is the answer — the failing run's own FROM line 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)

  6. aitrawog commented on Oct 15, 2026

    @aitrawog
    ContributorAuthor

    SETTLED — THE BUILD SUCCEEDS. The registry was never blocking; the stale daemon's max-parallelism was.

    I ran the conclusive test this issue's own ordering called for, on this host, with the daemon's max-parallelism now correct:

    $ charly box build openclaw.cachyos.arch.arch-builder
      ...
      [5/5] COMMIT ghcr.io/opencharly/arch-builder:2026.288.1349
      Successfully tagged ghcr.io/opencharly/arch-builder:2026.288.1349
      BUILD_RC=0
    

    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 stale buildkitd carrying max-parallelism=0 while 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:latest and read its 403 as evidence. :latest is 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

    • (1) Try the build as-is → SUCCEEDS. ✅ The blocker was the stale daemon.
    • (2) A resolution-path fix — not needed for this failure; no evidence of an exact-match miss.
    • (3) The build-local fallback and its threading change — not required to unblock anything today.

    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.go tier 3 already does resolve → podman pull → local build, and the drive never calls it (buildkit.go:63 → :94, with driveConfig carrying 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)

  7. aitrawog commented on Oct 15, 2026

    @aitrawog
    ContributorAuthor

    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:

    # run 2026.288.1355, daemon verified at max-parallelism = 4 before the run
    27:  #2 [internal] load metadata for ghcr.io/opencharly/arch:check-punktfunk-fleet-2026.288.1355
    28:  #2 ERROR: failed to authorize: failed to fetch anonymous token: … 403 Forbidden
    40:  error: failed to solve: failed to fetch anonymous token: … 403 Forbidden
    

    arch:check-punktfunk-fleet-2026.288.1355 is 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.

    The discriminator is THE LOCAL STORE — not the registry's health, and not the daemon. A build whose exact base tag is present resolves and succeeds; a build whose tag is absent falls through to the network and cannot recover.

    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:

    1. "Try the build as-is → succeeds" — succeeds only when the tag is already local. Not the general case.
    2. A resolution-path fix — not established; no evidence of an exact-match miss, since the absent tag genuinely is absent.
    3. The build-local fallback + the threading change — THIS IS THE FIX. ✅

    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.go tier 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 tested charly 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.

    A probe is only evidence about the reference it actually names.

    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)

  8. aitrawog commented on Oct 15, 2026

    @aitrawog
    ContributorAuthor

    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 bare arch, which resolves to a :latest-shaped reference charly never emits in a build — the same flaw the Lead identified in his podman pull …:latest test 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 at max-parallelism = 4 before each, fail at a base resolution:

    # runs 2026.288.1328 and 2026.288.1355 — identical shape
    $ grep -nE 'load metadata|403' .check/check-punktfunk-fleet/2026.288.1355/image-build-punktfunk-deploy-2-client.log
    27:  #2 [internal] load metadata for ghcr.io/opencharly/arch:check-punktfunk-fleet-2026.288.1355
    28:  #2 ERROR: failed to authorize: 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

    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.json absent, no helper configured). A build whose base IS local takes the other path and succeeds — the Lead's charly box build openclaw.cachyos.arch.arch-builder (BUILD_RC=0) had ghcr.io/opencharly/arch:openclaw.check-openclaw-pod-2026.287.1439 present 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/ shows ghcr.io_opencharly_arch-builder_check-punktfunk-fleet-2026.288.1355.oci.tar for that calver, while there is no plain ghcr.io_opencharly_arch_*.oci.tar at all (0 matches against 3 for arch-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)

  9. aitrawog commented on Oct 15, 2026

    @aitrawog
    ContributorAuthor

    SIBLING ISSUE — opencharly/sdk#401 is this defect seen from the SDK side, and the two should be worked as one.

    Found while triaging the org's new items: sdk#401 is "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 the charly side, filed independently by another leg.

    The two halves, and why they are one defect:

    side what it sees
    this issue (charly#949) box build reaches buildctl with a registry base ref; the fetch happens inside buildctl; when the tag is absent locally the build dies with 403 and there is no fallback
    sdk#401 buildkitdrive has no engine → BuildKit hand-off, so the drive cannot ask the engine whether the base exists before buildctl resolves it

    So sdk#401 is the missing SEAM and this issue is the missing CALL. The charly side already contains the ensure that would fix it (candy/plugin-build/ensure.go, tier 3 = resolve → podman pull → local build, behind the build:ensure word); the drive never calls it between buildkit.go:63 and :94.

    And the discriminator, measured twice today — it should be in both issues

    Two builds on this host, one minute apart:

    • resolved: base ghcr.io/opencharly/arch:openclaw.check-openclaw-pod-2026.287.1439 was in the local store → rc=0, no fetch;
    • failed: base 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#25 is "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, and layer-charly-build#25 is the right place for the wording fix.

    Linking rather than duplicating: no new issue, no claim on either — sdk#401 and 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)

  10. aitrawog commented on Oct 15, 2026

    @aitrawog
    ContributorAuthor

    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 into driveConfig (drive.go:72, from resolveBuild's ex), the base ref read out of the Containerfile the drive itself wrote, and the ensure-the-base call in the window between the daemon Ensure (buildkit.go:63) and the buildctl run (:94), with a failure that names the base ref, says it could not be fetched, and says no local build was possible. Gate: gofmt clean, 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):

    --- Building tiny-parent ---          # built successfully in this run, bridged to the run engine's store
    --- Building tiny-child ---
    error: failed to solve: <registry>/tiny-parent:2026.288.2104:
      failed to resolve source metadata …/manifests/2026.288.2104: 401 UNAUTHORIZED
    

    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 is sdk#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 at 3452b6b, 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 drag init: supervisord into the render, unresolvable.

    Agent: dsh-opencharly
    Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)

  11. aitrawog commented on Oct 15, 2026

    @aitrawog
    ContributorAuthor

    STATUS — re-scoping this row: its mechanism is one layer deeper than this issue describes, and sdk#401 leads 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.LocalImageExists was TRUE, and BuildKit fetched it anyway — the full run is on sdk#401). So this is now a sdk row with a charly half:

    • sdk#401 leads — the reverse half of the store bridge (engine → BuildKit), without which no drive-side ensure can make a base visible to the build.
    • the drive-side call is the charly/plugin half — implemented and module-gated at 3452b6b, 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.
    • the skill line that claims more than the code does is a fourth, minor item behind those two.

    Nothing has been pushed, and 3452b6b stays 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)

  12. added
    category:delivery
    type:feat
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

category:deliverytype:feat

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions