From 24ee98b3e13a164e0c9403963787951dc069f661 Mon Sep 17 00:00:00 2001 From: Umesh Yadav <23421535+imumesh18@users.noreply.github.com> Date: Thu, 28 Aug 2025 19:42:59 +0530 Subject: [PATCH] agent2: Fix model deduplication to use provider ID and model ID (#37088) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #37043 Previously claude sonnet 4 was missing from copilot as it was colliding with zed's claude-sonnet-4 model id. Now we do deduplication based upon model and provider id both. | Before | After | |--------|--------| | CleanShot 2025-08-28 at 18 31
28@2x | CleanShot 2025-08-28 at 18 31
42@2x | Release Notes: - Fixed an issue where models with the same ID from different providers (such as Claude Sonnet 4 from both Zed and Copilot) were incorrectly deduplicated in the model selector—now all variants are shown. --- crates/agent2/src/agent.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/agent2/src/agent.rs b/crates/agent2/src/agent.rs index 51e1fc631625fb8f7e5b84cb2520c85ed6b3d876..ea80df8fb52cffab80c8c64307b75de7f0954a56 100644 --- a/crates/agent2/src/agent.rs +++ b/crates/agent2/src/agent.rs @@ -93,7 +93,7 @@ impl LanguageModels { let mut recommended = Vec::new(); for provider in &providers { for model in provider.recommended_models(cx) { - recommended_models.insert(model.id()); + recommended_models.insert((model.provider_id(), model.id())); recommended.push(Self::map_language_model_to_info(&model, provider)); } } @@ -110,7 +110,7 @@ impl LanguageModels { for model in provider.provided_models(cx) { let model_info = Self::map_language_model_to_info(&model, &provider); let model_id = model_info.id.clone(); - if !recommended_models.contains(&model.id()) { + if !recommended_models.contains(&(model.provider_id(), model.id())) { provider_models.push(model_info); } models.insert(model_id, model);