Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): report Claude authentication accurately #7691

ClosedIc3b3rg(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/7691/headopened View on GitHub

What Changed

  • Probe first-party Claude Code authentication with claude auth status using the same configured binary, environment, and CLAUDE_CONFIG_DIR used for chats.
  • Decode the CLI's loggedIn result 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 passed
  • vp 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 existing scripts/build-desktop-artifact.test.ts cross-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

[Cursor Bugbot](https://cursor.com/bugbot) is generating a summary for commit 35ed708b1f0cd52da9131a9fcddc3d5a20382198. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Probe claude auth status in checkClaudeProviderStatus and report CLI auth accurately

  • Adds an auth probe to checkClaudeProviderStatus that runs claude auth status when the CLI version is >= 2.1.41 (MINIMUM_CLAUDE_AUTH_STATUS_VERSION) and no external API provider is configured.
  • Adds decodeClaudeAuthStatus, supportsClaudeAuthStatus, and classifyClaudeAuthStatus helpers to parse the CLI's loggedIn JSON output and map it to authenticated, unauthenticated, or unknown.
  • When the CLI reports logged out, the provider snapshot now returns early with status='error' and auth.status='unauthenticated'; unverifiable status yields status='warning' and auth.status='unknown'.
  • The probe is bounded by AUTH_PROBE_TIMEOUT_MS via Effect.timeoutOption, and CLAUDE_CONFIG_DIR is applied to both --version and auth status invocations.
  • Risk: the early-return path in checkClaudeProviderStatus changes provider snapshot status for logged-out or unknown cases; existing consumers expecting status='ready' when the CLI is installed should verify against the new auth.status field.
Macroscope summarized 35ed708.
    1. Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 5f111e7e-e253-4e45-b723-94a08984adcf

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      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
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      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.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. 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.ts covers CLI email/subscription data when SDK account metadata is absent, config paths containing spaces, and PowerShell login syntax. Build the hint from the same effective CLAUDE_CONFIG_DIR and configured executable used by the auth probe, including instance environment overrides rather than only homePath. 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.

    5. juliusmarminge added labelsmacroscope-review

    6. Note

      Written by claude-opus-5-5 on behalf of Maria

      Hi! 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.

    7. maria-rcks closed this

Sign in to join this conversation.