Skip to content

Support model_context_window/model_auto_compact_token_limit in profiles #14456

Closed as not planned

Description

@borisroman

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.

Activity

  1. changed the title [-]Profile / are ignored with [/-] [+]Profile `model_context_window`/`model_auto_compact_token_limit` are ignored with `codex -p`[/+] on Mar 12, 2026
  2. borisroman commented on Mar 12, 2026

    @borisroman
    Author

    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

  3. etraut-openai commented on Mar 12, 2026

    @etraut-openai
    Contributor

    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.

  4. changed the title [-]Profile `model_context_window`/`model_auto_compact_token_limit` are ignored with `codex -p`[/-] [+]Support `model_context_window`/`model_auto_compact_token_limit` in profiles[/+] on Mar 12, 2026
  5. added
    enhancement
    on Mar 12, 2026
  6. borisroman commented on Mar 12, 2026

    @borisroman
    Author

    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

  7. borisroman commented on Mar 12, 2026

    @borisroman
    Author
  8. etraut-openai commented on Mar 12, 2026

    @etraut-openai
    Contributor

    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.

  9. added
    context
    on Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    contextenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions