Skip to content

[Bug]: Used-up Claude monthly extra-usage budget switches new threads to the fallback model #36483

Closed as not planned

Description

@alanpog

Before submitting

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

Area

packages/contracts or packages/shared

Steps to reproduce

  1. Use a Claude subscription with extra usage (overage) enabled and a monthly spend limit.
  2. Use up the monthly extra-usage budget. Claude's rate_limit_event then reports overageStatus: "rejected" with overageDisabledReason: "org_level_disabled_until". The 5-hour and weekly windows still have room (status: "allowed").
  3. Set a fallback model in Settings → Threads, for example a Codex model.
  4. Start a new thread in a project whose default model is a Claude model.

Expected behavior

New threads keep the Claude default model. A used-up extra-usage budget only matters after the plan limits run out, so Claude is not out of usage. The fallback should only apply when a window that actually blocks requests is exhausted.

Actual behavior

The composer switches to the fallback model and shows "Using GPT-6.1-Sol · Claude is out of usage", with no "resets …" time.

The cached Claude provider snapshot at that moment:

[
  { "id": "five_hour", "usedPercent": 18, "resetsAt": "2026-11-14T03:20:00.125Z" },
  { "id": "seven_day", "usedPercent": 4, "resetsAt": "2026-11-20T02:00:00.125Z" },
  { "id": "seven_day_fable", "usedPercent": 0, "resetsAt": "2026-11-20T02:00:00.000Z" },
  { "id": "monthly_spend", "kind": "monthly", "label": "Monthly spend", "usedPercent": 100 }
]

Cause, as I read the 0.1.9 bundle:

  • claudeUsageResponseToLimits (apps/server/src/provider/claudeUsageLimits.ts) adds a monthly_spend window from readSpendPercent, with no resetsAt.
  • exhaustedUsageWindow (packages/shared/src/usageLimits.ts) treats any window with usedPercent >= 100 as exhausted when its resetsAt is missing or in the future. For claudeAgent it returns that window, so the new-thread fallback kicks in.

The server's own turn-blocking logic is already correct here. It only counts Claude as blocked when status === "rejected" and overage is not allowed. Only the new-thread fallback check disagrees.

Related, but neither fixes this:

Suggested fix: leave monthly_spend (extra-usage spend) out of exhaustedUsageWindow for claudeAgent, or only count it when the plan windows are also exhausted.

Impact

Major degradation or frequent failure

Version or commit

0.1.9

Environment

Linux server (remote environment), web client, Claude Agent SDK provider on a Claude subscription, fallback model GPT-6.1-Sol (Codex)

Workaround

Click "Use " on the notice or dismiss it, or clear the Fallback model setting.

Activity

  1. juliusmarminge commented on Nov 14, 2026

    @juliusmarminge
    Member

    I tried to reproduce this on the current build and could not.

    Commit 83ee1f5 (origin/main). A real app run needs a Claude provider signed in with first-party OAuth and a real usage snapshot, which this VM does not have, so I reproduced it at the logic layer the client uses. In packages/shared/src/usageLimits.test.ts ('new thread model fallback'), I called resolveNewThreadModelSelection with a claudeAgent default (claude-opus-5-5), a Codex fallback (gpt-6.1-sol) and the reporter's exact snapshot: five_hour 18%, seven_day 4%, monthly_spend 100% with no resetsAt. Result on main: the selection is the Codex fallback, not the Claude default (vp test run src/usageLimits.test.ts -t "new thread model fallback" gives 1 failed, 32 passed). The test is pushed to factory/repro-36483 (7025b4d).

    Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.

  2. alanpog commented on Nov 14, 2026

    @alanpog
    Author

    Thanks for writing the test. I think it confirms the bug rather than ruling it out: 7025b4d736 expects the Claude default to be kept, and it fails on main (your commit message says the same: "exhaustedUsageWindow counts the monthly_spend window as exhausted for claudeAgent"). Getting the Codex fallback for that snapshot is the behavior I reported. Still happening on 0.1.9. Could you reopen?

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