From 8a7fd8e04ae283b461cb1e76e780929659c6c5a5 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Thu, 1 Oct 2026 12:36:44 +0800 Subject: [PATCH] fix(terminal): take only a hook's word that the agent is asking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The box stands aside and sends nothing while the pane's agent is waiting, since whatever it sent would answer the question on screen. For an agent without hooks — Amp, or Crush before its first tool — the pane is marked waiting by any desktop notification, "Agent is ready" at the end of a turn among them, and it stays marked. From the first finished turn on the box stood aside for good, and messages went into the agent's own input instead. Waiting now holds the box back only when hooks reported it. Those agents' own dialogs take their input's place on screen, and the box steps aside for them off the screen as for any other. --- src/terminal/composer.rs | 9 ++++++++- src/terminal/view.rs | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/terminal/composer.rs b/src/terminal/composer.rs index 19626efd..5b529ccb 100644 --- a/src/terminal/composer.rs +++ b/src/terminal/composer.rs @@ -1929,9 +1929,16 @@ impl TerminalView { /// The agent is asking a question only its TUI can put — a permission /// prompt, a choice. Whatever the box sent would be taken as the answer, /// so nothing is sent until the question is gone. + /// + /// Only a hook can say so. An agent without them — Amp — is marked + /// waiting by any desktop notification it raises, "Agent is ready" when + /// a turn ends included, and stays so; read as a question, that kept the + /// box aside, with nothing sendable, from the first finished turn on. + /// Its own dialogs it puts in its input's place, and the box steps aside + /// for those off the screen. fn agent_is_asking(&self) -> bool { self.agent_session() - .is_some_and(|s| s.status == AgentStatus::Waiting) + .is_some_and(|s| s.rich && s.status == AgentStatus::Waiting) } fn composer_can_send(&self, cx: &gpui::App) -> bool { diff --git a/src/terminal/view.rs b/src/terminal/view.rs index 95f34a49..dbbc780d 100644 --- a/src/terminal/view.rs +++ b/src/terminal/view.rs @@ -15888,6 +15888,7 @@ mod gpui_tests { // the box is sent as the answer. DaemonMsg::AgentStatus(Some(AgentSessionState { status: AgentStatus::Waiting, + rich: true, ..Default::default() })) .encode(&mut daemon)