Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix @-mentioning threads when their summary isn't ready yet (#36664)
Antonio Scandurrafda6eda3c2ab
diff --git a/crates/agent2/src/agent.rs b/crates/agent2/src/agent.rsindex c15048ad8c5..d5bc0fea630 100644--- a/crates/agent2/src/agent.rs+++ b/crates/agent2/src/agent.rs@@ -1269,18 +1269,12 @@ mod tests {let model = Arc::new(FakeLanguageModel::default());let summary_model = Arc::new(FakeLanguageModel::default());thread.update(cx, |thread, cx| {- thread.set_model(model, cx);- thread.set_summarization_model(Some(summary_model), cx);+ thread.set_model(model.clone(), cx);+ thread.set_summarization_model(Some(summary_model.clone()), cx);});cx.run_until_parked();assert_eq!(history_entries(&history_store, cx), vec![]);- let model = thread.read_with(cx, |thread, _| thread.model().unwrap().clone());- let model = model.as_fake();- let summary_model = thread.read_with(cx, |thread, _| {- thread.summarization_model().unwrap().clone()- });- let summary_model = summary_model.as_fake();let send = acp_thread.update(cx, |thread, cx| {thread.send(vec![diff --git a/crates/agent_ui/src/acp/message_editor.rs b/crates/agent_ui/src/acp/message_editor.rsindex 1155285d09e..3116a40be55 100644--- a/crates/agent_ui/src/acp/message_editor.rs+++ b/crates/agent_ui/src/acp/message_editor.rs@@ -629,15 +629,11 @@ impl MessageEditor {.shared();self.mention_set.insert_thread(id.clone(), task.clone());+ self.mention_set.insert_uri(crease_id, uri);let editor = self.editor.clone();cx.spawn_in(window, async move |this, cx| {- if task.await.notify_async_err(cx).is_some() {- this.update(cx, |this, _| {- this.mention_set.insert_uri(crease_id, uri);- })- .ok();- } else {+ if task.await.notify_async_err(cx).is_none() {editor.update(cx, |editor, cx| {editor.display_map.update(cx, |display_map, cx| {@@ -648,6 +644,7 @@ impl MessageEditor {.ok();this.update(cx, |this, _| {this.mention_set.thread_summaries.remove(&id);+ this.mention_set.uri_by_crease_id.remove(&crease_id);}).ok();}