Skip to content

fix: Pre-seed Claude Code config to fix silent auth failure in sandbox#1

Open
skinnerjc wants to merge 4 commits intomainfrom
fix/claude-code-auth-config
Open

fix: Pre-seed Claude Code config to fix silent auth failure in sandbox#1
skinnerjc wants to merge 4 commits intomainfrom
fix/claude-code-auth-config

Conversation

@skinnerjc
Copy link
Owner

@skinnerjc skinnerjc commented Feb 18, 2026

Problem

When running Claude Code 2.1.37 (current stable) in --print mode via the sandbox agent bridge, Claude Code exits with rc=0 and empty stdout/stderr — no API calls are made through the bridge. With attempts set to unlimited, the retry loop spins for dozens of iterations.

What was observed

  1. The bridge proxy works: a raw curl POST /v1/messages from inside the container returns a valid Anthropic API response.
  2. The Claude Code binary works: claude --version and claude --help both succeed.
  3. claude --print -- "Say hello" exits in <1 second with rc=0 and zero output, despite ANTHROPIC_AUTH_TOKEN being set in the environment.
  4. Claude Code's debug log (~/.claude/debug/latest) shows:
    [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
    [API:auth] OAuth token check starting
    
    The log ends immediately after — no API call is made.

Change

Before running Claude Code, write ~/.claude/settings.json with an apiKeyHelper that echoes the dummy API key from ANTHROPIC_AUTH_TOKEN. Claude Code then authenticates and makes API calls through the bridge on the first attempt.

Tested with Claude Code 2.1.37 on K8s sandbox (non-centaur path).

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.

1 participant