Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

assistant2: Cancel pending completion when an error occurs (#23143)

Marshall Bowers4febc7ea49ee
diff --git a/crates/assistant2/src/thread.rs b/crates/assistant2/src/thread.rs
index b5a42da85b3..e7c4036a55c 100644
--- a/crates/assistant2/src/thread.rs
+++ b/crates/assistant2/src/thread.rs
@@ -361,7 +361,7 @@ impl Thread {
let result = stream_completion.await;
thread
- .update(&mut cx, |_thread, cx| match result.as_ref() {
+ .update(&mut cx, |thread, cx| match result.as_ref() {
Ok(stop_reason) => match stop_reason {
StopReason::ToolUse => {
cx.emit(ThreadEvent::UsePendingTools);
@@ -384,6 +384,8 @@ impl Thread {
SharedString::from(error_message.clone()),
)));
}
+
+ thread.cancel_last_completion();
}
})
.ok();