fix(xai): prefer catalog contextWindow for grok-4.3 (fixes 200k vs 1M) [AI-assisted]#98231
fix(xai): prefer catalog contextWindow for grok-4.3 (fixes 200k vs 1M) [AI-assisted]#98231rufus-vidar wants to merge 1 commit into
Conversation
|
Codex review: needs changes before merge. Reviewed June 30, 2026, 2:22 PM ET / 18:22 UTC. Summary PR surface: Source +3. Total +3 across 1 file. Reproducibility: yes. from source inspection: on current main, a Grok OAuth live row for Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review detailsBest possible solution: Land the provider-local precedence fix with a focused OAuth catalog regression proving known xAI rows keep catalog context windows while unknown OAuth rows still use live values. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: on current main, a Grok OAuth live row for Is this the best way to solve the issue? Yes, this is the right narrow provider-local layer for the OAuth live-row precedence bug. The safer merge shape is the same production change plus a regression test for the OAuth row path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3f147ae5cacc. Label changesLabel justifications:
Evidence reviewedPR surface: Source +3. Total +3 across 1 file. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Thanks for the focused contribution. Closing this because the linked issue was already fixed on #88596 concerned stale API-key/persisted catalog metadata. This code maps the separate Grok OAuth inference proxy. xAI documents The precedence swap also has a concrete regression on current xAI’s public docs confirm Grok 4.3’s 1M direct-API context and 200K pricing threshold, but they do not define the OAuth proxy’s The supported path is to keep live OAuth metadata authoritative. If the proxy exposes both effective and maximum limits, map both like OpenAI; if the direct API path needs repair, consume its documented Thanks @rufus-vidar. |
Related: #88596
What Problem This Solves
Fixes an issue where users selecting xAI Grok models (especially
grok-4.3) would see a context window of ~200k tokens instead of the correct 1,000,000 tokens when the OAuth live discovery path was active.Why This Change Was Made
The static catalog in
model-definitions.tscorrectly definesXAI_DEFAULT_CONTEXT_WINDOW = 1_000_000forgrok-4.3. However,buildXaiOauthModelFromLiveRowinprovider-catalog.tsunconditionally preferred the live API-reportedcontext_windowvalue (~200k–256k) before checking the catalog fallback. Flipping the precedence — catalog first, live value second — makes known models authoritative while still allowing live values for unknown models.User Impact
grok-4.3and other xAI Grok models now correctly report 1,000,000 token context window.Evidence
Before (incorrect):
After (correct):
Diff is minimal — one function in one file (
extensions/xai/provider-catalog.ts,buildXaiOauthModelFromLiveRow):No CHANGELOG edit. All policy requirements followed. This contribution is AI-assisted (Vidar agent, Accordant).