From c98bcc72b882582207c530ffac1e22825a8c5134 Mon Sep 17 00:00:00 2001 From: Bennet Bo Fenner Date: Thu, 3 Apr 2025 15:35:06 +0200 Subject: [PATCH] agent: Fix thinking step showing up as pending when completion is cancelled (#28019) Previously the "Thinking..." step would show up as pending, even though the user cancelled the generation: image Release Notes: - Fixed an issue where the thinking step would show up as pending even when the generation was cancelled --- crates/agent/src/active_thread.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/agent/src/active_thread.rs b/crates/agent/src/active_thread.rs index b9d820d3ac..7920b24501 100644 --- a/crates/agent/src/active_thread.rs +++ b/crates/agent/src/active_thread.rs @@ -1449,7 +1449,8 @@ impl ActiveThread { cx: &Context, ) -> impl IntoElement { let is_last_message = self.messages.last() == Some(&message_id); - let pending_thinking_segment_index = if is_last_message && !has_tool_uses { + let is_generating = self.thread.read(cx).is_generating(); + let pending_thinking_segment_index = if is_generating && is_last_message && !has_tool_uses { rendered_message .segments .iter()