From 5e58f44d85fb7c9ee7e914dae9d39862a5f251c4 Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Tue, 9 Sep 2025 12:00:24 -0700 Subject: [PATCH] Fix auth in edit_agent evals (#37869) Somehow we have a regression where the auth wasn't being called, so the model didn't exist. Looking at the code, it is likely this was relying on some other part of the code doing the auth, since the order wouldn't have worked before without that happening. This new order of doing auth before checking for available models should fix it going forward. Release Notes: - N/A --- crates/assistant_tools/src/edit_agent/evals.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/crates/assistant_tools/src/edit_agent/evals.rs b/crates/assistant_tools/src/edit_agent/evals.rs index e78d43f56b2f13f90b83968dadd5ff79e1a96658..515e22d5f8b184a875cd91038d7bfa0a7d8127a7 100644 --- a/crates/assistant_tools/src/edit_agent/evals.rs +++ b/crates/assistant_tools/src/edit_agent/evals.rs @@ -1520,7 +1520,15 @@ impl EditAgentTest { selected_model: &SelectedModel, cx: &mut AsyncApp, ) -> Result> { - let (provider, model) = cx.update(|cx| { + cx.update(|cx| { + let registry = LanguageModelRegistry::read_global(cx); + let provider = registry + .provider(&selected_model.provider) + .expect("Provider not found"); + provider.authenticate(cx) + })? + .await?; + cx.update(|cx| { let models = LanguageModelRegistry::read_global(cx); let model = models .available_models(cx) @@ -1529,11 +1537,8 @@ impl EditAgentTest { && model.id() == selected_model.model }) .expect("Model not found"); - let provider = models.provider(&model.provider_id()).unwrap(); - (provider, model) - })?; - cx.update(|cx| provider.authenticate(cx))?.await?; - Ok(model) + model + }) } async fn eval(&self, eval: EvalInput, cx: &mut TestAppContext) -> Result {