Repository navigation
fix(anthropic): probe Claude CLI login with the env its runs keep - #175114
Merged
Merged
Conversation
The Claude CLI readiness probe (`claude auth status`) always stripped the Claude clear list, including CLAUDE_CODE_OAUTH_TOKEN, while CLI execution keeps keys named in OPENCLAW_LIVE_CLI_BACKEND_PRESERVE_ENV for native-login runs. Since #166338 made a configured runtime without prepared native auth authoritatively `missing-auth`, that mismatch makes sessions_spawn refuse an anthropic/* child pinned to claude-cli ("The selected account or native runtime is unavailable") even though the parent turn runs. The Docker live CLI backend lane (env-token subscription auth) hit this on every 2026.10.5 candidate and main, and its announce barrier then timed out at 240s. Probe the same child environment execution uses: preserved keys survive the clear list. Unlisted credentials (for example ANTHROPIC_API_KEY) stay cleared, and a genuinely logged-out CLI still reports missing.
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Member
Author
|
Admin-merge evidence (2026.10.5 release blocker): the only failing checks (check-prod-types, check-test-types, check-additional-extension-package-boundary, and the ci-gate aggregate) all fail on |
RomneyDa
added a commit
that referenced
this pull request
Oct 17, 2026
…75114) The Claude CLI readiness probe (`claude auth status`) always stripped the Claude clear list, including CLAUDE_CODE_OAUTH_TOKEN, while CLI execution keeps keys named in OPENCLAW_LIVE_CLI_BACKEND_PRESERVE_ENV for native-login runs. Since #166338 made a configured runtime without prepared native auth authoritatively `missing-auth`, that mismatch makes sessions_spawn refuse an anthropic/* child pinned to claude-cli ("The selected account or native runtime is unavailable") even though the parent turn runs. The Docker live CLI backend lane (env-token subscription auth) hit this on every 2026.10.5 candidate and main, and its announce barrier then timed out at 240s. Probe the same child environment execution uses: preserved keys survive the clear list. Unlisted credentials (for example ANTHROPIC_API_KEY) stay cleared, and a genuinely logged-out CLI still reports missing. (cherry picked from commit a2e6a6b)
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 18, 2026
…enclaw#175114) The Claude CLI readiness probe (`claude auth status`) always stripped the Claude clear list, including CLAUDE_CODE_OAUTH_TOKEN, while CLI execution keeps keys named in OPENCLAW_LIVE_CLI_BACKEND_PRESERVE_ENV for native-login runs. Since openclaw#166338 made a configured runtime without prepared native auth authoritatively `missing-auth`, that mismatch makes sessions_spawn refuse an anthropic/* child pinned to claude-cli ("The selected account or native runtime is unavailable") even though the parent turn runs. The Docker live CLI backend lane (env-token subscription auth) hit this on every 2026.10.5 candidate and main, and its announce barrier then timed out at 240s. Probe the same child environment execution uses: preserved keys survive the clear list. Unlisted credentials (for example ANTHROPIC_API_KEY) stay cleared, and a genuinely logged-out CLI still reports missing.
wheakerd
pushed a commit
to wheakerd/clawdbot
that referenced
this pull request
Oct 22, 2026
…enclaw#175114) The Claude CLI readiness probe (`claude auth status`) always stripped the Claude clear list, including CLAUDE_CODE_OAUTH_TOKEN, while CLI execution keeps keys named in OPENCLAW_LIVE_CLI_BACKEND_PRESERVE_ENV for native-login runs. Since openclaw#166338 made a configured runtime without prepared native auth authoritatively `missing-auth`, that mismatch makes sessions_spawn refuse an anthropic/* child pinned to claude-cli ("The selected account or native runtime is unavailable") even though the parent turn runs. The Docker live CLI backend lane (env-token subscription auth) hit this on every 2026.10.5 candidate and main, and its announce barrier then timed out at 240s. Probe the same child environment execution uses: preserved keys survive the clear list. Unlisted credentials (for example ANTHROPIC_API_KEY) stay cleared, and a genuinely logged-out CLI still reports missing. (cherry picked from commit a2e6a6b) (cherry picked from commit ad67421) Co-authored-by: RomneyDa <[email protected]>
RomneyDa
added a commit
that referenced
this pull request
Oct 27, 2026
…75114) The Claude CLI readiness probe (`claude auth status`) always stripped the Claude clear list, including CLAUDE_CODE_OAUTH_TOKEN, while CLI execution keeps keys named in OPENCLAW_LIVE_CLI_BACKEND_PRESERVE_ENV for native-login runs. Since #166338 made a configured runtime without prepared native auth authoritatively `missing-auth`, that mismatch makes sessions_spawn refuse an anthropic/* child pinned to claude-cli ("The selected account or native runtime is unavailable") even though the parent turn runs. The Docker live CLI backend lane (env-token subscription auth) hit this on every 2026.10.5 candidate and main, and its announce barrier then timed out at 240s. Probe the same child environment execution uses: preserved keys survive the clear list. Unlisted credentials (for example ANTHROPIC_API_KEY) stay cleared, and a genuinely logged-out CLI still reports missing. (cherry picked from commit a2e6a6b)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
The Docker live CLI backend lane ("Docker live suites (Docker live CLI backend)",
src/gateway/gateway-cli-backend.live.test.ts"runs the agent pipeline against the local CLI backend") fails on every 2026.10.5 candidate and onmain. It passes on 2026.10.4. The parent turn'ssessions_spawnis refused with:No child starts, so
cli_announce_barrierwaits untilcli_overall_timeout(240s). This blocks the 2026.10.5 release.Why This Change Was Made
The lane uses Claude subscription auth through
CLAUDE_CODE_OAUTH_TOKEN, withOPENCLAW_LIVE_CLI_BACKEND_PRESERVE_ENV='["CLAUDE_CODE_OAUTH_TOKEN"]'. It mounts no.credentials.json. CLI execution keeps preserved keys for the Claude child (src/agents/cli-runner/execute.ts), so the parent turn works.The readiness check (
probeClaudeCliAuthStatus, which runsclaude auth status --json) always removed the whole Claude clear list, including the preserved token. So it reported the CLI as logged out, and noclaude-cliauth mode was recorded.Cause commit 8775756 (#166338) made a configured runtime with no recorded auth mode authoritatively
missing-auth, even before the full catalog loads. Before that, availability stayed unknown and spawn was admitted. So the check and the runner disagreeing about the child's environment now refuses a login that works.The fix makes the check use the same child environment execution uses. Keys named in
OPENCLAW_LIVE_CLI_BACKEND_PRESERVE_ENV(JSON array or comma/space list, the same format the runner accepts) survive the clear list. Everything else is unchanged:ANTHROPIC_API_KEY, are still removed;User Impact
Only live CLI lanes that set
OPENCLAW_LIVE_CLI_BACKEND_PRESERVE_ENVchange behavior. Their Claude CLI readiness now matches what their runs can use. There is no change otherwise: without that variable, the check removes the same environment as before.Evidence
extensions/anthropic/cli-auth-seam.test.ts(JSON and list preserve formats). Both fail without the fix (2 failed / 11 passed) and pass with it (13/13).pnpm test extensions/anthropic/cli-auth-seam.test.ts --maxWorkers=1: 25.8s wall, Vitest duration 20.8s.pnpm test extensions/anthropic/index.test.ts extensions/anthropic/live-discovery-auth.test.ts --maxWorkers=1: 34/34 pass, 22.8s wall.oxfmt --checkandoxlintare clean on both touched files.pnpm tsgo:extensions/pnpm tsgo:extensions:test: the only error is the pre-existingsrc/snapshot/local-repository.ts(1101,46) TS2554onmain. The file is untouched here, and the touched files have no errors.[claude-subscription] using CLAUDE_CODE_OAUTH_TOKEN from environment, then thesessions_spawnrefusal, then the 240s barrier timeout.CLAUDE_CODE_OAUTH_TOKEN. I traced the path by code: once the check reports available,claude-cligets an auth mode andprepareModelChoiceadmits the child.release/2026.10.5.