Repository navigation
fix(codex-acp): resume sessions with their recorded model - #511
Merged
Merged
Conversation
Restoring a Codex session built its config from the global default model, so codex-core resumed the thread on a different model than the one it was recorded with. That silently switched the chat's model and surfaced the "This session was recorded with model ... but is resuming with ..." warning as an agent message. Before resuming, apply the model and reasoning effort persisted in the thread metadata, mirroring the Codex app-server. Models recorded under a different provider, or threads without a persisted model, keep the configured defaults.
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.
Summary
Resuming a Codex chat (
session/resume/session/load) could silently switch it to a different model and post this message in the chat:Root cause
restore_sessioninvendor/codex-acp/src/codex_agent.rsbuilt the resume config from the agent's global default (build_session_config(&self.config, …)). It never used the model the thread was recorded with.codex-corecompares the last recorded model with the current one and emits anEventMsg::Warningwhen they differ (core/src/session/mod.rs).thread.rs), so the notice appeared as an assistant message.Fix
Before resuming, apply the model and reasoning effort stored in the thread metadata (
StoredThread, whichrestore_sessionalready reads). This mirrors what the Codex app-server does inmerge_persisted_resume_metadata. The thread resumes on its recorded model, socodex-corehas no mismatch and emits no warning.The configured defaults are kept in these cases:
Changing the model afterwards through
set_config_optionworks as before. That path does not trigger the warning.Testing
resume_restores_model_recorded_under_the_configured_provider.codex-acplib suite (112 tests) andcargo clippy --all-targetswith no warnings, viaapps/desktop/scripts/run-with-codex-v8.mjs --target x86_64-unknown-linux-gnu -- cargo ….