Skip to content

[Bug]: Usage → Limits shows Claude as "probe failed" until a turn runs, because the capability probe's get_usage returns rate_limits: null #31470

Open

Description

@reyanshdagoat9113

Area: apps/server

I searched existing issues. This overlaps with #30310, #15364 and #28852, so here is what this adds: a reproduction outside T3, the root cause, and what remains after the open PRs.

Steps to reproduce

  1. Windows 11, T3 Code nightly 0.1.8-nightly.20261104.4179, Claude Code CLI 2.1.318, Claude Pro, signed in with the OAuth login (~/.claude/.credentials.json, scopes include user:profile).
  2. Open Usage → Limits. Claude has no windows.
  3. ~/.t3/caches/claudeAgent.json shows the provider as ready and authenticated, but:
\"usageLimits\": { \"windows\": [], \"unavailable\": { \"reason\": \"probeFailed\" } }

Cause

The capability probe (ClaudeProvider.ts, the usage_EXPERIMENTAL_MAY_CHANGE_DO_NOT_RELY_ON_THIS_API_YET({ skipBehaviors: true }) call) starts a Claude session and never sends a prompt. I sent the same control request straight to the CLI, outside T3:

{\"type\":\"control_request\",\"request_id\":\"r1\",\"request\":{\"subtype\":\"get_usage\",\"skip_behaviors\":true}}
When the request is sent Response
Right after startup rate_limits_available: true, rate_limits: null
6 s and 12 s later, still no prompt rate_limits_available: true, rate_limits: null
After one tiny haiku message rate_limits: { five_hour: { utilization: 4, ... }, seven_day: { utilization: 4, ... } }

So it is not timing and not auth. In this CLI version rate_limits seems to be filled only from the response headers of a real API call in that session, so a probe that never sends a prompt always gets null. That is an inference from the three runs above. I did not test older CLI versions.

The login and the endpoint are fine: GET https://api.anthropic.com/api/oauth/usage with the same token and anthropic-beta: oauth-2025-04-20 returns HTTP 200 with five_hour and seven_day utilization.

claudeUsageResponseToLimits turns rate_limits_available: true plus rate_limits: null into probeFailed. That is the behavior chosen in #15364. It keeps Claude in the list, but there are no numbers.

Expected behavior

Limits are visible without first having to run a turn, or the UI says it is waiting for the first request rather than reporting a failure.

Actual behavior

On a fresh session Claude shows "probe failed" with no windows. Real turns stream rate_limit_events with usable numbers, but they were being dropped (see below).

The same session logs show those events carry no top-level utilization, only unifiedWindows:

\"rate_limit_info\":{\"status\":\"allowed\",\"resetsAt\":1793824800,\"rateLimitType\":\"five_hour\",\"overageStatus\":\"rejected\",\"overageDisabledReason\":\"org_level_disabled\",\"isUsingOverage\":false,\"unifiedWindows\":{\"five_hour\":{\"utilization\":0.03,\"resetsAt\":1793824800,\"status\":\"allowed\"},\"seven_day\":{\"utilization\":0.04,\"resetsAt\":1793966400,\"status\":\"allowed\"}}}

Related work

I believe #28869 does not cover this issue, because it only changes the per-event mapping. Its runtime test uses a stub that answers `/api/oauth/usage`, so it does not exercise the CLI returning `rate_limits: null`. I have not run #28869 against CLI 2.1.318, so I can't confirm the tab fills in after the first turn.

Possible directions

These are suggestions only; the right one is a maintainer call.

  1. When `get_usage` returns `rate_limits: null`, read `/api/oauth/usage` with the stored OAuth token, as `readClaudeResetCredits` already does for reset credits.
  2. Keep the current mapping, but show "waiting for first request" instead of a probe failure. Then fill in from the first `rate_limit_event`.
  3. Make the probe send a minimal prompt. I'd avoid this, since it spends tokens on every refresh.

Impact

Minor bug or occasional failure. The windows appear after the first turn once streamed events are mapped, but until then the tab reports a failure on an otherwise healthy login.

Activity

  1. bulai0408 commented on Nov 23, 2026

    @bulai0408

    Same symptom on macOS with a newer CLI and a Team plan, plus one detail that changes the cause described above.

    Environment

    • macOS, T3 Code 0.1.12-nightly.20261122.5111
    • Claude Code CLI 2.1.330, installed and managed by an organization (system managed-settings.json, auto-updater disabled)
    • Claude Team plan, OAuth login (initialize reports apiProvider: firstParty, subscriptionType: Claude Team)
    • Usage → Limits shows "Claude: Could not read limits." on every refresh

    Reproduction outside T3

    I spawned the CLI the way the capability probe does and sent the same control requests, with no prompt:

    claude -p --input-format stream-json --output-format stream-json --verbose --debug-file <file>
    {"type":"control_request","request_id":"i1","request":{"subtype":"initialize"}}
    {"type":"control_request","request_id":"u1","request":{"subtype":"get_usage","skip_behaviors":true}}
    
    When get_usage is sent Response
    Right after initialize (answered about 4.5 s after spawn) rate_limits_available: true, rate_limits: null
    12 s later, same process rate_limits_available: true, rate_limits: null (answered in about 0.5 s)

    What is new here

    In CLI 2.1.330 the probe path does not rely only on response headers. The debug log shows that each get_usage makes the CLI request the endpoint itself:

    [DEBUG] fetchUtilization: GET /api/oauth/usage (attempt 1)
    

    A successful read logs fetchUtilization: 200 after N attempt(s). That line never appears. Neither does any failure line: no Failed to load usage data, no remembered for this bearer, no fieldless-body error. The CLI's own endpoint read fails silently in SDK mode. Since the session has no response headers yet, get_usage returns rate_limits: null. The CLI also never writes cachedUsageUtilization to ~/.claude.json, which it does after a successful read.

    Things I ruled out:

    • Network. An unauthenticated request to https://api.anthropic.com/api/oauth/usage from the same machine returns HTTP 401 in about 1.1 s.
    • Organization policy. The org's policy-limits.json has no usage-related restriction, and the nonessential-traffic setting does not stop the request. The GET above still goes out.
    • The interactive CLI. In an interactive session the statusline payload has rate_limits.five_hour and rate_limits.seven_day. That payload is built from response headers (Ife() in the bundle), not from the endpoint.

    I could not get the HTTP status of the failing CLI read, because the CLI writes that error only to its error sink, not to the debug file. My guess is that the cause is in the SDK-mode OAuth credential gating around that request (gateToSessionOAuthCredential). I have not confirmed this.

    Effect on the suggested directions

    Direction 1 above (read /api/oauth/usage with the stored OAuth token when rate_limits is null) would not work on macOS as written. readAccessToken in claudeResetCredits.ts returns undefined when the platform is darwin, because the token lives in the Keychain (Claude Code-credentials) and not in .credentials.json. A fallback for macOS needs a Keychain read, or the CLI's SDK-mode read needs fixing upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions