Grok Build runtime spawns bare `grok` (TUI) instead of `grok agent --always-approve stdio` — agents fail with ENXIO
Summary
Selecting Grok Build as the managed-agent runtime starts Fizz/Honey/Bumble with:
agent_cmd=/Users/.../grok
and empty agent_args. That launches the interactive TUI, not the ACP server. Under Buzz (no controlling TTY) every pool worker exits immediately:
Error: Device not configured (os error 6)
ERROR buzz_acp: agent initialize failed: Agent process exited unexpectedly
Error: all 10 agents failed to start — cannot continue
Claude / other ACP-native adapters work on the same machine. The Grok CLI is installed and authenticated; this is a harness arg wiring bug, not auth.
Environment
- Buzz: 0.5.0 (macOS, desktop)
- Grok CLI: 0.2.114 (
~/.local/bin/grok→~/.grok/bin/grok) - OS: macOS arm64
- Config:
preferred_runtime: "grok"inglobal-agent-config.json - Managed agents end up with:
"agent_command": "claude-agent-acp",
"agent_command_override": "grok",
"agent_args": []
Steps to reproduce
- Install Grok CLI (
grokon PATH /~/.grok/bin) andgrok login(or setXAI_API_KEY). - Install latest Buzz desktop; create/start Welcome Team agents (Fizz etc.).
- Set agent runtime / preferred runtime to Grok Build.
- Start agents and open the harness log.
Expected
Spawn should match the preset harness definition on main:
// desktop/src-tauri/src/managed_agents/discovery.rs — PRESET_HARNESSES
PresetHarness {
id: "grok",
label: "Grok Build",
command: "grok",
args: &["agent", "--always-approve", "stdio"],
...
}
i.e. effectively:
grok agent --always-approve stdio
ACP initialize should succeed (same as a manual pipe of JSON-RPC over stdio).
Actual
- Log line:
agent_cmd=.../grokwith noagent stdioargs. - Child prints
Error: Device not configured (os error 6)(ENXIO) and exits. - All parallel workers fail; harness exits status 1:
all 10 agents failed to start.
Manual repro of the bad spawn:
# bare TUI, no TTY — same ENXIO Buzz sees
/Users/$USER/.local/bin/grok </dev/null
# → Error: Device not configured (os error 6)
# correct ACP entrypoint — works
printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{},"clientInfo":{"name":"test","version":"0"}}}' \
| grok agent stdio
# → initialize result with protocolVersion 1, authMethods, models, etc.
Root cause (from current main)
Two related gaps:
1. Preset args are not applied when only the command override is set
UI / preferred_runtime = "grok" pins agent_command_override: "grok" but leaves agent_args: [] on the managed agent record. Spawn uses the override binary + the stored (empty) args, so the preset's ["agent", "--always-approve", "stdio"] never reach the process.
2. default_agent_args("grok") does not fill in the preset defaults
In both:
desktop/src-tauri/src/managed_agents/discovery.rs→default_agent_argscrates/buzz-acp/src/config.rs→default_agent_args
only goose / Claude / Codex / buzz-agent are special-cased. grok falls through to None, so normalize_agent_args("grok", []) returns [] instead of the preset ACP args.
Same class of risk for other Tier-2 presets that need non-empty args when the agent record has empty agent_args (omp → acp, opencode → acp, kimi → acp, etc.) if spawn only sees the command + empty stored args.
Suggested fix
-
Include Grok (and other preset harnesses) in
default_agent_args, mirroringPRESET_HARNESSES, e.g.:"grok" => Some(vec![ "agent".into(), "--always-approve".into(), "stdio".into(), ]), "omp" | "opencode" | "kimi" | "cursor" | "cursor-agent" => Some(vec!["acp".into()]), // ...Prefer a single source of truth: derive defaults from
PRESET_HARNESSESrather than a second match table. -
When applying
preferred_runtime/ command override from a preset, also persist (or resolve at spawn) that preset'sargs, not only the command. -
Regression test: spawn path /
normalize_agent_args("grok", vec![])must yield["agent", "--always-approve", "stdio"]; integration smoke thatBUZZ_ACP_AGENT_COMMAND=grokwith empty args can complete ACPinitializewithout a TTY.
Workaround (works today)
Edit managed agents so args are set explicitly, then restart agents:
"agent_command_override": "/Users/<you>/.local/bin/grok",
"agent_args": ["agent", "stdio"]
or point the override at a tiny wrapper:
#!/bin/bash
exec "$HOME/.local/bin/grok" agent stdio "$@"
(--always-approve is recommended for managed agents so Grok-side tool prompts do not deadlock headless ACP; Buzz already documents this in the Grok preset PRs.)
Related
- Closed feature: #2347 (register Grok Build as first-class ACP runtime)
- Closed PRs that defined the intended args: #2812, #2918, #2546 (
agent --always-approve stdio) - Related enhancement (not this bug): #3279 “Add Grok CLI option”
- Note: some earlier Grok PR discussion mentioned
/dev/tty/ spawn-context issues on the CLI side; current Grokagent stdiocompletesinitializefine over pipes — the Buzz-side empty-args spawn is sufficient to explain this failure.
Acceptance criteria
- [ ] Selecting Grok Build as preferred/agent runtime starts agents without ENXIO
- [ ] Harness log shows ACP init for Grok (
agentInfo/ capabilities), not TUI ENXIO - [ ] Empty
agent_args+ commandgroknormalizes toagent --always-approve stdio(or equivalent from preset) - [ ] Unit coverage for
normalize_agent_args("grok", [])
A fix is up in #3804. It resolves this by deriving the per-runtime launch args from the single-source PRESET_HARNESSES table in resolve_effective_harness_descriptor, so an agent pinned to this runtime (e.g. via agent_command_override with no runtime id) launches its ACP/stdio mode instead of the bare command/TUI that timed out at initialize.
Independently reproduced the exact same symptom tonight via the CLI path (not the Desktop managed-agent picker): standing up Grok Build as a raw buzz-acp bridge agent on a fresh VM.
buzz-acp --agent-command grok --agent-args "agent --always-approve stdio" (space-separated, as one would naturally write it) produces:
Error: No such device or address (os error 6)
ERROR buzz_acp: agent initialize failed: Agent process exited unexpectedly
Error: all 1 agents failed to start — cannot continue
Root cause on the CLI side turned out to be two stacked issues:
grok agent stdio --always-approveis a clap parse error —--always-approvemust precedestdio(it's agrok agent-level flag, not accepted by thestdiosubcommand itself). Correct:grok agent --always-approve stdio.- Separately,
buzz-acp's own--agent-argsflag isvalue_delimiter = ','in its clap definition (confirmed by readingcrates/buzz-acp/src/config.rs) — every other built-in agent's default is a single token (goose→"acp",codex-acp→"acp", etc.), so a multi-word value like Grok's has apparently never been exercised through this exact CLI flag before. A plain space-separated string silently collapses into one argv token, whichgrokthen misparses as a positional prompt — producing the identical ENXIO/'Device not configured' signature reported here, for a related but distinct reason from the Desktop picker's empty-agent_argsbug.
Correct CLI invocation once both are accounted for: --agent-args "agent,--always-approve,stdio" (comma-delimited).
Confirmed working end-to-end after both fixes — agent connects, subscribes, and responds correctly over ACP.
Status update: still reproducible in desktop-v0.5.9 — the buggy launch-args fallthrough is unchanged in this release.
The fix is PR #3804 (preset_args_for_command), now rebased onto v0.5.9 main and mergeable (CI retriggered). It lands in the next release once merged. Until then, command-override agents (Grok, etc. — agent_command_override with no resolvable runtime id) still launch the bare interactive TUI with empty args, which times out the ACP initialize handshake under headless Buzz.
Workaround until it ships: set an explicit agent_args on the managed agent (e.g. ["agent", "--always-approve", "stdio"] for Grok), or build desktop from the PR branch.
Repro still stands on the shipped 0.5.28 desktop (macOS arm64), with no manual config: selecting a tier-2 preset as the preferred runtime writes managed-agents.json with no runtime field and agent_args: [], so the spawn log shows the bare command and the ACP handshake times out.
agent_cmd=/opt/homebrew/bin/omp # no "acp"
ERROR buzz_acp: agent initialize failed: Request timeout — agent did not respond within 60s (x10)
Error: all 10 agents failed to start — cannot continue
Manual check of the same handshake:
printf '{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":1}}\n' | omp # hangs on stdin
printf '{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":1}}\n' | omp acp # result in ~120 ms
Root cause matches the analysis above: preset args are only consulted through a resolvable runtime id, and default_agent_args() does not cover omp. Proposed minimal fix with tests (bare name, absolute path, .exe, grok's stdio args, empty-args preset, unknown command): #8584. The wrapper workaround in this issue still works today (agent_command_override → a script that execs omp acp), verified on 0.5.28.