Skip to content

[Bug]: Claude instances authenticated with CLAUDE_CODE_OAUTH_TOKEN (claude setup-token) never appear in Usage → Limits, although their sessions stream usable rate-limit windows #24114

Open

Description

@Liri-s29

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Create a token with claude setup-token and a wrapper script that exports CLAUDE_CODE_OAUTH_TOKEN and execs claude. Register the wrapper as a Claude provider instance (binaryPath). Repeat for a second account.
  2. Use both instances normally.
  3. Open Usage → Limits.

Expected behavior

Both accounts show session and weekly bars, or at least a notice saying why they cannot be read.

Actual behavior

Neither account is listed and there is no notice. The boot-time get_usage probe returns rate_limits_available: false for a setup-token session (confirmed by caitlon in #13053), so claudeUsageResponseToLimits marks the instance "unsupported" and collectLimitAccounts and collectLimitNotices both skip it. #18624 fixed the rate_limits_available: true + rate_limits: null shape and explicitly left this case out.

The data is available anyway. A turn on such an instance streams rate_limit_info with unifiedWindows, for example
{"five_hour":{"utilization":0.2,"resetsAt":1792759800},"seven_day":{"utilization":0.59,"resetsAt":1792760400}}
captured today from claude -p ... --output-format stream-json --verbose under a setup-token wrapper. T3 discards streamed windows for an instance marked unsupported.

Suggested fix: treat rate_limits_available: false as "probe unsupported, streamed windows allowed" when apiKeySource is "none" and the token is an OAuth token: show the instance in Limits as soon as a streamed rate_limit_info arrives, and keep the last streamed reading between turns. Keep "unsupported" only for API-key accounts.

Impact: Anyone running several subscriptions through setup-token wrappers (the documented way to use Claude Code on a headless or multi-account machine) has no limit visibility in T3 and cannot pick the account with headroom.

Impact

Major degradation or frequent failure

Version or commit

T3 Code Nightly 0.1.3-nightly.20261023.3553

Environment

macOS (Darwin 25.6.0, arm64), Claude Code CLI 2.1.309, three Claude subscription accounts each behind a setup-token wrapper script registered as its own provider instance.

Logs or stack traces

Stream line from a setup-token session (fields other than the rate-limit window omitted):
"rate_limit_info":{"status":"allowed","rateLimitType":"five_hour","unifiedWindows":{"five_hour":{"utilization":0.2,"resetsAt":1792759800},"seven_day":{"utilization":0.59,"resetsAt":1792760400}}}

Screenshots, recordings, or supporting files

No response

Workaround

No response

Activity

  1. added
    bugSomething is broken or behaving incorrectly.
    needs-triageIssue needs maintainer review and initial categorization.
    on Oct 23, 2026
  2. Liri-s29 commented on Nov 10, 2026

    @Liri-s29
    Author

    Still reproduces on T3 Code Nightly 0.1.9-nightly.20261110.4465 (macOS arm64) with Claude Code 2.1.312, three setup-token accounts behind wrapper scripts.

    Why get_usage says rate_limits_available: false. When auth comes from CLAUDE_CODE_OAUTH_TOKEN, Claude Code gives the token the scopes in CLAUDE_CODE_OAUTH_SCOPES, or ["user:inference"] if that is unset. get_usage only reads plan limits when the scopes include user:profile. The default is the same in 2.1.322.

    The obvious workaround doesn't help. Setting CLAUDE_CODE_OAUTH_SCOPES="user:inference user:profile" in the wrapper flips get_usage to rate_limits_available: true, but rate_limits stays null. All three tokens get HTTP 429 from /api/oauth/usage with retry-after: 3596 (a bogus token gets 401, so they do authenticate). T3 then marks the probe probeFailed, and the streamed windows are still dropped, because the event only has unifiedWindows and no top-level utilization:

    "rate_limit_info":{"status":"allowed","rateLimitType":"seven_day","unifiedWindows":{"seven_day":{"utilization":0.03,"resetsAt":1794574800,"status":"allowed"}}}

    So a user can't work around this. It needs both parts of #24128: the setup-token probeFailed path and the unifiedWindows parsing.

  3. TheOriginalOcyrus commented on Nov 16, 2026

    @TheOriginalOcyrus

    Same here, with some measurements that may help.

    Setup: several Claude subscriptions on one host, each instance signed in with a claude setup-token token
    (CLAUDE_CODE_OAUTH_TOKEN, from a wrapper binary or from --settings <file> in the instance's launch arguments).

    Why it's empty: the provider check's get_usage answers rate_limits_available: false, rate_limits: null under
    a setup-token, so the instance is marked unsupported until a session streams a rate_limit_event.

    T3 already has the data. Running sessions on these instances do update the bars from each rate_limit_event; it is
    only the check's "unsupported" result that blanks them.

    And a token gives the numbers on demand. A one-word turn under a setup-token emits a rate_limit_event with both
    windows in unifiedWindows:

    claude -p "Reply with exactly: ok" --model haiku --output-format stream-json --verbose \
      --no-session-persistence --strict-mcp-config
    
    {"type":"rate_limit_event","rate_limit_info":{"status":"allowed","rateLimitType":"five_hour",
     "unifiedWindows":{"five_hour":{"utilization":0.2,"resetsAt":...,"status":"allowed"},
                       "seven_day":{"utilization":0.35,"resetsAt":...,"status":"allowed"}}}}
    • On a subscription already at its weekly limit, the turn errors but the event still arrives (status: "rejected",
      both windows), so a reading costs no completed turn there.
    • An unused window can be missing from unifiedWindows (we saw only seven_day while the five-hour window was
      empty). Showing that as "not reported" rather than 0% would avoid a false reading.

    Two things that would fix it for token instances:

    1. Keep the last rate_limit_event limits when the provider check comes back unsupported, instead of replacing them
      (this looks like what fix(server): streamed usage limits survive a failed probe #31135 does, so +1 to that).
    2. Optionally, when there is no recent event, take one reading from a minimal turn as above, behind a setting, since it
      spends a few tokens of the window it measures.

    Separately, on macOS the reset-credits read (readAccessToken) returns nothing because the login is in the Keychain,
    not .credentials.json, so that badge never shows on a Mac. Mentioning it in case it's unintended.

  4. hajekvojtech commented on Nov 22, 2026

    @hajekvojtech

    Also hitting this, on today's T3 Code Nightly 0.1.12-nightly.20261122.5071 (macOS 27.2.1, arm64) with Claude Code 2.1.330.

    My setup is a headless Mac mini running T3 as a launchd service. CLAUDE_CODE_OAUTH_TOKEN is set in the service environment because a background service can't reliably unlock the login Keychain. So for an always-on server, a setup-token isn't an edge case: it's the only way to sign in. As a result, Claude never shows up in Usage → Limits, while Codex on the same machine does.

    Same symptoms as above:

    • The provider check's usage_EXPERIMENTAL…({ skipBehaviors: true }) returns rate_limits_available: false, rate_limits: null. tokenSource is CLAUDE_CODE_OAUTH_TOKEN and subscriptionType is empty.
    • During turns, the provider event log gets rate_limit_event with unifiedWindows.seven_day.utilization (0.44–0.45 today), but none of it reaches the Limits tab.

    What matters most here is that this is the main view I use from the iOS app to decide which provider to send work to. With Claude missing, it shows only half the picture. Keeping the last streamed windows when the check comes back unsupported (#31135), and parsing unifiedWindows (#24128), would fix it for us. +1 to getting those in.

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

    bugSomething is broken or behaving incorrectly.needs-triageIssue needs maintainer review and initial categorization.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions