fix: copy get-claude-key.sh to chroot-accessible path#1508
Conversation
In chroot mode, /usr is bind-mounted from the host (read-only), shadowing the container's /usr/local/bin/get-claude-key.sh. Claude Code finds the apiKeyHelper config but the script fails with exit 127 (not found). Follow the existing one-shot-token.so pattern: copy the script to /host/tmp/awf-lib/ before chroot activation, then update the apiKeyHelper config files to reference the chroot-accessible path. Closes #1507 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
There was a problem hiding this comment.
Pull request overview
Fixes Claude Code failures in chroot mode by ensuring get-claude-key.sh is available from a chroot-visible location, aligning it with the existing /tmp/awf-lib “copy-before-chroot” pattern used for one-shot-token.so.
Changes:
- Copy
get-claude-key.shinto/host/tmp/awf-lib/so it’s accessible as/tmp/awf-lib/...inside the chroot. - Attempt to rewrite Claude Code config files (
~/.claude.jsonand~/.claude/settings.json) to pointapiKeyHelperat the chroot-accessible path. - Update
CLAUDE_CODE_API_KEY_HELPERto the chroot path for the remainder of the entrypoint execution.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Smoke Test Results — PASS
|
|
🔥 Smoke test results for ✅ GitHub MCP: #1498 "[WIP] Fix failing GitHub Actions workflow Audit Main Package", #1495 "fix: use neutral policy language in SAFE_XPIA_CONTENT to stop OpenAI cybersecurity filter" Overall: PASS
|
Chroot Version Comparison Results
Overall: ❌ Tests did not fully pass — Python and Node.js versions differ between host and chroot environments.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
When settings.json persists between AWF runs (e.g. in CI), a previous run's chroot-adjusted path (/tmp/awf-lib/get-claude-key.sh) causes a mismatch with the current env var (/usr/local/bin/get-claude-key.sh). Overwrite with the current value instead of exiting with an error. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Smoke Test Results
Overall: PASS
|
|
🤖 Smoke test results for ✅ GitHub MCP — Last 2 merged PRs: #1498 "[WIP] Fix failing GitHub Actions workflow Audit Main Package", #1495 "fix: use neutral policy language in SAFE_XPIA_CONTENT..." Overall: PASS
|
Chroot Version Comparison Results
Result: 1/3 tests passed — Python and Node.js versions differ between host and chroot environments.
|
|
Smoke test status (Codex)
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Problem
In chroot mode,
get-claude-key.shis inaccessible because/usris bind-mounted from the host (read-only), shadowing the container's/usr/local/bin/get-claude-key.sh. Claude Code finds theapiKeyHelperconfig but the script fails with exit 127:All API retries fail →
EHOSTUNREACH→ zero tokens consumed.Root Cause
/usr/local/bin/get-claude-key.sh/usr(no script)The chroot bind-mounts the host's
/usrover the container's/usr, and the host doesn't haveget-claude-key.sh.Fix
Follow the existing
one-shot-token.sopattern (entrypoint.sh:406-427):get-claude-key.shfrom the container's/usr/local/bin/to/host/tmp/awf-lib/(writable, accessible in chroot)apiKeyHelperin both.claude.jsonand.claude/settings.jsonto reference the chroot-accessible pathAWF_CHROOT_ENABLEDimplicitly via the chroot section)Testing
bash -n entrypoint.sh— syntax valid ✅npx jest docker-manager.test.ts— 275 pass (3 pre-existing sudo failures) ✅Closes #1507
References