Skip to content

fix(tui): keep configured model when navigating sessions#30290

Open
rekram1-node wants to merge 3 commits into
devfrom
fix-model-selection
Open

fix(tui): keep configured model when navigating sessions#30290
rekram1-node wants to merge 3 commits into
devfrom
fix-model-selection

Conversation

@rekram1-node
Copy link
Copy Markdown
Collaborator

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 / --agent flags). 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:

  • Don't set the agent from the session when --agent or config.default_agent is set.
  • Don't set the model (and variant) from the session when --model or config.model is set.

This mirrors the existing --agent guard 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

  • Context: GitHub issue [Bug] TUI model selection gets overwritten by agent default model #13456. The two root causes that issue cited are no longer live (Bug 1 was resolved by the currentModel memo refactor that already prioritizes manual selection; Bug 2's per-agent persistence is covered in practice by the recent fallback). This PR addresses the remaining observable behavior: explicit config getting flipped on session navigation.
  • The branch contains two earlier wip commits that net to zero; the meaningful change is a single ~6-line guard. Recommend squash-merge.

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

1 participant