fix: re-assert the configured model when resuming a Codex session - #168
Merged
PleasePrompto merged 1 commit intoJul 12, 2026
Merged
Conversation
Codex stores the model a session was created with. Without re-asserting the configured model, a later /model change is ignored on resumed turns, unlike Claude which re-sends --model every turn. Mirror the fresh-session model flag in the resume command so the selected model and its reasoning effort stay consistent.
PleasePrompto
marked this pull request as ready for review
July 12, 2026 06:04
PleasePrompto
added a commit
that referenced
this pull request
Jul 12, 2026
- drop the now-unused windows_only parameter from _feed_stdin_and_close - feed streaming stdin concurrently with the stdout read loop: a prompt larger than the OS pipe buffer could deadlock against a child that emits stdout before draining stdin (oneshot path already used communicate() and was safe) - update #168-era resume-command tests to the stdin prompt marker Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Switching
/modelto a different Codex model has no effect on chats thatalready have a Codex session:
codex exec resumeruns the model stored inthe session at creation time, and the resume command builder passes no
model flag. Unlike Claude — which re-sends
--modelon every turn — thenew selection is silently ignored on resumed turns.
It can also hard-fail: if the new selection sets a reasoning effort the
stored model doesn't support (e.g. an effort level introduced with a newer
model generation), the resumed turn dies with
400 invalid_request_error: Invalid value ... reasoning.effortand theturn is lost.
Reproduce: create a Codex session on an older model,
/modelto a newermodel plus a newer-only effort level, then send a message in the same chat
→ the CLI exits 1.
Fix
Mirror the fresh-session
--modelflag in_build_resume_command,emitted under the same condition (only when a model is configured).
Verified against the Codex CLI:
codex exec resume --model <new>overrides the stored session model, and subsequent turn contexts record
the new model.
Tests
--model <value>placed before the--separator (the structure test previously asserted the flag's absence)
None/empty configured model omits the flag2 files changed, +20/−3. Rollback = revert (no config/schema impact).