fix(tui): restore auto model mode on session load#1800
Closed
LING71671 wants to merge 1 commit into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a centralized restore_model_selection method in the App struct to handle the restoration of model settings when loading a session. This change ensures that the 'auto' model mode, reasoning effort, and compaction budget are correctly synchronized. Additionally, unit tests were added to verify that loading a session with an 'auto' model correctly restores the application state. I have no feedback to provide.
Author
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
Closes #1797.
This fixes resumed sessions that were saved while
/model autowas active. Before this change, loading such a session restoredapp.modelto the literal stringautobut leftapp.auto_modelfalse in some resume/load paths. The next turn could then treatautoas a fixed provider model and send it directly to the DeepSeek API, which rejects it with HTTP 400.Changes
App::restore_model_selectionso session restore paths rebuild the full model-mode state from persisted metadata./loadand startup/session-picker resume handling to use that helper.auto, the app now:auto_model/loadandapply_loaded_sessionresume paths.Verification
cargo fmt --all -- --checkgit diff --checkcargo test -p deepseek-tui --bin deepseek-tui load_auto_model_session_restores_auto_modecargo test -p deepseek-tui --bin deepseek-tui apply_loaded_session_restores_auto_model_modecargo buildcargo clippy --workspace --all-targets --all-featuresNotes: build/clippy still report pre-existing warnings in
schema_migration.rsfor unused migration marker structs, and clippy reports two pre-existingneedless_returnwarnings intui/ui.rs. No new warnings were introduced by this change.