From deccb78ff1e9c37460da2ffd8708c5c49bb2db02 Mon Sep 17 00:00:00 2001 From: Bennet Bo Fenner Date: Wed, 11 Mar 2026 09:49:04 +0100 Subject: [PATCH] agent_ui: Fix thread summarization not working (#51259) Release Notes: - N/A --- crates/agent_ui/src/connection_view.rs | 22 ++++++++++++++----- .../src/connection_view/thread_view.rs | 7 ++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/crates/agent_ui/src/connection_view.rs b/crates/agent_ui/src/connection_view.rs index fd4ac66c05e380ddd3e1c3e2c196c5a397754c9d..3f1f1fb164693e0bb9e0b6d8883b97ab5539ba4f 100644 --- a/crates/agent_ui/src/connection_view.rs +++ b/crates/agent_ui/src/connection_view.rs @@ -3782,8 +3782,16 @@ pub(crate) mod tests { } impl Render for ThreadViewItem { - fn render(&mut self, _window: &mut Window, _cx: &mut Context) -> impl IntoElement { - self.0.clone().into_any_element() + fn render(&mut self, _window: &mut Window, cx: &mut Context) -> impl IntoElement { + // Render the title editor in the element tree too. In the real app + // it is part of the agent panel + let title_editor = self + .0 + .read(cx) + .active_thread() + .map(|t| t.read(cx).title_editor.clone()); + + v_flex().children(title_editor).child(self.0.clone()) } } @@ -6060,6 +6068,7 @@ pub(crate) mod tests { init_test(cx); let (thread_view, cx) = setup_thread_view(StubAgentServer::default_response(), cx).await; + add_to_workspace(thread_view.clone(), cx); let active = active_thread(&thread_view, cx); let title_editor = cx.read(|cx| active.read(cx).title_editor.clone()); @@ -6069,9 +6078,12 @@ pub(crate) mod tests { assert!(!editor.read_only(cx)); }); - title_editor.update_in(cx, |editor, window, cx| { - editor.set_text("My Custom Title", window, cx); - }); + cx.focus(&thread_view); + cx.focus(&title_editor); + + cx.dispatch_action(editor::actions::DeleteLine); + cx.simulate_input("My Custom Title"); + cx.run_until_parked(); title_editor.read_with(cx, |editor, cx| { diff --git a/crates/agent_ui/src/connection_view/thread_view.rs b/crates/agent_ui/src/connection_view/thread_view.rs index 806b2c9c397de1c729164b5f859ceae4b7f6231f..771d80f08306838e756a2ea3dd8aa4b378cfd402 100644 --- a/crates/agent_ui/src/connection_view/thread_view.rs +++ b/crates/agent_ui/src/connection_view/thread_view.rs @@ -1464,6 +1464,13 @@ impl ThreadView { match event { EditorEvent::BufferEdited => { + // We only want to set the title if the user has actively edited + // it. If the title editor is not focused, we programmatically + // changed the text, so we don't want to set the title again. + if !title_editor.read(cx).is_focused(window) { + return; + } + let new_title = title_editor.read(cx).text(cx); thread.update(cx, |thread, cx| { thread