fix: respect CLAUDE_CODE_OAUTH_TOKEN env authentication check in standalone mode#774
fix: respect CLAUDE_CODE_OAUTH_TOKEN env authentication check in standalone mode#774iamriajul wants to merge 3 commits intocoder:mainfrom
Conversation
…andalone mode Update guard condition to skip authentication only when: - CLAUDE_API_KEY is unset - CLAUDE_CODE_OAUTH_TOKEN is unset - ARG_ENABLE_AIBRIDGE is false This enables authentication flow for OAuth-based usage and AIBridge scenarios.
There was a problem hiding this comment.
Pull request overview
Updates the Claude Code module’s standalone-mode install script so authentication setup runs for OAuth-token and AI Bridge flows (not only API-key flows), aligning behavior with the module’s supported authentication options.
Changes:
- Expand the standalone-mode authentication guard to proceed when
CLAUDE_API_KEY,CLAUDE_CODE_OAUTH_TOKEN, orenable_aibridgeis set. - Update README examples to reference module version
4.7.6.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
registry/coder/modules/claude-code/scripts/install.sh |
Adjusts standalone-mode auth gating to include OAuth token and AI Bridge paths. |
registry/coder/modules/claude-code/README.md |
Bumps example module version strings to 4.7.6. |
| if [ -z "${CLAUDE_API_KEY:-}" ] \ | ||
| && [ -z "${CLAUDE_CODE_OAUTH_TOKEN:-}" ] \ | ||
| && [ "${ARG_ENABLE_AIBRIDGE:-false}" = "false" ]; then | ||
| echo "Note: No CLAUDE_API_KEY, no CLAUDE_CODE_OAUTH_TOKEN, and AIBridge disabled — skipping authentication setup" |
There was a problem hiding this comment.
This guard now allows standalone configuration to run when only CLAUDE_CODE_OAUTH_TOKEN is set, but the code below still unconditionally writes .primaryApiKey to ${CLAUDE_API_KEY:-}. In an OAuth-only flow this will set primaryApiKey to an empty string and can clobber an existing API key in ~/.claude.json. Consider only updating/setting primaryApiKey when CLAUDE_API_KEY is non-empty (otherwise preserve the existing value or omit the field).
Description
Update the authentication guard to support multiple authentication paths.
Previously, authentication setup was skipped unless
CLAUDE_API_KEYwas present. This change allows the setup to proceed when eitherCLAUDE_API_KEY,CLAUDE_CODE_OAUTH_TOKEN, orARG_ENABLE_AIBRIDGE=trueis provided.This ensures OAuth-based flows and AIBridge-enabled environments work correctly without requiring an API key.
Type of Change
Testing & Validation
bun test) (not applicable — shell logic change)bun fmt) (not applicable)Tested scenarios:
Related Issues
None