What variant of Codex are you using?
CLI / TUI
What feature would you like to see?
Show a lightweight warning or confirmation when a user switches models from /model after an active session has accumulated substantial context.
Codex already warns when resuming a recorded session with a different model:
This session was recorded with model `{previous_model}` but is resuming with `{current_model}`. Consider switching back to `{previous_model}` as it may affect Codex performance.
The same class of user surprise can happen inside a live session. A user may work for many turns with one model, switch to another model for a specific task, and not realize that this can change the performance characteristics of the rest of the session.
The warning should avoid implying that the new model is lower quality. The more precise concern is that switching models mid-session can affect prompt-cache continuity and model-specific context handling. In practice, that can show up as slower responses, higher cost, or weaker session continuity in a long-running thread.
One possible UX:
Switch models in this long session?
Switching from `{current_model}` to `{new_model}` may reduce prompt-cache reuse and affect latency or cost for upcoming turns.
Actions:
Switch model
Keep current model
Don't show again
Suggested behavior:
- Only warn after the session is meaningfully deep, not during the first few turns.
- Do not warn for a no-op selection where the selected model is already active.
- Do not block startup-time model selection or explicit CLI flags.
- Prefer one warning per session, or a persisted opt-out, to avoid warning fatigue.
- Keep model switching available; this is only about making the tradeoff visible.
Potential threshold options:
- warn when current token usage exceeds a fixed threshold;
- warn when context usage exceeds a percentage of the active model context window;
- fall back to a completed-turn count if token usage is unavailable.
I do not have a strong preference on the exact threshold. The important part is to avoid early-session noise while helping users avoid surprising behavior in deep sessions.
Why this matters
OpenAI's public Codex agent-loop writeup describes prompt caching as sensitive to exact prompt-prefix reuse, and notes that changing the target model in the middle of a conversation can cause a cache miss because model-specific instructions can affect the prompt prefix:
https://openai.com/index/unrolling-the-codex-agent-loop/
This is an easy detail for users to miss. The current resume warning already acknowledges that a model mismatch can affect Codex performance. A similar, carefully scoped warning during in-session model changes would make the same tradeoff visible at the moment the user can still choose whether to continue.
Possible implementation area
From a quick read of the current repo, the relevant areas appear to be:
- resume warning:
codex-rs/core/src/session/mod.rs
- model-switch developer-message handling:
codex-rs/core/src/context/model_switch_instructions.rs
- TUI model picker and
/model flow: codex-rs/tui/src/chatwidget.rs
- likely TUI coverage area:
codex-rs/tui/src/chatwidget/tests/popups_and_settings.rs
This could be implemented entirely as a TUI warning before applying the existing model-selection action, without changing model-switch semantics.
Acceptance criteria
- Switching models early in a session behaves as it does today.
- Switching models deep in a session shows a concise warning before applying the change.
- Confirming applies the same model switch behavior as today.
- Canceling keeps the current model and reasoning effort unchanged.
- The warning is not shown for no-op model selections.
- The behavior has focused TUI test or snapshot coverage.
- The copy describes prompt-cache/performance tradeoffs without claiming that model quality necessarily degrades.
Non-goals
- Do not remove or discourage model switching.
- Do not change model-selection semantics.
- Do not warn on every model picker interaction.
- Do not make claims about one model being categorically worse than another.
If the Codex team agrees this is the right UX, I would be happy to prepare a focused PR for the warning path.
What variant of Codex are you using?
CLI / TUI
What feature would you like to see?
Show a lightweight warning or confirmation when a user switches models from
/modelafter an active session has accumulated substantial context.Codex already warns when resuming a recorded session with a different model:
The same class of user surprise can happen inside a live session. A user may work for many turns with one model, switch to another model for a specific task, and not realize that this can change the performance characteristics of the rest of the session.
The warning should avoid implying that the new model is lower quality. The more precise concern is that switching models mid-session can affect prompt-cache continuity and model-specific context handling. In practice, that can show up as slower responses, higher cost, or weaker session continuity in a long-running thread.
One possible UX:
Actions:
Suggested behavior:
Potential threshold options:
I do not have a strong preference on the exact threshold. The important part is to avoid early-session noise while helping users avoid surprising behavior in deep sessions.
Why this matters
OpenAI's public Codex agent-loop writeup describes prompt caching as sensitive to exact prompt-prefix reuse, and notes that changing the target
modelin the middle of a conversation can cause a cache miss because model-specific instructions can affect the prompt prefix:https://openai.com/index/unrolling-the-codex-agent-loop/
This is an easy detail for users to miss. The current resume warning already acknowledges that a model mismatch can affect Codex performance. A similar, carefully scoped warning during in-session model changes would make the same tradeoff visible at the moment the user can still choose whether to continue.
Possible implementation area
From a quick read of the current repo, the relevant areas appear to be:
codex-rs/core/src/session/mod.rscodex-rs/core/src/context/model_switch_instructions.rs/modelflow:codex-rs/tui/src/chatwidget.rscodex-rs/tui/src/chatwidget/tests/popups_and_settings.rsThis could be implemented entirely as a TUI warning before applying the existing model-selection action, without changing model-switch semantics.
Acceptance criteria
Non-goals
If the Codex team agrees this is the right UX, I would be happy to prepare a focused PR for the warning path.