fix(server): report Claude authentication accurately #7691
main fromrefs/pull/7691/head·opened View on GitHubWhat Changed#
- Probe first-party Claude Code authentication with
claude auth statususing the same configured binary, environment, andCLAUDE_CONFIG_DIRused for chats. - Decode the CLI's
loggedInresult and report logged-out sessions as unauthenticated instead of trusting stale or incomplete SDK initialization metadata. - Preserve existing behavior for external API providers and Claude Code versions older than 2.1.41; report probe failures as unknown rather than authenticated.
- Add focused regression coverage for logged-out sessions, stale account metadata, CLI compatibility, config-directory propagation, and probe failures.
Why#
T3 could report Claude as ready and authenticated whenever the SDK initialization probe returned a capabilities object, even if the exact CLI environment used for chats was logged out. The first chat then failed with authentication_failed, leaving Settings in direct conflict with the provider process.
This keeps authentication truth at the Claude adapter boundary and follows the CLI's supported auth-status contract without changing client or wire contracts.
Closes #7690.
Testing#
vp test run apps/server/src/provider/Layers/ProviderRegistry.test.ts— 49 passedvp run --filter t3 typecheck— passed (pre-existing Effect suggestions only)- Targeted lint and format checks — passed
vp run -r test— local run stopped on the unrelated existingscripts/build-desktop-artifact.test.tscross-architecture Windows assertion; neither that test nor its implementation is changed by this PR
Checklist#
- This PR is small and focused
- I explained what changed and why
- UI screenshots are not applicable (server-only change)
- Animation/interaction video is not applicable
Implemented with GPT-5.6 Sol in the Codex harness via T3 Code.
Note
Note
Probe claude auth status in checkClaudeProviderStatus and report CLI auth accurately#
- Adds an auth probe to
checkClaudeProviderStatusthat runsclaude auth statuswhen the CLI version is >=2.1.41(MINIMUM_CLAUDE_AUTH_STATUS_VERSION) and no external API provider is configured. - Adds
decodeClaudeAuthStatus,supportsClaudeAuthStatus, andclassifyClaudeAuthStatushelpers to parse the CLI'sloggedInJSON output and map it toauthenticated,unauthenticated, orunknown. - When the CLI reports logged out, the provider snapshot now returns early with
status='error'andauth.status='unauthenticated'; unverifiable status yieldsstatus='warning'andauth.status='unknown'. - The probe is bounded by
AUTH_PROBE_TIMEOUT_MSviaEffect.timeoutOption, andCLAUDE_CONFIG_DIRis applied to both--versionandauth statusinvocations. - Risk: the early-return path in
checkClaudeProviderStatuschanges provider snapshot status for logged-out or unknown cases; existing consumers expectingstatus='ready'when the CLI is installed should verify against the newauth.statusfield.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — This PR adds a production Claude authentication probe and changes provider readiness and selection when the CLI reports logged out or when authentication cannot be verified. Because it directly affects authentication-sensitive access behavior, the change merits human review despite its focused scope and regression coverage.
Notes:
- Diff unchanged. Approvability was decided on eligibility alone.
Note
🤖 GPT-6 Astra (preview) responding on behalf of Theo
This note is part of an automated cleanup pass.
Preserve the account-label and login-guidance cases from #8275 at its head commit.
ProviderRegistry.test.tscovers CLI email/subscription data when SDK account metadata is absent, config paths containing spaces, and PowerShell login syntax. Build the hint from the same effectiveCLAUDE_CONFIG_DIRand configured executable used by the auth probe, including instance environment overrides rather than onlyhomePath. Keep this PR's unknown result on probe failure and its external-backend/version guards. The source cases are recorded here for a focused update, not already ported.juliusmarminge added labelsmacroscope-review
Note
Written by
claude-opus-5-5on behalf of MariaHi! We are cleaning up open PRs, and this one appears to have been created with an older model (
gpt-5.6-sol). If this change is really important, we recommend rebuilding the PR with a newer model if possible.maria-rcks 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 Plus
Run ID:
5f111e7e-e253-4e45-b723-94a08984adcfYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share