Skip to content

Fix arm64 sandbox image build: TARGETARCH default shadows BuildKit auto-injection#88

Merged
MiniMax-AI-Dev merged 1 commit into
mainfrom
fix/sandbox-targetarch-default
Jul 11, 2026
Merged

Fix arm64 sandbox image build: TARGETARCH default shadows BuildKit auto-injection#88
MiniMax-AI-Dev merged 1 commit into
mainfrom
fix/sandbox-targetarch-default

Conversation

@RyanLee-Dev

Copy link
Copy Markdown
Collaborator

Summary

sandbox-image-release.yml's local (parsar-sandbox) matrix leg failed on its first run after #87 merged:

/tmp/install-agents.sh: line 72: /usr/local/bin/claude: No such file or directory

Root cause: infra/sandbox/Dockerfile's runtime stage had ARG TARGETARCH=amd64. BuildKit auto-populates TARGETARCH per target platform for every node in a multi-platform build graph, but giving it a hardcoded default on a re-declared ARG shadows that auto-injection instead of acting as a mere fallback — every platform, including the arm64 build graph node, silently resolved TARGETARCH=amd64. install-agents.sh then downloaded the x86_64 Claude Code binary and tried to run it on an aarch64 rootfs; the kernel can't find the ELF interpreter for a wrong-architecture binary, which surfaces as ENOENT rather than the more obvious "exec format error".

Fix: bare ARG TARGETARCH (no default), matching the go-builder stage's existing correct pattern — the e2b matrix leg (amd64-only) is unaffected either way since BuildKit's auto value for an amd64 build is already amd64.

Test plan

  • Isolated repro without a full slow QEMU-emulated build: built two throwaway one-line Dockerfiles differing only in the ARG TARGETARCH declaration, each targeting --platform linux/arm64. ARG TARGETARCH=amd64 printed "amd64" (reproduces the bug in isolation); bare ARG TARGETARCH printed "arm64" (confirms the fix)
  • CI: sandbox images workflow should now succeed on both matrix legs after merge

🤖 Generated with Claude Code

sandbox-image-release.yml's (local, parsar-sandbox, ...) matrix leg
failed on its first run after merge:

  /tmp/install-agents.sh: line 72: /usr/local/bin/claude: No such file
  or directory

Root cause: infra/sandbox/Dockerfile's runtime stage declared
`ARG TARGETARCH=amd64`. BuildKit auto-populates TARGETARCH per target
platform for every node in a multi-platform build graph, but a
hardcoded default on a re-declared ARG shadows that auto-injection
instead of merely being a fallback — every platform, including the
arm64 build graph node, silently resolved TARGETARCH=amd64.
install-agents.sh then downloaded the x86_64 Claude Code binary and
tried to run it on an aarch64 rootfs; the kernel can't find the ELF
interpreter for a wrong-architecture binary, which surfaces as ENOENT
rather than the more obvious "exec format error".

Fix: bare `ARG TARGETARCH` (no default), matching the go-builder
stage's existing correct pattern.

Verified without a full slow QEMU-emulated build (this repro alone
took over the CI job's whole ~5min budget): built two throwaway
one-line Dockerfiles differing only in the ARG TARGETARCH declaration,
each targeting --platform linux/arm64. `ARG TARGETARCH=amd64` printed
"amd64" (reproducing the bug in isolation); bare `ARG TARGETARCH`
printed "arm64" (confirms the fix).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@MiniMax-AI-Dev MiniMax-AI-Dev merged commit 8c0bfbc into main Jul 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants