Skip to content

Commit 4a1919d

Browse files
committed
fix(agents): resolve fable-5 1M context window for claude-cli provider
The resolveAnthropicFixedContextWindow fable-5 guard only matched anthropic and anthropic-vertex providers, leaving claude-cli unhandled. Without this, claude-cli + claude-fable-5 fell through to the GA 1M prefix check where fable-5 doesn't match, returning undefined and causing fallback to the default 200K context window. Both call paths were affected: - resolveContextTokensForModelFromCache (direct) - resolveDiscoveredAnthropicFixedContextWindow (discovery cache upgrade) Same root cause as #100572: new model added to catalog but claude-cli provider boundary was not enumerated. Fix: add provider === 'claude-cli' to the fable-5 guard, matching the pattern already used by the GA 1M guard on the next branch.
1 parent 1898afe commit 4a1919d

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎src/agents/context-resolution.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export function resolveAnthropicFixedContextWindow(
156156
return undefined;
157157
}
158158
if (
159-
(provider === "anthropic" || provider === "anthropic-vertex") &&
159+
(provider === "anthropic" || provider === "anthropic-vertex" || provider === "claude-cli") &&
160160
/^claude-fable-5(?=$|[^a-z0-9])/.test(modelId)
161161
) {
162162
return ANTHROPIC_FABLE_CONTEXT_TOKENS;

‎src/agents/context.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,14 @@ describe("applyDiscoveredContextWindows", () => {
8989
{ id: "claude-cli/claude-opus-4.8-20260514", contextWindow: 200_000 },
9090
{ id: "claude-cli/claude-opus-4.7-20260219", contextWindow: 200_000 },
9191
{ id: "claude-cli/claude-sonnet-4-6", contextWindow: 200_000 },
92+
{ id: "claude-cli/claude-fable-5", contextWindow: 200_000 },
9293
],
9394
});
9495

9596
expect(cache.get("claude-cli/claude-opus-4.8-20260514")).toBe(ANTHROPIC_CONTEXT_1M_TOKENS);
9697
expect(cache.get("claude-cli/claude-opus-4.7-20260219")).toBe(ANTHROPIC_CONTEXT_1M_TOKENS);
9798
expect(cache.get("claude-cli/claude-sonnet-4-6")).toBe(ANTHROPIC_CONTEXT_1M_TOKENS);
99+
expect(cache.get("claude-cli/claude-fable-5")).toBe(ANTHROPIC_FABLE_CONTEXT_TOKENS);
98100
});
99101

100102
it("does not upgrade non-Anthropic GA 1M model ids from discovery", () => {
@@ -425,6 +427,7 @@ describe("resolveContextTokensForModel", () => {
425427
["anthropic", "claude-sonnet-5", ANTHROPIC_SONNET_5_CONTEXT_TOKENS],
426428
["anthropic-vertex", "claude-sonnet-5", ANTHROPIC_SONNET_5_CONTEXT_TOKENS],
427429
["claude-cli", "claude-sonnet-5", ANTHROPIC_SONNET_5_CONTEXT_TOKENS],
430+
["claude-cli", "claude-fable-5", ANTHROPIC_FABLE_CONTEXT_TOKENS],
428431
["anthropic", "claude-sonnet-4-6", ANTHROPIC_CONTEXT_1M_TOKENS],
429432
["anthropic-vertex", "claude-sonnet-4-6", ANTHROPIC_VERTEX_CONTEXT_1M_TOKENS],
430433
])(
@@ -466,6 +469,7 @@ describe("resolveContextTokensForModel", () => {
466469
it.each([
467470
["anthropic", "claude-fable-5"],
468471
["anthropic-vertex", "claude-fable-5"],
472+
["claude-cli", "claude-fable-5"],
469473
["anthropic", "claude-sonnet-4-6"],
470474
["anthropic-vertex", "claude-sonnet-4-6"],
471475
])("honors an authored %s window for fixed model %s", (provider, modelId) => {
@@ -564,6 +568,7 @@ describe("resolveContextTokensForModel", () => {
564568
["anthropic", "claude-sonnet-5", ANTHROPIC_SONNET_5_CONTEXT_TOKENS],
565569
["anthropic-vertex", "claude-sonnet-5", ANTHROPIC_SONNET_5_CONTEXT_TOKENS],
566570
["claude-cli", "claude-sonnet-5", ANTHROPIC_SONNET_5_CONTEXT_TOKENS],
571+
["claude-cli", "claude-fable-5", ANTHROPIC_FABLE_CONTEXT_TOKENS],
567572
["anthropic", "claude-sonnet-4-6", ANTHROPIC_CONTEXT_1M_TOKENS],
568573
["anthropic-vertex", "claude-sonnet-4-6", ANTHROPIC_VERTEX_CONTEXT_1M_TOKENS],
569574
])(

0 commit comments

Comments
 (0)