Model selection should not be persisted to config

Open 💬 5 comments Opened Jun 4, 2026 by DerekWW
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

0.137.0

What subscription do you have?

Enterprise

Which model were you using?

_No response_

What platform is your computer?

Darwin 25.4.0 arm64 arm

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

Ghostty/Kitty

Codex doctor report

What issue are you seeing?

Codex clients overwrite user set default model and model_reasoning_effort when the model is changed in a session.

What steps can reproduce the bug?

  1. Set a default model and model_reasoning_effort in your user-level config.toml (without any project-level or managed config overrides).
  2. Start a session.
  3. Switch to a different model or change the reasoning level midway through the session for a one-off task.
  4. Close the session and check your user-level config.toml.
  5. Result: The user-level config.toml has been mutated to reflect the temporary model choice.

What is the expected behavior?

The user-level config should remain untouched. A model change during a session should be scoped only to that active session, acting as a temporary override.

Config files should act as declarative defaults across all levels (user, project, and managed), rather than as a sink for mutable session state.

Additional information

Description

When changing the model or reasoning effort during an active session, the new selection permanently overwrites the user-level config.toml file. This causes the temporary model to become the new default for all future sessions(barring managed or project level overrides), which contradicts the documentation.

Notably, this issue only affects the user-level configuration. Both project-level configs and enterprise managed_config files correctly maintain their static defaults and are not overwritten by session changes.

Context & Documentation Contradictions

This current behavior has caused significant confusion for several developers in my organization. Writing session-level changes back to the user level configuration is not documented; in fact, the documentation explicitly and implicitly calls these changes temporary.

  • Temporary Model Docs: According to https://developers.openai.com/codex/models#choosing-a-different-local-model-temporarily session switches are meant to be transient.
  • Default Model Docs: Under the "Default Model" header in Basic Configuration, it states: "Choose the model Codex uses by default in the CLI and IDE." This implies a static default that shouldn't auto-update.
  • Inconsistent Architecture: Both project-level configuration and managed_config.toml behave exactly as expected—they set a starting baseline for new sessions without being overwritten by session activity. The user-level configuration should maintain architectural consistency with these other layers.

View original on GitHub ↗

5 Comments

github-actions[bot] contributor · 2 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #25560

Powered by Codex Action

etraut-openai contributor · 2 months ago

The current behavior is intentional, not a bug. I understand your perspective, but I think that most users would probably be surprised if a model selection or reasoning effort change was not persisted. The Codex app works the same way.

Rather than closing this issue as "won't fix", I'm going to change it from a bug report to a feature request. That way, we can see if it gets upvotes from other users.

DerekWW · 2 months ago

A possible solution is a new config value use_last_selected_model=true that would keep the current behavior and stop the config write back when set to false.
Defaulting the value to true would allow existing behavior to continue for users unless they want to explicitly stop the config write back behavior by adding the setting to their config.

Ideally this would(if implemented) apply to all codex clients.

mkilpatrick · 2 months ago

Or (at least with the codex app) have a setting to allow a user to set their default model/level that doesn't get overridden.

steveepreston · 2 months ago

+1