Support `model_context_window`/`model_auto_compact_token_limit` in profiles

Resolved 💬 5 comments Opened Mar 12, 2026 by borisroman Closed Apr 18, 2026

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 ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗