Support `model_context_window`/`model_auto_compact_token_limit` in profiles
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
- Run
codex(default profilecodex) and observe expected model/reasoning behavior. - Run
codex -p deep. - Observe that model/reasoning change to the
deepprofile, but context-window-related settings do not.
What is the expected behavior?
codex -p deep should apply all profile fields, including:
model_context_window = 1000000model_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.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗