Make context window and auto-compaction settings model-aware

Open 💬 5 comments Opened Mar 28, 2026 by GraviyDev

What feature would you like to see?

Model-aware context window and auto-compaction settings.

Problem

Codex currently allows global configuration like:

model_context_window = 1000000
model_auto_compact_token_limit = 500000

This works for a large-context model such as gpt-5.4, but becomes misleading or unsafe when switching to a smaller-context model such as gpt-5.4-mini.

The user can end up in a state where:

  • the UI still appears to reflect the large configured context window
  • the selected model actually has a smaller context limit
  • auto-compaction does not happen soon enough
  • the session fails with a context window exceeded error

Proposal

Please make context handling explicitly model-aware.

Possible approaches:

  • support per-model overrides in config
  • automatically clamp model_context_window to the selected model's true maximum
  • automatically clamp model_auto_compact_token_limit to a safe threshold under the selected model's limit
  • show both:
  • configured context window
  • effective context window for the currently selected model
  • show a warning when the configured values exceed the selected model's actual supported window

Why this matters

This is especially important for users who intentionally use:

  • gpt-5.4 with a very large configured context window
  • gpt-5.4-mini for cheaper or faster work in the same app

Right now the config model and the active UI-selected model can drift apart in a way that is hard to reason about.

Expected outcome

Switching models should never leave the user with stale or unsafe context settings.

The app should either:

  • transparently adapt the effective limits, or
  • explicitly tell the user that the current context settings are incompatible with the newly selected model.

View original on GitHub ↗

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