t3code icon indicating copy to clipboard operation
t3code copied to clipboard

Claude "Monthly spend" limit row disappears after refreshing limits when a CLIProxy usage source is configured

Open diflores opened this issue 1 month ago • 0 comments

What happened

On the Usage page (Limits view, All environments), the Claude card showed a "Monthly spend" row with a bar for each Claude account (99% and 74% left). After I clicked the refresh button, the row disappeared. Session, Weekly, and Weekly · Fable stayed. The server still had the data: both Claude provider status caches held a monthly_spend window after the refresh.

Diagnosis

The hub read never produces a monthly spend window, and the client lets a newer hub read replace the native probe's windows as a whole.

  1. apps/server/src/usage/cliproxyApi.ts (readAccount, Claude branch) builds the get_usage-shaped response from /api/oauth/usage with only five_hour, seven_day, and model_scoped. It never passes spend or extra_usage, so claudeUsageResponseToLimits cannot emit the monthly_spend window that #19433 added for the native probe.
  2. packages/shared/src/usageLimits.ts collectLimitAccounts merges the native provider report and the hub account under the same account key, then takes winner.limits whole from whichever has the newer checkedAt.
  3. Refreshing limits re-reads the hub (UsageLimitSources.readSource), so the hub snapshot becomes the freshest. Its window list has no monthly_spend, and the row disappears. It should come back the next time the native provider probe is newer than the hub read, so the row flickers depending on which reader ran last.

Either fix closes it: map the spend budget in the CLIProxy Claude read, or merge windows per window id across sources instead of taking one source's list whole.

Repro steps

  1. Sign in to Claude on a subscription with a monthly spending limit enabled, so the native probe reports "Monthly spend".
  2. In Settings, add a CLIProxy usage limit source that serves the same Claude account, and enable it.
  3. Open Usage, then Limits. The Claude card shows "Monthly spend".
  4. Click refresh. "Monthly spend" disappears while the other Claude rows remain.

Environment

  • Version: 0.1.1-nightly.20261020.3438 (desktop app, macOS nightly channel), connecting to its local server. Triage CLI was 0.1.1.
  • OS: macOS 26 (Darwin 25.6.0), arm64
  • Usage limit sources: one CLIProxy source on localhost
  • Claude provider instances: two (both lost the row after refresh)

Evidence

  • Server caches and trace confirm the row is dropped client-side.
  • Server trace: UsageLimitSources.readSource ran at the refresh time and succeeded with no error.
  • Both Claude provider status caches still held {"id":"monthly_spend","kind":"monthly","label":"Monthly spend"} with usedPercent 26.43 and 1.02 after the refresh, matching the 74% and 99% bars shown before it.
  • main has no changes to cliproxyApi.ts or the merge logic since the tag.

Related issues

  • #19433 added the monthly spend mapping for the native Claude probe only.
  • #10155 (closed) covers the original request to show the Claude spending budget.

Filed via t3 triage by Claude Code (Claude Opus 5.5).

diflores avatar Oct 21 '26 19:10 diflores