Skip to content

fix(tui): restore auto model state on session load#1885

Open
LING71671 wants to merge 1 commit into
Hmbown:mainfrom
LING71671:fix/session-load-auto-model-selection
Open

fix(tui): restore auto model state on session load#1885
LING71671 wants to merge 1 commit into
Hmbown:mainfrom
LING71671:fix/session-load-auto-model-selection

Conversation

@LING71671
Copy link
Copy Markdown

Summary

Closes #1797.

Resuming or explicitly loading a session saved while /model auto was active could restore the literal model string auto without restoring the matching auto_model state. The next turn could then treat auto as a concrete provider model and send it to the API.

Changes

  • Route /load through App::set_model_selection so persisted model metadata rebuilds the full model-selection state.
  • Clear stale effective auto-model/auto-reasoning labels when the model selection is restored.
  • Restore thinking mode to Auto whenever the selected model is auto.
  • Add regression coverage for explicit /load and apply_loaded_session resume paths.

Verification

  • cargo fmt --all -- --check
  • git diff --check
  • cargo test -p deepseek-tui --bin deepseek-tui load_auto_model_session_restores_auto_mode
  • cargo test -p deepseek-tui --bin deepseek-tui apply_loaded_session_restores_auto_model_mode
  • cargo build

Note: cargo build still reports the existing unused migration marker warnings in schema_migration.rs; this change does not introduce new warnings.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the session loading mechanism to use the set_model_selection method, ensuring that application state—specifically reasoning_effort and last_effective_reasoning_effort—is correctly managed when restoring a session. It also introduces new test cases and updates existing ones to verify that the "auto" model selection mode is properly restored and that the internal state remains consistent. I have no feedback to provide.

@Hmbown Hmbown added this to the v0.8.47 milestone May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

resume from a session will send 'auto' as a model name in the request

2 participants