Skip to content

engine: claude — ANTHROPIC_API_KEY not reaching Claude Code CLI inside sandbox (apiKeySource: none) #22713

@dduran28

Description

@dduran28

Description

Claude engine workflows fail with EHOSTUNREACH because the ANTHROPIC_API_KEY is not reaching the Claude Code CLI inside the sandbox container. The CLI reports apiKeySource: "none" at init.

Environment

  • gh aw CLI: v0.63.0
  • Claude Code CLI: 2.1.81 (installed by gh-aw runtime)
  • Repo: private, GitHub Teams plan
  • OS: ubuntu-latest (GitHub-hosted runner)

Steps to Reproduce

  1. Create a simple Claude daemon spec:
---
description: "Test daemon"
strict: false
timeout-minutes: 20
on:
  pull_request:
    types: [opened]
engine:
  id: claude
  model: claude-opus-4-20250514
permissions:
  contents: read
tools:
  github:
    toolsets: [pull_requests]
  bash: true
network:
  allowed: [defaults, api.anthropic.com]
---
# Test
Say hello.
  1. Set ANTHROPIC_API_KEY as a repo secret (confirmed via gh secret list)
  2. Compile: gh aw compile (succeeds, 0 errors)
  3. Push and trigger on a PR

Expected Behavior

Claude Code CLI should receive the API key via the one-shot token mechanism and connect to api.anthropic.com.

Actual Behavior

The workflow runs through all setup steps successfully:

  • Validate ANTHROPIC_API_KEY secret step passes (✅ ANTHROPIC_API_KEY: Configured)
  • ✅ API proxy health check passes (✓ Anthropic API proxy is reachable at http://172.30.0.30:10001)
  • ANTHROPIC_AUTH_TOKEN is placeholder value (correct)
  • ✅ One-shot token library copied to chroot
  • ❌ Claude Code CLI reports apiKeySource: "none" at init
  • ❌ All 10 API retry attempts fail with error: "unknown"
  • ❌ Final error: API Error: Unable to connect to API (EHOSTUNREACH)

Firewall logs show only 1 request to raw.githubusercontent.com — Claude Code never attempts to reach api.anthropic.com or the API proxy.

Key Log Lines

[health-check] ✓ Anthropic API proxy is reachable at http://172.30.0.30:10001
[entrypoint] One-shot token library copied to chroot at /tmp/awf-lib/one-shot-token.so
[entrypoint] Unsetting sensitive tokens from parent shell environment...
{"apiKeySource":"none","claude_code_version":"2.1.81"}
{"subtype":"api_retry","attempt":1,"error_status":null,"error":"unknown"}
...
{"text":"API Error: Unable to connect to API (EHOSTUNREACH)"}

What I've Tried

  • strict: true (default) — same failure
  • strict: false — same failure
  • network.allowed: [defaults, api.anthropic.com] — same failure
  • Upgraded from gh-aw v0.62.5 to v0.63.0 — same failure
  • Confirmed ANTHROPIC_API_KEY is a valid repo secret (used successfully by anthropics/claude-code-action@beta in another workflow in the same repo)

Notes

The gh-aw Claude smoke test (smoke-claude.md) in this repo passes. The key difference may be that the smoke test is compiled/run within the gh-aw CI infrastructure, while our workflow is in an external private repo. The compiled lock files look structurally identical.

Failed run: https://github.com/quitgenius/pelago-aiml/actions/runs/23497638247/job/68379397069

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions