fix(tui): keep configured model when navigating sessions#30290
Open
rekram1-node wants to merge 3 commits into
Open
fix(tui): keep configured model when navigating sessions#30290rekram1-node wants to merge 3 commits into
rekram1-node wants to merge 3 commits into
Conversation
Navigating between sessions adopted the session's last-used model and agent, which overrode an explicitly configured model/default_agent (or --model/--agent). Skip the auto-adoption when an explicit selection exists so the user's configured choice sticks.
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
When navigating between sessions in the TUI, the prompt adopts the session's last-used model and agent from its last user message. That auto-adoption writes into the per-agent model store (the highest-priority slot), which overrides an explicitly configured
model/default_agent(or the--model/--agentflags). So a user who has pinned a model in their config sees it "flip" away as they browse old sessions.Fix
Skip the auto-adoption when an explicit selection already exists:
--agentorconfig.default_agentis set.--modelorconfig.modelis set.This mirrors the existing
--agentguard and makes an explicitly configured choice win, instead of being replaced by whatever the navigated session last used. When no explicit selection exists, the original behavior (reflect the session's last-used agent/model) is preserved.Notes
currentModelmemo refactor that already prioritizes manual selection; Bug 2's per-agent persistence is covered in practice by therecentfallback). This PR addresses the remaining observable behavior: explicit config getting flipped on session navigation.wipcommits that net to zero; the meaningful change is a single ~6-line guard. Recommend squash-merge.