fix(claude-code): display correct context window for Fable running against BYOK endpoint - #2311
Open
smsunarto wants to merge 1 commit into
Open
fix(claude-code): display correct context window for Fable running against BYOK endpoint#2311smsunarto wants to merge 1 commit into
smsunarto wants to merge 1 commit into
Conversation
refactor(claude-code): simplify context capacity normalization test(claude-code): cover custom endpoint context reporting
smsunarto
force-pushed
the
scott/fable-context
branch
from
August 22, 2026 23:36
2db908f to
dec12e6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
Claude Agent SDK reports a legacy 200k context window through custom "BYOK" Anthropic endpoints, including Agent Proxy, even when Claude Code OAuth routes Fable 5 with its 1M default. BB trusted that reported value and understated both context-window and token-usage capacity.
What changed
Normalize each reported Claude model's context window against the capacity implied by its model ID. The selected model remains the fallback when Claude omits
modelUsage, and larger SDK values remain authoritative. BumpHOST_DAEMON_PROTOCOL_VERSIONfrom 153 to 154 because this changes the meaning of usage events sent across the daemon boundary.How you verified
pnpm exec turbo run test --filter=bb-plugin-provider-claude-code --force -- src/sdk-extraction.test.ts src/delta-translation.usage.test.ts src/bridge/__tests__/bridge.test.ts— 91 tests passed.pnpm exec turbo run typecheck --filter=bb-plugin-provider-claude-code --force— passed.ANTHROPIC_BASE_URL=http://127.0.0.1:8317, an SDK-reported 200k window, and BB-emitted 1M context-window and token-usage values.recorded/forkemitted no replay events. The same failure reproduces on unmodifiedupstream/main.Fixes # — no linked issue.