From fb9d09791ba6efaea6d9f9df44e1a04c32a23005 Mon Sep 17 00:00:00 2001 From: Madhu Korada Date: Tue, 28 Jul 2026 20:23:04 -0700 Subject: [PATCH] fix(acp): default Grok to ACP entrypoint args MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Empty agent_args on managed-agent records is intentional; spawn is supposed to fill runtime defaults via normalize_agent_args. Grok was missing from default_agent_args, so selecting Grok Build launched bare `grok` (interactive TUI). Under the desktop (no controlling TTY) that exits with ENXIO and every pool worker fails. Also treat a sole legacy clap/env default of "acp" as omitted for known runtimes, so `BUZZ_ACP_AGENT_COMMAND=grok` without explicit args does not spawn `grok acp`. - default_agent_args: grok → agent --always-approve stdio - normalize: sole "acp" → runtime default - tests for empty, path, and legacy-acp grok args Fixes #3457 Signed-off-by: Madhu Korada --- crates/buzz-acp/src/config.rs | 40 ++++++++++++++++--- .../src-tauri/src/managed_agents/discovery.rs | 16 +++++++- .../src/managed_agents/discovery/tests.rs | 25 ++++++++++++ 3 files changed, 74 insertions(+), 7 deletions(-) diff --git a/crates/buzz-acp/src/config.rs b/crates/buzz-acp/src/config.rs index 19304bf186..8c6bbd302e 100644 --- a/crates/buzz-acp/src/config.rs +++ b/crates/buzz-acp/src/config.rs @@ -691,10 +691,19 @@ pub(crate) fn normalize_agent_command_identity(command: &str) -> String { } fn default_agent_args(command: &str) -> Option> { + // Empty agent_args / clap's sole "acp" default must still launch Grok in + // ACP mode — bare `grok` opens the TUI and fails with ENXIO when Buzz has + // no controlling TTY (block/buzz#3457). match normalize_agent_command_identity(command).as_str() { "goose" => Some(vec!["acp".to_string()]), "codex" | "codex-acp" | "claude-agent-acp" | "claude-code-acp" | "claude-code" | "claudecode" | "buzz-agent" => Some(Vec::new()), + // Grok Build: `grok agent --always-approve stdio` + "grok" => Some(vec![ + "agent".to_string(), + "--always-approve".to_string(), + "stdio".to_string(), + ]), _ => None, } } @@ -786,11 +795,10 @@ pub fn normalize_agent_args(command: &str, agent_args: Vec) -> Vec Option> { + // Empty `agent_args` on managed-agent records is intentional (see + // instanceInputForDefinition): spawn fills defaults from this table. + // Grok must be included or a command override alone launches bare `grok` + // (interactive TUI → ENXIO under the desktop, block/buzz#3457). match normalize_command_identity(command).as_str() { "goose" => Some(vec!["acp".to_string()]), "codex" | "codex-acp" | "claude-agent-acp" | "claude-code-acp" | "claude-code" | "claudecode" | "buzz-agent" => Some(Vec::new()), + // Grok Build: `grok agent --always-approve stdio` (matches PRESET_HARNESSES). + "grok" => Some(vec![ + "agent".to_string(), + "--always-approve".to_string(), + "stdio".to_string(), + ]), _ => None, } } @@ -484,8 +494,10 @@ pub fn normalize_agent_args(command: &str, agent_args: Vec) -> Vec