Backgrounding via left-arrow forks the session into a daemon worker that drops `CLAUDE_CODE_SKIP_VERTEX_AUTH` / `ANTHROPIC_VERTEX_BASE_URL`, breaking Vertex-gateway auth

Status Open
Reported on v2.1.233
Maintainer reply None cached
Activity 1 comment · opened Aug 17, 2026

Summary

Pressing on an empty prompt backgrounds the conversation into a fork run by the background daemon. The worker process is spawned with a reconstructed environment that keeps CLAUDE_CODE_USE_VERTEX, ANTHROPIC_VERTEX_PROJECT_ID, and ANTHROPIC_AUTH_TOKEN but drops CLAUDE_CODE_SKIP_VERTEX_AUTH and ANTHROPIC_VERTEX_BASE_URL. For a gateway-fronted Vertex setup (no local GCP credentials; the gateway holds them), the forked session then fails every request with:

API Error: Could not load the default credentials. Browse to
https://cloud.google.com/docs/authentication/getting-started for more information.

Environment

  • Claude Code 2.1.233, macOS (Darwin), zsh
  • Launched with these set in the shell environment: CLAUDE_CODE_USE_VERTEX=1, ANTHROPIC_VERTEX_PROJECT_ID=<project>, ANTHROPIC_VERTEX_BASE_URL=<gateway url>, CLAUDE_CODE_SKIP_VERTEX_AUTH=1, ANTHROPIC_AUTH_TOKEN=<gateway token>
  • No ADC on the machine: gcloud auth application-default print-access-token fails by design; the gateway performs GCP auth

Steps to reproduce

  1. Start claude with the environment above; the conversation works normally.
  2. On an empty prompt press → agents view; the conversation becomes a background fork (new session id, --fork-session --resume <original>.jsonl, managed by claude daemon run).
  3. Attach back to the conversation and send anything → the API error above on every request. The original session, resumed later from the normal terminal, works fine.

Evidence

Comparing environment variable names (never values) across the process tree with ps eww <pid>:

| process | USE_VERTEX | VERTEX_PROJECT_ID | AUTH_TOKEN | SKIP_VERTEX_AUTH | VERTEX_BASE_URL |
|---|---|---|---|---|---|
| interactive TUI (launcher) | ✓ | ✓ | ✓ | ✓ | ✓ |
| claude daemon run (spawned by that TUI) | ✓ | ✓ | ✓ | ✓ | ✓ |
| bg-pty-host + forked worker | ✓ | ✓ | ✓ | ✗ | ✗ |

The daemon inherits the launcher's full environment; the loss happens when the daemon spawns the worker. With CLAUDE_CODE_USE_VERTEX=1 still present and skip-auth/base-url gone, the worker attempts real ADC and throws.

Expected

A forked background worker should carry the same provider auth environment as the session it was forked from — at minimum, forward CLAUDE_CODE_SKIP_*_AUTH and ANTHROPIC_*_BASE_URL together with the CLAUDE_CODE_USE_* flags it already forwards.

Related

Same failure family as the fork losing session-scoped registration described in #75899 (dev-channel delivery comment): the gesture creates a new session/process and per-invocation launch context is not re-established. The view-restoration and confirmation fixes from #75899 work as described on 2.1.233; this is the remaining layer.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗