You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Used-up Claude monthly extra-usage budget switches new threads to the fallback model #36483
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
Use a Claude subscription with extra usage (overage) enabled and a monthly spend limit.
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").
Set a fallback model in Settings → Threads, for example a Codex model.
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:
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.
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.
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.
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?
Activity
juliusmarminge commentedon Nov 14, 2026
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.
alanpog commentedon Nov 14, 2026
Thanks for writing the test. I think it confirms the bug rather than ruling it out:
7025b4d736expects 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?