Repository navigation
refactor: label agent images in the Bake build - #13514
Merged
Merged
Conversation
cargo images build baked each agent image under a temporary tag, read its installed catalog in a container, then relabeled it with a second docker build, so the image Bake built was never the image deployments used. The agent Dockerfile now has a catalog stage that exports the installed catalog and a labeled stage that takes it as a build argument and fails unless it matches what the image installs. cargo images build bakes one, then the other; both reuse the same cache.
cv
enabled auto-merge (squash)
October 20, 2026 05:49
Contributor
This was referenced Oct 20, 2026
cv
added a commit
that referenced
this pull request
Oct 21, 2026
…3569) ## Failure NemoClaw's image checks were Python scripts mounted into each image: `image/test_image.py` for every agent image, and `image/test_agent_contract.py` for the reference image's lifecycle. Several checks tested other components or repeated what the build already enforces: - **Other components' behavior:** whether Hermes can reach MCP servers (Hermes internals), and how Fabric's TypeScript Pi adapter is packaged. - **Harness names:** a hard-coded list of the three harnesses that carry Node.js. - **Already enforced by the build:** - the catalog label matching the image's declarations (the `labeled` stage refuses a mismatch since #13514); - installed packages following Fabric's lock, and Python satisfying each adapter's range (the locked install enforces both). Also, `AGENTS.md` keeps tooling and tests in Rust and Python only inside images whose workload runs on it. `image/vllm/test_auth.py` was a manual script nothing ran. ## Decision `cargo images qualify IMAGE...` checks NemoClaw's promises about its images, in Rust: - **Every image,** from its label and a shell command that reports facts about the image, run offline as the image's own user: - the runtime command is `fabric-agent-ctl`, and it is executable; - the retained sources match the image's provenance; - the image runs as 10001:10001, `/sandbox` and `TMPDIR` belong to 10001, and everything in `/sandbox` is readable by others, as OpenShell needs on Kubernetes and OpenShift; - no package installer and no build toolchain. - **The reference image** also starts, invokes, and stops one runtime with NemoClaw's test adapter, through `fabric-agent-ctl serve` in an offline, read-only container with only `/sandbox` writable. The image workflow qualifies every agent image this way, and the three Python files are removed. The Python the images run (`catalog.py` and its helpers, the reference test adapter, and their tests) stays until image building moves to the Fabric repository. ## Validation - New tests for the fact checker (an image that meets the contract, and each problem named) and for the lifecycle container's arguments. They failed to compile before the change. - On a DGX Spark, `cargo images qualify` passed for all eleven local images, the reference image in 4 s with its lifecycle and each production image in about 1 s. The first run caught a bug in my facts script: it listed retained sources with a glob that missed dotfiles and nested files. - `docker buildx bake check`, `actionlint` and `cargo ci` (bundle and lifecycle included) passed, and `fern check` reported 0 errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Failure
cargo images buildbuilt each agent image twice. It baked the image under a temporary tag, rancatalog.py --installedin a container to read the installed Fabric catalog, then ran a seconddocker build FROMthe temporary image to add theio.nemoclaw.fabric.cataloglabel that plan reads. So the image Bake built was never the image deployments used, anddocker buildx bake --pushwould publish unlabeled images, which blocks publishing images from Bake to a registry.The label exists because plan reads the catalog from the image configuration: locally through Docker, and on Kubernetes from the exported metadata bundle, without pulling layers. Derived images inherit it through
FROM. A Dockerfile can't set a label from something its own build computes, hence the relabel.Decision
Compute the label inside the same Dockerfile and pass it between two cached Bake builds.
image/fabric/Dockerfilegains two stages, built on the harness stage that a globalSTAGEargument selects:catalogrunscatalog.py --installedoffline and exports/catalog.json;labeledtakes it as theCATALOGbuild argument, sets the label, and fails the build unlessCATALOGmatches the installed catalog. A missing or wrong catalog fails with "CATALOG must be this image's installed catalog; build with cargo images build".docker-bake.hclpassesSTAGEfor each agent and for the reference image.cargo images build:<name>withtarget=catalogto.build/catalog/<name>;<name>withtarget=labeledand the catalog.The temporary tag, the metadata container, the relabel build, and
read_metadataare gone. Tags come from Bake as for every other image.Unchanged: a plain
docker buildx bake <agent>still builds the unlabeled harness stage, so the Brev candidate build is unaffected.Also fixed: an unused-function warning in the CI runner build, left by refactor: build runtime images with Bake under image/ #13507.
targetis used only by the bundle, so it is gated on thesdkfeature.Validation
catalogandlabeledbuilds of the reference image each took about 1 s from cache, and the label equaled the exported catalog;CATALOGfailed the build with the message above;cargo images build --platform linux/arm64 agentsbuilt all ten images with labels in 227 s.cargo images qualify, with the OpenClaw, Hermes and Pi lifecycles, plusimage/test_image.pyagainst each label), andcargo images qualify nc-fabric:dummy --lifecycle dummypassed.docker buildx bake --check dummy agents ollama-proxyanddocker buildx bake checkpassed;cargo cipassed, including the bundle and lifecycle steps;cargo ci live-dockerpassed (9 tests), building its Pi and reference images through this path and deploying them.