From 1278967223c13d353644cc954cb13cd5e07b1db2 Mon Sep 17 00:00:00 2001 From: gnanam1990 Date: Wed, 1 Apr 2026 20:00:42 +0530 Subject: [PATCH] fix: skip Anthropic credential check in CI for 3P providers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In CI mode, auth.ts throws if ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN are missing — even when using CLAUDE_CODE_USE_OPENAI=1 or CLAUDE_CODE_USE_GEMINI=1. This crashes any OpenAI/Gemini/Ollama CI pipeline immediately. Fix: guard the throw with !isUsing3PServices() so non-Anthropic providers skip the check entirely. Also added CLAUDE_CODE_USE_GEMINI to isUsing3PServices() which was missing — Gemini users were excluded from the 3P detection used elsewhere in the same function. Fixes #40. Co-Authored-By: Claude Sonnet 4.6 --- src/utils/auth.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/auth.ts b/src/utils/auth.ts index 27098c09..c13a3e84 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -274,6 +274,7 @@ export function getAnthropicApiKeyWithSource( } if ( + !isUsing3PServices() && !apiKeyEnv && !process.env.CLAUDE_CODE_OAUTH_TOKEN && !process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR @@ -1729,13 +1730,14 @@ export function getSubscriptionName(): string { } } -/** Check if using third-party services (Bedrock or Vertex or Foundry or OpenAI-compatible) */ +/** Check if using third-party services (Bedrock or Vertex or Foundry or OpenAI-compatible or Gemini) */ export function isUsing3PServices(): boolean { return !!( isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) || isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX) || isEnvTruthy(process.env.CLAUDE_CODE_USE_FOUNDRY) || - isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI) + isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI) || + isEnvTruthy(process.env.CLAUDE_CODE_USE_GEMINI) ) }