Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/shared/src/usageLimits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ describe("new thread model fallback", () => {
["antigravity", ["gemini-weekly"], "antigravity-default", true],
["opencode", ["go_weekly"], "opencode/big-pickle", false],
["opencode", ["go_weekly"], "opencode-go/big-pickle", true],
["claudeAgent", ["seven_day_fable"], "claude-opus-5-5", false],
["claudeAgent", ["seven_day_fable"], "claude-fable-5-1", true],
["claudeAgent", ["seven_day", "seven_day_fable"], "claude-opus-5-5", true],
["claudeAgent", ["five_hour"], "claude-opus-5-5", true],
] as const)("matches %s pools %s to %s", (driver, ids, model, usesFallback) => {
const defaultSelection = { ...selection, model };
expect(
Expand Down
8 changes: 8 additions & 0 deletions packages/shared/src/usageLimits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ export function exhaustedUsageWindow(
return exhausted.find(
(window) => !window.id.startsWith("go_") || model.startsWith("opencode-go/"),
);
case "claudeAgent": {
// Model-scoped weekly buckets (`seven_day_<model>`, e.g. Fable) only cap that model.
const slug = model.toLowerCase().replace(/[^a-z0-9]+/g, "_");
return exhausted.find((window) => {
const scope = window.id.match(/^seven_day_(.+)$/)?.[1];
return scope === undefined || slug.includes(scope);
});
}
default:
return exhausted[0];
}
Expand Down
Loading