From 53fd3683e2ee3407ecdb70670361d0df681fd206 Mon Sep 17 00:00:00 2001 From: DIMAS FEBRIYANTO <62858781+dimassfeb-09@users.noreply.github.com> Date: Fri, 30 Oct 2026 12:21:11 +0700 Subject: [PATCH] fix(agent): keep the selected model when starting a new chat (#351) After choosing a model and starting a new chat, the picker still showed that model but the session fell back to the agent's default. The remembered configuration was recorded from the agent's reported defaults before the user's choices were applied, and changing an option during a session did not update it. A new session now remembers its options after applying the user's choices, and changing an option updates the remembered configuration. Co-authored-by: dimassfeb-09 <62858781+dimassfeb-09@users.noreply.github.com> --- crates/ide-agent/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ide-agent/src/lib.rs b/crates/ide-agent/src/lib.rs index af22f4ac..464bbc04 100644 --- a/crates/ide-agent/src/lib.rs +++ b/crates/ide-agent/src/lib.rs @@ -547,6 +547,10 @@ impl AgentManager { o.current = Some(value); } s.task.model = model_of(&s.task.config).or(s.task.model.take()); + let provider = s.task.provider.clone(); + let config = s.task.config.clone(); + drop(s); + task.shared.remember(&provider, Some(&config), None); } task.approve_pending(); task.persist(); @@ -1191,7 +1195,6 @@ impl Task { (if known { reported } else { s.task.config.clone() }, s.wanted.clone()) }; config::add_client_options(&provider_id, &mut options); - self.shared.remember(&provider_id, Some(&options), None); for choice in &wanted { // An option the session doesn't offer yet is set once it does (`apply_late_choices`). let Some(o) = options.iter().find(|o| o.id == choice.id).cloned() else { continue }; @@ -1220,6 +1223,7 @@ impl Task { Err(e) => tracing::warn!("agent task {}: setting {} to {} failed: {e}", self.id, o.id, choice.value), } } + self.shared.remember(&provider_id, Some(&options), None); { let mut s = self.state.lock(); s.task.model = model_of(&options).or(s.task.model.take());