feat: add non-interactive auth via CLAUDE_CODE_OAUTH_TOKEN#32
Merged
Conversation
Bypass the interactive onboarding wizard when CLAUDE_CODE_OAUTH_TOKEN is set. On container create, post_install.py runs `claude -p` to populate auth state and sets hasCompletedOnboarding so the TUI starts without the login wizard. Workaround for anthropics/claude-code#8938. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
containerEnv bakes values into the image as ENV instructions, visible in docker inspect/history. remoteEnv is set at runtime only. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Handle timeout as expected (claude -p writes config before API call) - Catch FileNotFoundError/OSError if claude is not installed - Check returncode explicitly instead of dead CalledProcessError catch - Guard on ~/.claude.json existence before writing onboarding flag - Replace contextlib.suppress with explicit try/except that logs - Update module docstring and README wording Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
DarkaMaul
approved these changes
Mar 12, 2026
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.
Summary
CLAUDE_CODE_OAUTH_TOKENandANTHROPIC_API_KEYfrom host into container viacontainerEnvsetup_onboarding_bypass()topost_install.py: runsclaude -pto populate auth state, then setshasCompletedOnboarding: trueso the TUI skips the login wizardWorkaround for anthropics/claude-code#8938.
Test plan
CLAUDE_CODE_OAUTH_TOKEN, build fresh container —~/.claude.jsonhashasCompletedOnboarding: truedevcontainer up --remove-existing-container—postCreateCommandre-runs, auth state recreatedsetup_onboarding_bypass()is a no-op (no regression)🤖 Generated with Claude Code