Support `model_context_window`/`model_auto_compact_token_limit` in profiles

Resolved 💬 5 comments Opened Mar 12, 2026 by borisroman Closed Apr 18, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

codex-cli 0.114.0

What subscription do you have?

ChatGPT Pro plan (not API-key-only usage).

Which model were you using?

gpt-5.4 (profile deep) and gpt-5.3-codex (default profile codex).

What platform is your computer?

Darwin 25.3.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

Ghostty (TERM_PROGRAM=ghostty, TERM=xterm-ghostty).

What issue are you seeing?

Profile-scoped model_context_window and model_auto_compact_token_limit are ignored when running Codex with a selected profile.

Top-level config values work, but the same fields under [profiles.<name>] do not appear to apply.

This has become more noticeable with the launch of GPT-5.4 and the optional 1M context window, which I want to enable only in a specific profile because it is more expensive.

Possibly related: #14133 (context window from config ignored in some Desktop flows), but this report is about CLI profile overrides.

What steps can reproduce the bug?

~/.codex/config.toml:

profile = "codex"

[profiles.codex]
model = "gpt-5.3-codex"
model_reasoning_effort = "xhigh"

[profiles.deep]
model = "gpt-5.4"
model_reasoning_effort = "xhigh"
model_context_window = 1000000
model_auto_compact_token_limit = 900000
  1. Run codex (default profile codex) and observe expected model/reasoning behavior.
  2. Run codex -p deep.
  3. Observe that model/reasoning change to the deep profile, but context-window-related settings do not.

What is the expected behavior?

codex -p deep should apply all profile fields, including:

  • model_context_window = 1000000
  • model_auto_compact_token_limit = 900000

Additional information

I have a fix branch with a regression test:

The fix adds profile support for these fields in ConfigProfile and merges them with profile precedence over top-level config.

Given the contribution guidelines I haven't opened a PR, but happy to do so if the team would like one.

View original on GitHub ↗

5 Comments

borisroman · 5 months ago

Also noticed it didn't set the labels on this issue because context-management isn't a label.

https://github.com/openai/codex/actions/runs/22996833080/job/66771137779

etraut-openai contributor · 5 months ago

These keys are not currently supported by profiles. It's not clear whether we're going to continue to support profiles. We are considering deprecating them, so investments in this space are very low priority.

borisroman · 5 months ago

Hi @etraut-openai,

Thanks for your response. What would be an alternative method to switching models (and model configs) in the Codex Cli?

Best,
Boris

borisroman · 5 months ago

ChatGPT directs me to the profiles solution 😄

https://chatgpt.com/share/69b2eb87-87d0-8008-9d12-a5af663fc5d2

etraut-openai contributor · 5 months ago

Yeah, we don't have a good alternative in place yet, which is why we haven't formally deprecated profiles. Profiles are used by a very small fraction of Codex users, so it's pretty low on our priority list at the moment.