Skip to content

fix(acp): pass HOME and Anthropic env vars to child process (#3135)#3148

Merged
aegis-gh-agent[bot] merged 1 commit into
developfrom
fix/3135-acp-env-vars
May 10, 2026
Merged

fix(acp): pass HOME and Anthropic env vars to child process (#3135)#3148
aegis-gh-agent[bot] merged 1 commit into
developfrom
fix/3135-acp-env-vars

Conversation

@OneStepAt4time

Copy link
Copy Markdown
Owner

Problem

Issue #3135: ACP child process (claude-agent-acp) receives only 3 env vars: PATH, TMPDIR, NO_COLOR. Missing HOME means it can't find ~/.claude/credentials. Missing ANTHROPIC_*/CLAUDE_* means it can't authenticate with the Anthropic API.

The child process starts, the JSON-RPC handshake completes, but session/new times out because CC can't connect to Anthropic. Sessions appear idle but claudeRunning: false and claudeSessionId: null.

Root Cause

buildAcpSpawnEnv() in src/acp-spawn-env.ts constructs a minimal environment with only PATH and temp dirs. Everything else from process.env is filtered out.

Fix

Pass through essential env vars to the ACP child process:

  • HOME, USER, SHELL, LANG, LC_ALL, LC_CTYPE (system essentials)
  • All ANTHROPIC_* prefixed vars (API keys, endpoints)
  • All CLAUDE_* prefixed vars (config dir, executable path)

Before

Child process env: { PATH, TMPDIR, NO_COLOR }  // 3 vars

After

Child process env: { PATH, HOME, USER, SHELL, LANG, ANTHROPIC_API_KEY, CLAUDE_CONFIG_DIR, ... }

Files

  • src/acp-spawn-env.ts: expand copyPlatformExecutionEnv to include HOME and auth-related env vars

@aegis-gh-agent aegis-gh-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved — all 9 merge gates passed.

Root cause fix for ACP sessions stuck at pending. Child process now receives HOME, USER, SHELL, LANG + all ANTHROPIC_/CLAUDE_ env vars for authentication. All CI green.

👁️ Argus

The ACP spawn environment only passed PATH, TMPDIR, TEMP, TMP to the
claude-agent-acp child process. Missing HOME meant os.homedir() couldn't
find ~/.claude/credentials, and missing ANTHROPIC_* / CLAUDE_* env vars
meant the child couldn't authenticate with the Anthropic API.

This caused sessions to silently fail — child process starts but
session/new times out because CC can't connect to Anthropic.

Now passes through:
- HOME, USER, SHELL, LANG, LC_ALL, LC_CTYPE
- All ANTHROPIC_* and CLAUDE_* prefixed env vars
@OneStepAt4time OneStepAt4time force-pushed the fix/3135-acp-env-vars branch from c8d1847 to 20dedaa Compare May 10, 2026 14:42
@aegis-gh-agent aegis-gh-agent Bot merged commit 0ad9445 into develop May 10, 2026
19 checks passed
@aegis-gh-agent aegis-gh-agent Bot deleted the fix/3135-acp-env-vars branch May 10, 2026 14:46
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