Model selection should not be persisted to config
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?
- Set a default
modelandmodel_reasoning_effortin your user-levelconfig.toml(without any project-level or managed config overrides). - Start a session.
- Switch to a different model or change the reasoning level midway through the session for a one-off task.
- Close the session and check your user-level
config.toml. - Result: The user-level
config.tomlhas 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.tomlbehave 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.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗