[codex] Fix Claude auth probe fallback #3559
Closedjuliusmarmingewants to merge 1 commit into
main fromt3code/fix-claude-oauth-authenticationopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- @@ -444,3 +449,4 @@444449 return undefined;445450 }446451452+function parseClaudeAuthStatusFromOutput(result: CommandResult): {@@ -743 +823,21 @@743823 if (!capabilities) {824+ const authProbe = yield* runClaudeCommand(825+ claudeSettings,826+ ["auth", "status"],827+ resolvedEnvironment,828+ ).pipe(Effect.timeoutOption(AUTH_PROBE_TIMEOUT_MS), Effect.result);829+830+ if (Result.isSuccess(authProbe) && Option.isSome(authProbe.success)) {831+ const parsedAuth = parseClaudeAuthStatusFromOutput(authProbe.success.value);832+ return buildServerProvider({833+ presentation: CLAUDE_PRESENTATION,834+ enabled: claudeSettings.enabled,835+ checkedAt,836+ models,837+ slashCommands: dedupedSlashCommands,838+ probe: {839+ installed: true,840+ version: parsedVersion,841+ status: parsedAuth.status,842+ auth: parsedAuth.auth,843+ ...(parsedAuth.message
- @@ -446,0 +476,21 @@476+ lowerOutput.includes("run `claude login`") ||477+ lowerOutput.includes("run claude login")478+ ) {479+ return {480+ status: "error",481+ auth: { status: "unauthenticated" },482+ message: "Claude is not authenticated. Run `claude auth login` and try again.",483+ };484+ }485+486+ const trimmedStdout = result.stdout.trim();487+ let parsedAuth: boolean | undefined;488+ let parsedJson = false;489+ if (trimmedStdout.startsWith("{") || trimmedStdout.startsWith("[")) {490+ try {491+ parsedAuth = extractAuthBoolean(JSON.parse(trimmedStdout) as unknown);492+ parsedJson = true;493+ } catch {494+ // Fall through to the command exit status for non-JSON output.495+ }496+ }
juliusmarminge closed this
Sign in to join this conversation.



Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
8af67dd6-8669-4a8f-9a2a-b2c1516ec4b3You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands.