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.
5 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
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.
A possible solution is a new config value
use_last_selected_model=truethat would keep the current behavior and stop the config write back when set tofalse.Defaulting the value to
truewould 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.
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.
+1