config.toml context window settings are not respected

Resolved 💬 24 comments Opened Apr 23, 2026 by kkellyoffical Closed Apr 24, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What happened?

The context-related settings in config.toml do not appear to take effect. I tried configuring Codex from:

C:\Users\12768\.codex\config.toml

Relevant settings:

model = "gpt-5.5"
model_reasoning_effort = "high"
model_context_window = 960000
model_auto_compact_token_limit = 800000

After setting a large context window, for example around 1M, Codex still automatically reports/uses about 258k instead. This makes it impossible to control the effective context window from the config file.

Expected behavior

model_context_window and model_auto_compact_token_limit should be honored, or Codex should report a clear validation/error message if the configured value exceeds the supported model/client limit.

Actual behavior

The configured value is silently reduced/ignored. For example, setting approximately 1M results in Codex automatically changing/using about 258k.

Environment

  • OS: Windows
  • Config path: C:\Users\12768\.codex\config.toml
  • Model configured: gpt-5.5

Why this matters

Users cannot reliably control context behavior through config.toml, and the silent conversion makes it difficult to understand whether the setting is unsupported, capped by the model, capped by the client, or being parsed incorrectly.

View original on GitHub ↗

24 Comments

github-actions[bot] contributor · 2 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #19142
  • #19116
  • #19183

Powered by Codex Action

LukyPlay · 2 months ago

gpt 5.5 doesn't have 1m context window with codex :(

litaotju · 2 months ago

I can reproduce/confirm this on Codex Desktop for macOS as well, and it looks like the config is being loaded but then clamped by model metadata rather than ignored.

Environment I checked:

  • Codex.app: 26.422.20832
  • Bundled CLI: codex-cli 0.124.0-alpha.2
  • Model: gpt-5.5
  • Config included:
model = "gpt-5.5"
model_context_window = 1050000
model_auto_compact_token_limit = 900000

Observed model metadata from the installed app:

| model | context_window | max_context_window | effective_context_window_percent |
|---|---:|---:|---:|
| gpt-5.4 | 272000 | 1000000 | 95 |
| gpt-5.5 | 272000 | 272000 | 95 |
| crest-alpha | 272000 | 272000 | 95 |

The relevant source path appears to be with_config_overrides, which clamps the configured context window to max_context_window:

https://github.com/openai/codex/blob/3f8c06e457e1d2d9faa907738e97c0c5d3ab5bd5/codex-rs/models-manager/src/model_info.rs#L29-L36

So for gpt-5.5, model_context_window = 1050000 becomes min(1050000, 272000) = 272000. Then the effective context shown/used is further reduced by effective_context_window_percent = 95, which explains the ~258400 number.

The struct docs also describe max_context_window as the maximum allowed for config overrides:

https://github.com/openai/codex/blob/3f8c06e457e1d2d9faa907738e97c0c5d3ab5bd5/codex-rs/protocol/src/openai_models.rs#L279-L285

And auto-compact is similarly capped to 90% of the resolved context window:

https://github.com/openai/codex/blob/3f8c06e457e1d2d9faa907738e97c0c5d3ab5bd5/codex-rs/protocol/src/openai_models.rs#L310-L318

This makes the current behavior understandable but surprising: gpt-5.4 can use 1M because its catalog entry advertises max_context_window = 1000000; gpt-5.5 cannot because its catalog entry advertises max_context_window = 272000.

Expected improvement: if this is intentional because gpt-5.5 does not currently support 1M in Codex, Codex should surface a clear warning/status message when config values are clamped, e.g. model_context_window=1050000 was reduced to 272000 because gpt-5.5 max_context_window is 272000. If gpt-5.5 is supposed to support 1M, then the model catalog entry likely needs to advertise the larger max_context_window.

drixs2050 · 2 months ago

setting to 400000 is not working as well

MeXenon · 2 months ago

This looks like a real joke. 258,000 is not a thing that you can rely on for heavy-duty work, complex or long projects or planning It's absolutely disappointing.

mark-99 · 2 months ago

1M being available on 5.5 would be nice but the actual bug here is it's supposed to be 400k (which is more tolerable at least).

So currently you can have 5.4 @ 1M or 5.5 @ 272k, but not 5.5 @ 1M or even the advertised 5.5 @ 400k.

astandrik · 2 months ago

258k in 2026 is a real nonsense

MeXenon · 2 months ago

<img width="679" height="196" alt="Image" src="https://github.com/user-attachments/assets/872be77f-022a-4e88-86c7-05224d0d104f" />

Honestly absurd.

A model marketed for complex coding and research gets capped at 258k, and nobody has even said why.
So what exactly is “real-world work ...” supposed to mean here?

Still nothing. No response, no fix!!

defteame · 2 months ago

so it seems even pro accounts have 258k limit? this is an absolute scam

etraut-openai contributor · 2 months ago

Codex supports a 400K context window for gpt-5.5. Of the 400K, there is 272K for input and 128K reserved for output tokens. We trigger auto-compaction at the 90% mark, which is 258K. Auto-compaction allows you to run extremely long sessions. I run sessions that take days and involve hundreds of auto compaction cycles.

A 400K context size (with a 258K auto-compaction trigger) is the same default setting used by previous models including gpt-5.4, gpt-5.3-codex, and gpt-5.2. We did offer a larger context window as an option for gpt-5.4, but many users reported problems when using this feature. You will generally get much better results, even with gpt-5.4, by using the default context window size and relying on auto-compaction for long-running tasks.

mark-99 · 2 months ago

@etraut-openai thanks for your response, however:

  1. It's misleading to refer to "sum of input and output" as the "context window". When people talk about context window they mean input - that's what's displayed in codex/claude code as context usage meter, it's the model_context_window in config.toml, when we talk about 1M context that means input, etc.. Summing input & output to get a larger number seems like marketing so let's not do that.
  2. GPT 5.5 is showing double the scores for long context retrieval than 5.4 so 1M is absolutely feasible in this model vs 5.4.
  3. My understanding is 1M will be offered on API/enterprise just not on subscription, so again seems like it's viable.
  4. Auto-compaction part-way through long-running tasks is absolutely not better than long context - compaction loses all the detail of what's been done so far and that is still to do (even if there is an on-disk plan to follow, which isn't always the case). At best the model has to burn more tokens trying to figure out where it was up to, and at worst it makes mistakes as a result of the lost context.

So we have a choice 5.4 which is bad at long context but can do 1M, or 5.5 which is good at long context but it's not available. How does this make sense?

The overall result is that (at least on subscription plans) codex + gpt 5.5 can't compete with Opus 4.6/4.7 which are 1M by default now. This doesn't seem like a good outcome for OpenAI.

etraut-openai contributor · 2 months ago

@mark-99, thanks for the feedback.

There are a couple of different concepts that are getting conflated here, which is understandable because we're sometimes sloppy about using the term "context window" to mean different things in different contexts. When we talk about the context window capabilities of a model, we're talking about the total context that it supports.

When a model is used in the context of Codex (or any other agent harness), that total context window needs to be managed to avoid overflow. That leads to the need to distinguish between input and output token capacities.

There are many factors that go into decisions about which context window sizes to support — including model capabilities, hardware capacity, hosting costs, user needs, etc.

Someone has opened a feature request: #19464. We'll use that to gather additional feedback and upvotes on this topic. Let's keep the discussion going there.

MeXenon · 2 months ago

@etraut-openai Thanks for the clarification.

I don’t want to get into the side arguments here, but I do want to emphasize the main point: larger configurable context is one of the most important features for real-world Codex usage right now.

Most serious competitors already support much larger context windows, and GPT-5.5 appears to be a model that could benefit from that capability. It is reasonable to keep the current 258K auto-compaction behavior as the default, but users should still have the freedom to override it when their workflow requires it.

There is no single setting that works for every user and every project. For large codebases, tightly connected files, long debugging sessions, migrations, planning, and multi-step development work, losing context through compaction can be a major problem. Auto-compaction is useful, but it is not a replacement for true long context. It can make the model lose important details, drift from the task, or force the user to spend extra time re-explaining what was already known.

Please consider bringing back support for a larger optional context window, especially for users who explicitly configure it and understand the tradeoffs. The default can stay conservative, but advanced users should not be blocked from choosing the larger context window when they need it.

I hope this feature returns soon.

miraclebakelaser contributor · 2 months ago

(this message applies only to api key users who want long contexts)

FYI @litaotju you can use a custom models.json file to fix your issue. In config.toml, set model_catalog_json=<path to your models.json>. Copy the contents of ~/.codex/models_cache.json into that your custom models.json. For gpt-5.5, set "max_context_window": 1000000. I tested long contexts with this solution, it works as you'd expect.

Using a custom models.json is handy. I also use it to clean up my model picker of models I don't use.

astandrik · 2 months ago
(this message applies only to api key users who want long contexts) FYI @litaotju you can use a custom models.json file to fix your issue. In config.toml, set model_catalog_json=<path to your models.json>. Copy the contents of ~/.codex/models_cache.json into that your custom models.json. For gpt-5.5, set "max_context_window": 1000000. I tested long contexts with this solution, it works as you'd expect. Using a custom models.json is handy. I also use it to clean up my model picker of models I don't use.

Tried it - but it only leads to that codex shows "context window out of bounds" eventually
(pro subscription, not api)

miraclebakelaser contributor · 2 months ago

@astandrik Yep. Looks like there's a server-side gate for long context.

kkellyoffical · 2 months ago

So, is the subscription plan useful?

---- Replied Message ----
From @.> Date 04/25/2026 16:15 To @.> Cc @.>@.> Subject Re: [openai/codex] config.toml context window settings are not respected (Issue #19185)
miraclebakelaser left a comment (openai/codex#19185)
@astandrik Yep. Looks like there's a server-side gate for long context.

Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: @.***>

MeXenon · 2 months ago
So, is the subscription plan useful? […](#)

It doesn't matter which subscription you have, or why you think having a different subscription makes any difference. In Codex, the only difference between subscriptions is in rate limits. Nothing else.

mark-99 · 2 months ago

@MeXenon they are likely referring to the fact that enterprise/API gets 1M and subscription does not.

kkellyoffical · 2 months ago

yes, I am in pro subscription but no 1m ,pity,

---- Replied Message ----
From @.> Date 04/25/2026 19:42 To @.> Cc @.>@.> Subject Re: [openai/codex] config.toml context window settings are not respected (Issue #19185)
mark-99 left a comment (openai/codex#19185)
@MeXenon they are likely referring to the fact that enterprise/API gets 1M and subscription does not.

Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: @.***>

MeXenon · 2 months ago

This limitation is seriously damaging real workflows.

258K is not enough for serious coding work on medium-to-large codebases. Debugging, planning, and building connected features all suffer badly :(

Please stop forcing one conservative default on everyone. This feels stubborn and dismissive of real user needs. Bring back the option for larger context windows.

foreverpiano · 2 months ago

cc @bolinfest @aibrahim-oai @jif-oai @pakrym-oai

etraut-openai contributor · 2 months ago

Please take the conversation to #19464.