claude-sonnet-4-6 /context reports 200K — same registry-stale bug already fixed for Opus 4.7 in v2.1.117
Claude Code version: 2.1.140 (Windows native build)
What I expected
/context should show 1,000,000 for claude-sonnet-4-6.
Per the 2.1.49 changelog:
Sonnet 4.5 with 1M context is being removed from the Max plan in favor of our frontier Sonnet 4.6 model, which now has 1M context. Please switch in /model.
The same registry-stale bug was already fixed for Opus 4.7 in 2.1.117:
Fixed Opus 4.7 sessions showing inflated /context percentages and autocompacting too early — Claude Code was computing against a 200K context window instead of Opus 4.7's native 1M
That fix doesn't appear to extend to Sonnet 4.6.
What I actually see
With ANTHROPIC_MODEL=claude-sonnet-4-6 (no [1m] suffix), /context reports 200,000 and the modelUsage payload on every result event returns "contextWindow": 200000 regardless of actual input size.
Reproducer
ANTHROPIC_MODEL=claude-sonnet-4-6 \
ANTHROPIC_BASE_URL=<any backend that resolves the model> \
ANTHROPIC_API_KEY=<...> \
claude --bare -p --output-format stream-json --verbose <<< "$(printf 'pad %.0s' {1..100000}) reply with ok"
Inspect the result event's modelUsage["claude-sonnet-4-6"].contextWindow — value is 200000 even when inputTokens exceeds 200,000 and the request succeeded end-to-end.
Empirical confirmation the backend has 1M
A single -p call with inputTokens=321,901 returns rc=0 and the correct answer (model processed the full prompt). At inputTokens=385,833 in a separate test, also rc=0. Multi-turn probe via --continue accumulated content across 5 turns to ~250k user-content with no errors and no actual compaction events emitted in the stream-json. So the backend is honoring 1M; only Claude Code's internal registry is stale.
The CLAUDE_CODE_DISABLE_1M_CONTEXT env var (added in 2.1.50) was confirmed unset on the reporting environment, so the 200,000 value is not coming from that opt-out.
Impact
/contextand/usagedisplay a misleading 200K cap.- Auto-compaction calculations and skill character budget scale off
contextWindow(per the changelog note "Skill character budget now scales with context window (2% of context)"). With a stale 200K registry, these subsystems under-allocate. - Users who want the correct UI display fall back to
ANTHROPIC_MODEL=claude-sonnet-4-6[1m]— but the[1m]suffix is a leftover marker from before Sonnet 4.6 went 1M-native, and downstream proxy routers may treat it as a separate alias rather than resolving it cleanly.
Suggested fix
Update Claude Code's model registry entry for claude-sonnet-4-6 to contextWindow: 1000000, mirroring the 2.1.117 fix for Opus 4.7. While doing so, worth verifying claude-opus-4-7 and any other recent model names don't have the same residue.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗