mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-25 14:44:28 +00:00
Closes #37525 By default, thread summary uses default_fast_model (if set), otherwise default_model, which resolves to openrouter/auto for openrouter provider. This may cause the summary to be generated by a different model than the one used by the agent, potentially leading — in cases such as Claude Opus 4.5 — to summary costs exceeding main agent execution costs. The current logic in registry.rs prioritizes default_fast_model over default_model, which overrides the user-selected model (assigned only to default_model). Setting default_fast_model = None for the OpenRouter provider preserves the fallback to openrouter/auto when no model is chosen, while respecting the user's explicit model selection when one is provided. ```rust pub fn set_default_model(&mut self, model: Option<ConfiguredModel>, cx: &mut Context<Self>) { match (self.default_model.as_ref(), model.as_ref()) { (Some(old), Some(new)) if old.is_same_as(new) => {} (None, None) => {} _ => cx.emit(Event::DefaultModelChanged), } self.default_fast_model = maybe!({ let provider = &model.as_ref()?.provider; let fast_model = provider.default_fast_model(cx)?; Some(ConfiguredModel { provider: provider.clone(), model: fast_model, }) }); // This sets default fast model (in our case openrouter/auto) self.default_model = model; //This sets default_model to user selected model } ``` And latter on : ```rust pub fn thread_summary_model(&self) -> Option<ConfiguredModel> { #[cfg(debug_assertions)] if std::env::var("ZED_SIMULATE_NO_LLM_PROVIDER").is_ok() { return None; } self.thread_summary_model .clone() .or_else(|| self.default_fast_model.clone()) // We pick fast_model over default model here .or_else(|| self.default_model.clone()) } ``` Which results in user choice being ignored. Proposed behavior: Use the model explicitly selected by the user in Zed agent configuration. If no model is specified, fall back to the configured default. The resolution is to set in : provider/open_router.rs ```rust fn default_fast_model(&self, _cx: &App) -> Option<Arc<dyn LanguageModel>> { None } ``` This will have a consequence of default_fast_model not being provided and falling back to user choice - but once the fast model is set via for example a configuration property - the default_fast_model is picked over default_model Release Notes: - open_router: Use user's default model when comments and thread summary |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| LICENSE-GPL | ||