From b92b79069a449588216c333f20985d67a088389c Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Wed, 15 Oct 2025 14:33:17 +0200 Subject: [PATCH] acp: Fix /logout for agents that support it (#40248) We were clearing the message editor too early. We only want to clear the message editor if we are going to short circuit and return early before submitting. Otherwise, the agents that can handle this themselves won't have the ability to do so. Release Notes: - acp: Fix /logout not working for some agents --- crates/agent_ui/src/acp/thread_view.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rs index 7bfa67cfd52cdd4d9c25fe5570498a3ccb66fdee..6a17f76fe0e6a98fcb21008b917ec50d2c7ad05a 100644 --- a/crates/agent_ui/src/acp/thread_view.rs +++ b/crates/agent_ui/src/acp/thread_view.rs @@ -1045,9 +1045,6 @@ impl AcpThreadView { return; }; - self.message_editor - .update(cx, |editor, cx| editor.clear(window, cx)); - let connection = thread.read(cx).connection().clone(); let can_login = !connection.auth_methods().is_empty() || self.login.is_some(); // Does the agent have a specific logout command? Prefer that in case they need to reset internal state. @@ -1058,6 +1055,9 @@ impl AcpThreadView { .iter() .any(|command| command.name == "logout"); if can_login && !logout_supported { + self.message_editor + .update(cx, |editor, cx| editor.clear(window, cx)); + let this = cx.weak_entity(); let agent = self.agent.clone(); window.defer(cx, |window, cx| {