Skip to content

fix(shared): a model-scoped Claude limit no longer blocks other Claude models - #32016

Open
na-zar wants to merge 1 commit into
pingdotgg:mainfrom
na-zar:fix/claude-model-scoped-limit
Open

na-zar wants to merge 1 commit into
pingdotgg:mainfrom
na-zar:fix/claude-model-scoped-limit

Conversation

@na-zar

@na-zar na-zar commented Nov 6, 2026

Copy link
Copy Markdown

Problem

When Claude's model-scoped weekly bucket is used up (Weekly · Fable, window id seven_day_fable), T3 Code treats every Claude model as out of usage. New-thread selection falls back to the other provider, and text generation skips Claude, even though models such as Opus 5.5 still work. Reproduction details: #32015.

The cause is exhaustedUsageWindow in packages/shared/src/usageLimits.ts. It has model-aware cases for cursor, antigravity and opencode, but claudeAgent falls through to default: return exhausted[0].

Change

Add a claudeAgent case. A seven_day_<model> window, which claudeUsageResponseToLimits builds from the CLI's model_scoped entries, now blocks only a selected model whose slug contains that model name. For example, seven_day_fable blocks claude-fable-5-1 but not claude-opus-5-5. Session (five_hour), overall Weekly (seven_day) and Monthly spend still block every Claude model, as before.

Scope and approval

Fixes #32015. This is a small, focused fix for an obvious bug: one switch case beside the existing per-driver cases, plus table rows in the existing test. It changes no contracts or UI.

Verification

  • Added four claudeAgent rows to the existing "matches %s pools %s to %s" table in packages/shared/src/usageLimits.test.ts:
    • Fable bucket at 100% with Opus selected: Opus stays selected.
    • Fable bucket at 100% with Fable selected: falls back.
    • Overall seven_day at 100% with Opus selected: falls back.
    • five_hour at 100% with Opus selected: falls back.
  • vp test run packages/shared/src/usageLimits.test.ts: 66 passed. With the fix reverted, the Fable-bucket/Opus row fails as expected (1 failed, 65 passed).
  • vp check on both files and vp run typecheck in packages/shared both pass.
  • Not checked: the running app against a live account whose Fable limit is used up.

Written with Claude Opus 5.5 in Claude Code.

🤖 Generated with Claude Code

…e models

A used-up "Weekly · Fable" bucket (seven_day_fable) made exhaustedUsageWindow
treat every Claude model as out of usage, because claudeAgent fell through to
the default case. Match seven_day_<model> windows to the selected model, as
the cursor, antigravity and opencode cases already do.

Fixes pingdotgg#32015

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 6, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at b41ef48

Macroscope's review found this PR approvable — Claude model-specific weekly limits now affect only the matching model, preventing unnecessary fallback for other Claude models. Global limits and existing provider eligibility safeguards remain unchanged.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Claude Agent fallback selection now filters model-scoped weekly usage windows using the specified model. Tests cover Fable and Opus model cases.

Changes: Claude usage fallback

Layer / File(s) Summary
Filter exhausted windows by model
packages/shared/src/usageLimits.ts, packages/shared/src/usageLimits.test.ts
exhaustedUsageWindow excludes model-scoped weekly windows when their scope does not match the specified Claude model. Tests cover Fable and Opus models, plus exhausted session and weekly windows.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

Suggested labels: bugfix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to b41ef

Model-specific limits are filtered for the selected Claude model. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly describes the fix for model-scoped Claude limits.
Description check Passed The description covers the problem, change, scope, approval rationale, verification results, and unchecked live scenario. It identifies the model and harness.
Linked Issues check Passed [#32015] exhaustedUsageWindow matches model-scoped Claude weekly windows against the selected model. Other exhausted windows still apply to all models. The fallback tests cover Fable and Opus, overa…
Out of Scope Changes check Passed [#32015] The shared limit check and fallback tests directly support the Claude model-scoped usage fix. The summary identifies no unrelated changes.
Full details: Linked Issues check

Explanation

[#32015] exhaustedUsageWindow matches model-scoped Claude weekly windows against the selected model. Other exhausted windows still apply to all models. The fallback tests cover Fable and Opus, overall weekly usage, and session usage. The shared function also addresses the reported server selection path.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 6577c6b and b41ef48.

Files selected for processing: 2

  • packages/shared/src/usageLimits.test.ts
  • packages/shared/src/usageLimits.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@juliusmarminge juliusmarminge added bugfix Fix PR opened by an issue lead; enters the PR loop pr:gate-failed A land gate failed labels Nov 6, 2026
@saviocmc

saviocmc commented Nov 7, 2026

Copy link
Copy Markdown

Note

Written by Claude Opus 5.5 in Claude Code, on behalf of saviocmc.

This is the same fix as #28676, opened on Nov 1: the same claudeAgent case in exhaustedUsageWindow, with only a code comment added here. I'm not the author of either PR. I hit this bug and tested the fix.

Both PRs list a live check against an account with a spent Fable limit as not done. I ran that check on #28676 with Weekly · Fable at 0% left and the account-wide weekly at 42% left. With Fable as the default and Opus as the fallback, a new thread started on Fable before the change and on Opus 5.5 after it, with the fallback notice. Since the logic is identical, the same result applies here. Details and screenshots: #28676 (comment)

This branch has not been deployed

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

Labels

bugfix Fix PR opened by an issue lead; enters the PR loop pr:gate-failed A land gate failed size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Exhausted Fable weekly limit marks all Claude models as out of usage

3 participants