Component
Agent runtime (Dockerfile / container build)
Describe the bug
A freshly built agent image ships a 500-byte error stub in place of the native claude binary, so every task fails at turn 0 with:
ERROR step 'implement' handler raised: OSError: [Errno 8] Exec format error: 'claude'
The task record shows status=FAILED, turns=0, duration≈1s, and the terminal comment reads ❌ Task failed: Unexpected error.
Root cause
agent/Dockerfile installs the CLI with:
RUN npm install -g npm@latest && \
npm install -g @anthropic-ai/claude-code@2.1.191 && \
...
@anthropic-ai/claude-code downloads its ~236 MB native binary in a postinstall script (node install.cjs). Recent npm versions block package lifecycle scripts by default, emitting:
npm warn install-scripts 1 package had install scripts blocked because they are not covered by allowScripts:
npm warn install-scripts @anthropic-ai/claude-code@2.1.191 (postinstall: node install.cjs)
Because npm install -g npm@latest floats to whatever npm is newest at build time, the moment that default flipped, the postinstall stopped running and the image began shipping the stub /usr/bin/claude (which just prints Error: claude native binary not installed.). Exec-ing it yields the Exec format error.
This is a build-environment regression, not a code change — an image built a few hours earlier (before the npm default flipped) contained the real 236 MB ELF binary.
Expected behavior
The agent image contains the real, executable claude native binary; tasks run normally.
Proposed fix
- Explicitly allow the
claude-code postinstall (npm's own suggested remedy):
npm install -g --allow-scripts=@anthropic-ai/claude-code @anthropic-ai/claude-code@2.1.191
- Add a build-time guard RUN step that fails the build loudly if
claude is ever the stub again (size check + claude --version), so a future npm/packaging change can't silently ship a broken runtime that only fails at task time.
Verification
- Isolated build with the flag:
claude resolves to a 236 MB ELF and claude --version → 2.1.191 (Claude Code). Without it: 500-byte stub.
- Deployed to
backgroundagent-dev and re-ran a Jira-triggered task end-to-end — task runs past turn 0.
Out of scope
- Pinning
npm to a fixed version (separate reproducibility hardening; can follow up).
Component
Agent runtime (Dockerfile / container build)
Describe the bug
A freshly built agent image ships a 500-byte error stub in place of the native
claudebinary, so every task fails at turn 0 with:The task record shows
status=FAILED,turns=0,duration≈1s, and the terminal comment reads❌ Task failed: Unexpected error.Root cause
agent/Dockerfileinstalls the CLI with:RUN npm install -g npm@latest && \ npm install -g @anthropic-ai/claude-code@2.1.191 && \ ...@anthropic-ai/claude-codedownloads its ~236 MB native binary in apostinstallscript (node install.cjs). Recentnpmversions block package lifecycle scripts by default, emitting:Because
npm install -g npm@latestfloats to whatever npm is newest at build time, the moment that default flipped, the postinstall stopped running and the image began shipping the stub/usr/bin/claude(which just printsError: claude native binary not installed.). Exec-ing it yields theExec format error.This is a build-environment regression, not a code change — an image built a few hours earlier (before the npm default flipped) contained the real 236 MB ELF binary.
Expected behavior
The agent image contains the real, executable
claudenative binary; tasks run normally.Proposed fix
claude-codepostinstall (npm's own suggested remedy):claudeis ever the stub again (size check +claude --version), so a future npm/packaging change can't silently ship a broken runtime that only fails at task time.Verification
clauderesolves to a 236 MB ELF andclaude --version→2.1.191 (Claude Code). Without it: 500-byte stub.backgroundagent-devand re-ran a Jira-triggered task end-to-end — task runs past turn 0.Out of scope
npmto a fixed version (separate reproducibility hardening; can follow up).