fix(chat): preserve session model selection - #30
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9eb1a17b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return this.modelAndAgentManager.applySessionSettings(sessionId); | ||
| await this.modelAndAgentManager.applySessionSettings(sessionId); | ||
| this.selectedModel = this.modelAndAgentManager.getSelectedModel(); | ||
| this.selectedAgent = this.modelAndAgentManager.getSelectedAgent() ?? "build"; |
There was a problem hiding this comment.
Keep the manager's agent selection synchronized
When a user changes agents, the selectAgent handler updates ChatViewProvider.selectedAgent and persistence but never calls modelAndAgentManager.setSelectedAgent. If the next loaded session has no persisted agent—for example, a legacy session—ModelAndAgentManager.applySessionSettings intentionally retains its stale or undefined value, and this new assignment overwrites the user's latest selection with that value (often build), causing the next prompt to use the wrong agent. Synchronize the manager in the selection handler or avoid copying its agent state here.
Useful? React with 👍 / 👎.
Fixes #25.\n\nSynchronizes ChatViewProvider prompt state after restoring per-session model and agent settings, so a prompt always uses the active session's selected model. Adds a regression test for the session-switch handoff.