Firecracker agent image build ships an empty context — Dockerfile COPY of pinned inputs fails #538

Closed
opened 2026-07-27 13:18:01 -04:00 by didericis-claude · 0 comments
Collaborator

Problem

Agent images (codex/claude/pi) are built with buildah inside the infra VM. image_builder._build_in_infra() creates an empty {ctx}/ctx and ships only the Dockerfile — relying on the invariant (documented on _dockerfile_hash) that agent Dockerfiles COPY nothing from the build context.

The "pin & verify image inputs" work broke that invariant:

  • bot_bottle/contrib/codex/DockerfileCOPY bot_bottle/contrib/codex/codex-package_SHA256SUMS
  • bot_bottle/contrib/claude/DockerfileCOPY bot_bottle/contrib/claude/package.json package-lock.json
  • bot_bottle/contrib/pi/DockerfileCOPY bot_bottle/contrib/pi/package.json package-lock.json

Since nothing populates {ctx}/ctx, any fresh agent image build now fails:

Error: building at STEP "COPY --chown=node:node bot_bottle/contrib/codex/codex-package_SHA256SUMS /tmp/codex-package_SHA256SUMS": ... no such file or directory
bot-bottle: error: buildah build in the infra VM failed (exit 125)

Existing agents only keep working because their rootfs is cached from before the COPY was added; a cache miss (Dockerfile change, new agent) reproduces it. Repro: BOT_BOTTLE_INFRA_BUILD=local ./cli.py start with a codex bottle.

Fix

Parse each Dockerfile's context COPY sources, tar those committed files from the build root into the VM-side {ctx}/ctx (preserving relative paths), and fold their content into the rootfs cache digest so a repinned input rebuilds instead of reusing stale bytes. COPY --from=<stage> and absolute/traversing sources are excluded.

Scope: firecracker image_builder.py only; independent of the packaged-infra-artifacts work (#537), which does not touch the agent-image build path.

## Problem Agent images (codex/claude/pi) are built with `buildah` **inside the infra VM**. `image_builder._build_in_infra()` creates an empty `{ctx}/ctx` and ships only the Dockerfile — relying on the invariant (documented on `_dockerfile_hash`) that *agent Dockerfiles COPY nothing from the build context*. The **"pin & verify image inputs"** work broke that invariant: - `bot_bottle/contrib/codex/Dockerfile` → `COPY bot_bottle/contrib/codex/codex-package_SHA256SUMS` - `bot_bottle/contrib/claude/Dockerfile` → `COPY bot_bottle/contrib/claude/package.json package-lock.json` - `bot_bottle/contrib/pi/Dockerfile` → `COPY bot_bottle/contrib/pi/package.json package-lock.json` Since nothing populates `{ctx}/ctx`, any **fresh** agent image build now fails: ``` Error: building at STEP "COPY --chown=node:node bot_bottle/contrib/codex/codex-package_SHA256SUMS /tmp/codex-package_SHA256SUMS": ... no such file or directory bot-bottle: error: buildah build in the infra VM failed (exit 125) ``` Existing agents only keep working because their rootfs is cached from before the COPY was added; a cache miss (Dockerfile change, new agent) reproduces it. Repro: `BOT_BOTTLE_INFRA_BUILD=local ./cli.py start` with a codex bottle. ## Fix Parse each Dockerfile's context `COPY` sources, tar those committed files from the build root into the VM-side `{ctx}/ctx` (preserving relative paths), and fold their content into the rootfs cache digest so a repinned input rebuilds instead of reusing stale bytes. `COPY --from=<stage>` and absolute/traversing sources are excluded. Scope: firecracker `image_builder.py` only; independent of the packaged-infra-artifacts work (#537), which does not touch the agent-image build path.
gitea-actions bot added the Status/Needs Triage label 2026-07-27 13:18:12 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: didericis/bot-bottle#538