Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent: Fix issues when editing thread title (#52388)
Bennet Bo Fennerb67c162ec42d
diff --git a/crates/agent/src/agent.rs b/crates/agent/src/agent.rsindex 6437fd1883c..e65ec23f107 100644--- a/crates/agent/src/agent.rs+++ b/crates/agent/src/agent.rs@@ -663,15 +663,18 @@ impl NativeAgent {return;};- if let Some(title) = thread.read(cx).title() {- let acp_thread = session.acp_thread.downgrade();- cx.spawn(async move |_, cx| {+ let thread = thread.downgrade();+ let acp_thread = session.acp_thread.downgrade();+ cx.spawn(async move |_, cx| {+ let title = thread.read_with(cx, |thread, _| thread.title())?;+ if let Some(title) = title {let task =acp_thread.update(cx, |acp_thread, cx| acp_thread.set_title(title, cx))?;- task.await- })- .detach_and_log_err(cx);- }+ task.await?;+ }+ anyhow::Ok(())+ })+ .detach_and_log_err(cx);}fn handle_thread_token_usage_updated(