Fix arm64 sandbox image build: TARGETARCH default shadows BuildKit auto-injection#88
Merged
Merged
Conversation
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>
5 tasks
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.
Summary
sandbox-image-release.yml'slocal(parsar-sandbox) matrix leg failed on its first run after #87 merged:Root cause:
infra/sandbox/Dockerfile's runtime stage hadARG TARGETARCH=amd64. BuildKit auto-populatesTARGETARCHper target platform for every node in a multi-platform build graph, but giving it a hardcoded default on a re-declaredARGshadows that auto-injection instead of acting as a mere fallback — every platform, including thearm64build graph node, silently resolvedTARGETARCH=amd64.install-agents.shthen 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 asENOENTrather than the more obvious "exec format error".Fix: bare
ARG TARGETARCH(no default), matching thego-builderstage's existing correct pattern — thee2bmatrix leg (amd64-only) is unaffected either way since BuildKit's auto value for an amd64 build is alreadyamd64.Test plan
ARG TARGETARCHdeclaration, each targeting--platform linux/arm64.ARG TARGETARCH=amd64printed"amd64"(reproduces the bug in isolation); bareARG TARGETARCHprinted"arm64"(confirms the fix)sandbox imagesworkflow should now succeed on both matrix legs after merge🤖 Generated with Claude Code