[Bug] openai-codex applies one flat 272k context window to every model, including 1M-context models #1597
Replies: 1 comment
|
Verified still present on Extended the cross-provider comparison with the current generated catalog (
* Bedrock lists Two refinements to the original report:
Fix direction, per the repo's rules:
One open question for maintainers before bumping values: whether the |
Uh oh!
There was an error while loading. Please reload this page.
Version: v0.7.4 (
af0b8e00b9f704e834787fd321065ca78281f2aa)Provider:
openai-codex(ChatGPT OAuth)Summary
openai-codexreportscontextWindow: 272000for 12 of its 13 models (the exception isgpt-5.3-codex-sparkat 128000). That constant is applied uniformly, including to modelswhose real window is ~4x larger on every other provider that serves them.
gpt-5.6-solisthe clearest case.
Where it comes from
packages/ai/scripts/generate-models.ts:1948-1953:Twelve of the thirteen Codex entries take
contextWindow: CODEX_CONTEXTverbatim; onlygpt-5.3-codex-sparkcarries its own value. No entry scales with the model's actual window.Two dates suggest the value may not have been re-checked for newer models:
CODEX_CONTEXT = 272000was introduced 2026-01-07 ind893ba7f("fix(ai): clean up openai-codex models and token limits").
gpt-5.6-solwas added to the Codex list on 2026-07-09 in4a0b3de7("add gpt-5.6 model catalogs", add gpt-5.6 model catalogs #361) and inherited the existing constant.
The discrepancy
gpt-5.6-solacross providers, read from a freshly built v0.7.4 catalog:For
gpt-5.1the constant is consistent with that model's published limits(400,000 total - 128,000 output = 272,000). For a 1,050,000-context model the
same subtraction would give 922,000, so the flat constant is not explained by
output reservation for the 5.6 generation.
Why it matters
shouldCompact()(packages/coding-agent/src/core/compaction/compaction.ts:206) comparesusage against
contextWindow - reserveTokens, andcontextWindowis read verbatim from theregistry. If the constant understates the real limit, sessions compact far earlier than
necessary and lose context that the provider would have accepted.
Measurement
A differential test on v0.7.4, same payload and provider, run seconds apart:
gpt-5.6-lunagpt-5.6-solmodels.jsonoverride)Method: a ~1.2 MB text payload (~127k words) attached to a single print-mode prompt
(
-p --no-session --provider openai-codex --model <id> @payload.txt "Reply with exactly one word: ACK"), withgpt-5.6-soloverridden viamodels.jsonmodelOverrides:{ "providers": { "openai-codex": { "modelOverrides": { "gpt-5.6-sol": { "contextWindow": 1050000 } } } } }The Luna run establishes that the payload genuinely exceeds 272k rather than being
truncated somewhere upstream: it triggered the context-overflow path and never reached
the API. The Sol run then shows the Codex backend accepting that same payload.
Caveat: I did not capture exact input token counts, so this demonstrates "accepted well
above 272k", not the precise ceiling. I have not tried to find where the real limit sits.
Reproduction
Possible direction
If the limit does differ per model, the Codex list could carry a per-model context value
(defaulting to
CODEX_CONTEXTwhere unmeasured) rather than a single shared constant,so newly added models do not silently inherit a figure measured for an older generation.
Happy to run further measurements if that would help.
All reactions