fix(providers): give Claude 4.6/4.7 their 1M context windows - #839
fix(providers): give Claude 4.6/4.7 their 1M context windows#839MilkClouds wants to merge 1 commit into
Conversation
ANTHROPIC_MODEL_CONTEXT_WINDOWS omitted claude-opus-4-7, claude-opus-4-6, and claude-sonnet-4-6 even though all three ship in ANTHROPIC_MODELS. Without a window those models advertise max_input_tokens: null, shouldMarkOneMillion() rejects them on its typeof guard, and buildAnthropicModelInfos never emits the [1m] picker row — so Claude Code accounts them at its 200k default instead of the 1M Anthropic documents for all three. Also guard the whole roster: every model in the anthropic provider's list must carry a context window, so the next model addition cannot repeat the omission. The loop was driven red against the unfixed map before landing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MqLtuGeb1Mb2izcYRZXgT4
📝 WalkthroughWalkthroughThe registry adds 1,000,000-token context windows for Claude Opus 4.7, Opus 4.6, and Sonnet 4.6. Parity tests verify these entries and require positive context windows for all configured Anthropic models. ChangesAnthropic context metadata
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/providers/registry.ts`:
- Line 217: Align the Claude Sonnet 4.6 context-window limit across
ANTHROPIC_MODEL_CONTEXT_WINDOWS, the overrides in generate-jawcode-metadata.ts,
and related tests by choosing one supported value. Keep claude-sonnet-4-6
consistent between catalog generation and direct provider configuration, and do
not add a [1m] variant unless the Anthropic registry exposes and routes that
model ID.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: f26daa53-2a85-4862-a906-9f44e308211c
📒 Files selected for processing (2)
src/providers/registry.tstests/provider-registry-parity.test.ts
| // devlog/_plan/260710_provider_hardening/001_research_frontier.md. | ||
| const ANTHROPIC_MODELS = ["claude-fable-5", "claude-sonnet-5", "claude-opus-5", "claude-opus-4-8", "claude-opus-4-7", "claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5"]; | ||
| const ANTHROPIC_MODEL_CONTEXT_WINDOWS: Record<string, number> = { "claude-sonnet-5": 1_000_000, "claude-fable-5": 1_000_000, "claude-opus-5": 1_000_000, "claude-opus-4-8": 1_000_000, "claude-haiku-4-5": 200_000 }; | ||
| const ANTHROPIC_MODEL_CONTEXT_WINDOWS: Record<string, number> = { "claude-sonnet-5": 1_000_000, "claude-fable-5": 1_000_000, "claude-opus-5": 1_000_000, "claude-opus-4-8": 1_000_000, "claude-opus-4-7": 1_000_000, "claude-opus-4-6": 1_000_000, "claude-sonnet-4-6": 1_000_000, "claude-haiku-4-5": 200_000 }; |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n 'claude-(opus-4-7|opus-4-6|sonnet-4-6)(\[1m\])?' \
src/providers/registry.ts \
src/generated/jawcode-model-metadata.tsRepository: lidge-jun/opencodex
Length of output: 13756
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- registry context ---'
sed -n '190,235p' src/providers/registry.ts
printf '%s\n' '--- metadata symbols and consumers ---'
rg -n -C 3 'jawcode-model-metadata|MODEL_CONTEXT_WINDOWS|contextWindow|context_window|claude-sonnet-4-6' \
src package.json README.md 2>/dev/null | head -n 240
printf '%s\n' '--- generated-file provenance ---'
rg -n -i -C 3 'jawcode-model-metadata|model metadata|generate.*metadata|metadata.*generat' \
. --glob '!src/generated/jawcode-model-metadata.ts' --glob '!node_modules' --glob '!dist' --glob '!build' | head -n 240Repository: lidge-jun/opencodex
Length of output: 50377
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- generated metadata import and catalog merge ---'
rg -n -C 8 'jawcodeModelMetadata|JawcodeModelMetadata|apply.*Metadata|contextWindow.*metadata|metadata.*contextWindow|modelContextWindows' \
src/codex/catalog.ts src/providers src/router.ts
printf '%s\n' '--- Anthropic registry entries ---'
rg -n -C 18 'anthropic-apikey|anthropic-oauth|ANTHROPIC_MODEL_CONTEXT_WINDOWS|ANTHROPIC_MODELS' \
src/providers/registry.ts
printf '%s\n' '--- generator source ---'
sed -n '1,180p' scripts/generate-jawcode-metadata.ts
printf '%s\n' '--- catalog contract and resync notes ---'
sed -n '30,58p' devlog/_chase/_model/002_catalog_contract.md
sed -n '84,94p' devlog/_chase/_model/008_logic_delta.md
sed -n '70,110p' devlog/_plan/260730_remote_issue_merge_round/090_generated_metadata_resync.mdRepository: lidge-jun/opencodex
Length of output: 50375
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- catalog metadata application ---'
rg -n -C 14 'augmentRoutedModelsWithJawcodeMetadata|applyProviderConfigHints|jawcode|metadata' \
src/codex/catalog/provider-fetch.ts src/codex/catalog/*.ts | head -n 260
printf '%s\n' '--- catalog model construction and precedence ---'
rg -n -C 12 'modelContextWindows|contextWindow|context_window' \
src/codex/catalog/provider-fetch.ts src/codex/catalog/aggregation.ts src/codex/catalog/parsing.ts | head -n 260
printf '%s\n' '--- generator input and output contract ---'
cat -n scripts/generate-jawcode-metadata.ts | sed -n '1,150p'
printf '%s\n' '--- direct source-of-truth statements ---'
rg -n -C 3 'PROVIDER_REGISTRY.*(source|truth|authoritative)|registry.*(source|truth|authoritative)|generated.*metadata.*(hint|snapshot)|context.*(registry|generator)' \
devlog docs-site src | head -n 220Repository: lidge-jun/opencodex
Length of output: 50375
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- jawcode augmentation implementation ---'
rg -n 'function augmentRoutedModelsWithJawcodeMetadata|export function augmentRoutedModelsWithJawcodeMetadata|listJawcodeModelMetadata|getJawcodeModelMetadata' \
src/codex/catalog/provider-fetch.ts
sed -n '600,700p' src/codex/catalog/provider-fetch.ts
printf '%s\n' '--- metadata lookup and model merge calls ---'
rg -n -C 10 'augmentRoutedModelsWithJawcodeMetadata|applyProviderConfigHints\(.*metadata|metadata.*contextWindow|contextWindow.*metadata' \
src/codex/catalog/provider-fetch.ts
printf '%s\n' '--- generator override application ---'
sed -n '80,180p' scripts/generate-jawcode-metadata.ts
printf '%s\n' '--- relevant tests ---'
rg -n -C 8 'jawcode.*metadata|sonnet-4-6|contextWindow.*200.?000|contextWindow.*1.?000.?000' \
tests src --glob '*test*' --glob '*.spec.*' | head -n 280Repository: lidge-jun/opencodex
Length of output: 36362
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '842,930p' src/codex/catalog/provider-fetch.ts
sed -n '930,1010p' src/codex/catalog/provider-fetch.ts
printf '%s\n' '--- exact catalog parity assertions ---'
sed -n '590,625p' tests/provider-registry-parity.test.ts
printf '%s\n' '--- generator override references and rationale ---'
rg -n -C 8 'CONTEXT_WINDOW_OVERRIDES|claude-sonnet-4-6\[1m\]|claude-sonnet-4-6.*200' \
scripts tests devlog src --glob '!src/generated/jawcode-model-metadata.ts'Repository: lidge-jun/opencodex
Length of output: 17502
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
import re
from pathlib import Path
registry = Path("src/providers/registry.ts").read_text()
generator = Path("scripts/generate-jawcode-metadata.ts").read_text()
metadata = Path("src/generated/jawcode-model-metadata.ts").read_text()
catalog = Path("src/codex/catalog/provider-fetch.ts").read_text()
def value(pattern, text, label):
match = re.search(pattern, text)
if not match:
raise SystemExit(f"missing {label}")
return int(match.group(1).replace("_", ""))
registry_window = value(
r'"claude-sonnet-4-6"\s*:\s*([0-9_]+)',
registry,
"registry window",
)
override_window = value(
r'"anthropic/claude-sonnet-4-6"\s*:\s*([0-9_]+)',
generator,
"generator override",
)
metadata_match = re.search(
r'\["claude-sonnet-4-6",\s*([0-9]+).*?\]\s*,\s*\["claude-sonnet-4-6\[1m\]",\s*([0-9]+)',
metadata,
)
if not metadata_match:
raise SystemExit("missing generated metadata rows")
metadata_window = int(metadata_match.group(1))
metadata_1m_window = int(metadata_match.group(2))
if "Math.min(model.contextWindow, configuredCap)" not in catalog:
raise SystemExit("missing lower-bound merge rule")
effective_catalog_window = min(metadata_window, registry_window)
print({
"registry": registry_window,
"generator_override": override_window,
"generated_base": metadata_window,
"generated_1m": metadata_1m_window,
"effective_catalog_window": effective_catalog_window,
})
assert registry_window == 1_000_000
assert override_window == 200_000
assert metadata_window == 200_000
assert metadata_1m_window == 200_000
assert effective_catalog_window == 200_000Repository: lidge-jun/opencodex
Length of output: 382
Align the Claude Sonnet 4.6 context-window contract.
src/providers/registry.ts:217 sets claude-sonnet-4-6 to 1_000_000, while scripts/generate-jawcode-metadata.ts:30-32 intentionally overrides both generated IDs to 200_000. The catalog merge therefore uses 200_000, but direct provider configuration uses 1_000_000. Choose one supported limit and align the registry, generator override, and related tests. Do not add a [1m] variant unless the Anthropic registry exposes and routes that ID.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/providers/registry.ts` at line 217, Align the Claude Sonnet 4.6
context-window limit across ANTHROPIC_MODEL_CONTEXT_WINDOWS, the overrides in
generate-jawcode-metadata.ts, and related tests by choosing one supported value.
Keep claude-sonnet-4-6 consistent between catalog generation and direct provider
configuration, and do not add a [1m] variant unless the Anthropic registry
exposes and routes that model ID.
Summary
ANTHROPIC_MODEL_CONTEXT_WINDOWSomitsclaude-opus-4-7,claude-opus-4-6, andclaude-sonnet-4-6, although all three ship inANTHROPIC_MODELS. Anthropic documents all three at 1M.max_input_tokens: null,shouldMarkOneMillion()rejects them on itstypeof window !== "number"guard, andbuildAnthropicModelInfos()never emits the[1m]picker row. Claude Code then accounts them at its 200k default, so the extra context is unreachable from the/modelpicker.buildClaudeContextWindows()skips them for the same reason, so they are also absent from/api/claude-codecontextWindows.Observed on 2.7.43 with an OAuth (Claude subscription) anthropic provider.
/v1/modelsbefore:After, each of the three gains its
· 1Mrow (24 advertised models to 27).User config cannot work around this:
OAUTH_RECONCILE_FIELDSincludesmodelContextWindows, so a hand-added entry inproviders.anthropicis reconciled back to the registry value on the nextocx start.The parity test also gains a roster-wide guard, so a future model added to
ANTHROPIC_MODELSwithout a window fails instead of silently losing its[1m]row.Verification
bun run typecheck— clean.bun test tests/provider-registry-parity.test.ts— 31 pass.bun run privacy:scan— passed.bun run test— 6420 pass / 6 skip / 8 fail / 5 errors. All 8 failures and 5 errors reproduce on unmodifiedupstream/devin this environment: 3 intests/cli-help.test.tsandtests/service.test.ts(service/CLI diagnostics), and 5 module-resolution errors fromgui/React deps not installed locally. None touch this change; the four files nearest to it (provider-registry-parity,claude-model-info,desktop-3p,oauth-provider-reconcile) are 61 pass / 0 fail.Checklist
Summary by CodeRabbit
New Features
Bug Fixes