Skip to content

fix(tui): restore auto model mode on session load#1800

Closed
LING71671 wants to merge 1 commit into
Hmbown:mainfrom
LING71671:fix/auto-model-session-resume
Closed

fix(tui): restore auto model mode on session load#1800
LING71671 wants to merge 1 commit into
Hmbown:mainfrom
LING71671:fix/auto-model-session-resume

Conversation

@LING71671
Copy link
Copy Markdown

Summary

Closes #1797.

This fixes resumed sessions that were saved while /model auto was active. Before this change, loading such a session restored app.model to the literal string auto but left app.auto_model false in some resume/load paths. The next turn could then treat auto as a fixed provider model and send it directly to the DeepSeek API, which rejects it with HTTP 400.

Changes

  • Added App::restore_model_selection so session restore paths rebuild the full model-mode state from persisted metadata.
  • Updated both /load and startup/session-picker resume handling to use that helper.
  • When the restored model is auto, the app now:
    • enables auto_model
    • clears stale effective-model labels
    • restores auto reasoning mode
    • recalculates the compaction budget against the default concrete budget model
  • Added regression coverage for both 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
  • cargo clippy --workspace --all-targets --all-features

Notes: build/clippy still report pre-existing warnings in schema_migration.rs for unused migration marker structs, and clippy reports two pre-existing needless_return warnings in tui/ui.rs. No new warnings were introduced by this change.

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 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.

@LING71671
Copy link
Copy Markdown
Author

Superseded by #1885, which carries the same #1797 fix forward on top of current main with the remaining /load path covered and fresh regression assertions. Closing this older dirty branch to keep the queue clearer.

@LING71671 LING71671 closed this 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

1 participant