Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(claude): fail turns when Claude Code is logged out #8869

Closednone23(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/8869/headopened View on GitHub

Human review required

This changes Claude authentication classification and remains held for a maintainer decision. It is not approved for automatic merging.

Claude can emit an explicit authentication_failed assistant event followed by a success-subtype result with is_error: true. Preserve the captured login hint and fail the errored turn. The provider probe also distinguishes a signed-out first-party CLI from API-key and external-provider configurations.

The current-main refresh fixes a compatibility gap in the original PR: terminal_reason: api_error already classifies the result as failed, so the old completed-only override discarded the login hint. The override now preserves that hint for failed results too. Interrupted, cancelled, and successful non-error results retain their existing behavior. This does not add a general is_error classification rule.

Related reports: #7690, #7878, #4225, and #6022. No issue is automatically closed by this PR. In particular, the original invisible-message symptom in #4225 has not been reproduced or demonstrated fixed.

Current-main verification

  • Original author head 51bf50e was merged with d7fe47f, preserving the author's commits. The provider conflict retains main's initialization/usage flow and the PR's API-key field; both user-guide sections remain.
  • Before the repair, the author's actual adapter receipt test failed in 88ms. The emitted diagnostic was Claude gave up after repeated API errors., without the promised login hint.
  • After d7ceee0, 151 focused adapter, capability-probe, and registry tests pass. This includes auth results with and without terminal metadata, plus interrupted, cancelled, successful non-error, and non-auth API-error controls.
  • Server typecheck, targeted lint and cumulative diff checks pass. Current-head CI, correctness review, and Bugbot pass. The Approvability check is NEUTRAL, explicitly requiring human review of authentication behavior. It is not described as green. All review threads were read and none remain unresolved.
  • The new proof uses fake SDK messages and typed completion receipts, not sleeps or a paid account. No provider login, logout, or generation was performed during this audit. Web, desktop, and mobile consume the unchanged server status/event contracts.

Original author's native-account evidence

These existing images were inspected and preserved from the author's earlier revision. They are not a new current-main account run. The current refresh changes backend classification and diagnostic text, verified separately by the receipt tests above.

Before: the logged-out reply appears completed without an error.

Original author's logged-out Claude turn before the fix

After: the turn is failed and the login command is visible.

Original author's logged-out Claude turn after the fix

Before: Settings reports the signed-out CLI as authenticated.

Original author's provider settings before the fix

After: Settings reports it as not authenticated.

Original author's provider settings after the fix

Original implementation and native-account evidence by none23, using Claude Code. Current-main regression repair and audit by GPT 6 Astra via Codex in T3 Code.


Note

Medium Risk Changes authentication detection and turn-completion overrides; misreading apiKeySource from the SDK could mark a valid session unauthenticated or miss a logout.

Overview When Claude Code is logged out, the SDK can emit an authentication_failed assistant message and still finish the turn with a success result and is_error: true. ClaudeAdapter now records a login hint from that assistant event and, on the following error result that would otherwise look completed or a generic failed, forces the turn to failed with the shared CLAUDE_UNAUTHENTICATED_MESSAGE (including claude auth login guidance).

Provider status probing adds apiKeySource from the CLI init payload and treats first-party + tokenSource: "none" + no apiKeySource as logged out (Not authenticated), while API-key setups that also report tokenSource: "none" stay ready. User docs describe signing in again, including matching CLAUDE_CONFIG_DIR when the instance uses a custom config path.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit d7ceee04218a5f5cc423403a7874d92f1edb67b2. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Fail Claude Code turns when logged out and surface unauthenticated provider status

  • Captures authentication_failed assistant messages in ClaudeAdapter turn state; when a subsequent error result resolves to completed or failed, the adapter overrides it to failed, emits runtime.error, and uses the stored login guidance as the message. Interrupted and cancelled results are not overridden.
  • Adds an optional API-key source field to ClaudeCapabilitiesProbe so provider status can distinguish an API-key setup from a logged-out first-party CLI. checkClaudeProviderStatus now reports installed/error/unauthenticated with a login command when token source is none and no API-key source is present.
  • Adds docs in providers-claude.md covering the logged-out failure and login commands.
  • Risk: checkClaudeProviderStatus new early-return branch in ClaudeProvider.ts could misclassify a first-party account if the SDK reports a token source the branch does not expect; verify that first-party API-key and unspecified-provider paths still resolve to ready/authenticated.
Macroscope summarized d7ceee0.
    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: 7849efac-aa70-417a-85b3-f4c9c173fd9a

      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

      Warning

      Your free Security trial is over. An organization admin can activate Security or dismiss this notice.


      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 focused fix changes production Claude authentication classification and turn-completion behavior for signed-out accounts. Because authentication-sensitive runtime behavior and SDK account-field interpretation are involved, maintainer review is warranted.

      Not approved because:

      • Monthly spending limit reached (workspace setting). Approvability relies on correctness review in order to determine eligibility
      Review your spending limits in [Billing settings](https://app.macroscope.com/pingdotgg/settings/billing). You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. chatgpt-codex-connector[bot](GitHub profile, opens in a new tab)commented

      Codex Review Summary

      This comment shows the latest Codex review activity on this pull request.

      ReviewStatusCommitReview trigger
      📝 Code Review✅ Completed 2026-08-31T11:00:57.223009Z59d6aa1Manual request
      ℹ️ About Codex in GitHub

      Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

      • Open a pull request for review
      • Mark a draft as ready
      • Comment "@codex review" or "@codex security review".

      Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

    5. 💡 Codex Review

      Here are some automated review suggestions for this pull request.

      Reviewed commit: 59d6aa1f04

      ℹ️ About Codex in GitHub

      Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

      • Open a pull request for review
      • Mark a draft as ready
      • Comment "@codex review".

      If Codex has suggestions, it will comment; otherwise it will react with 👍.

      Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

    6. none23(GitHub profile, opens in a new tab) changed the title

    7. none23(GitHub profile, opens in a new tab) changed the title

    8. Bugbot is paused — on-demand spend limit reached

      Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

      A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

    9. Superseded by #10321, which landed the Claude turn-failure messaging for expired login (and usage limits) on main. The probe-side Settings authenticated/unauthenticated half is still tracked on #7690 — please reopen or continue there if anything unique remains.

    10. Closed as superseded by #10321.

    11. juliusmarminge closed this

Sign in to join this conversation.