Skip to content

fix(acp): name the command in agent spawn errors and flag PATH absence - #6486

Open
sanjay3290 wants to merge 2 commits into
block:mainfrom
sanjay3290:spark2/acp-spawn-error-names-command
Open

fix(acp): name the command in agent spawn errors and flag PATH absence#6486
sanjay3290 wants to merge 2 commits into
block:mainfrom
sanjay3290:spark2/acp-spawn-error-names-command

Conversation

@sanjay3290

Copy link
Copy Markdown

Fixes #6473.

When buzz-acp fails to launch an agent, the error surfaced as a bare
IO error: No such file or directory (os error 2). That reads like a missing
working directory, so operators look in the wrong place. The command name is
never printed, and neither is the fact that the binary was not on PATH.

Change

AcpClient::spawn now maps the Command::spawn failure into a new
AcpError::Spawn { command, source, missing } variant instead of letting it
fall through to the blanket #[from] std::io::Error arm. The message names the
command, and when the underlying kind is NotFound it appends
— binary not found on PATH.

Before:

IO error: No such file or directory (os error 2)

After:

failed to spawn agent command "claude-code-acp": No such file or directory (os error 2) — binary not found on PATH

Non-NotFound failures (e.g. a file that exists but is not executable) keep the
plain source text but still name the command.

Tests

Two tests in crates/buzz-acp/src/acp.rs, added in a commit that precedes the
fix. Both drive the real AcpClient::spawn, not a synthetic error value:

  • spawn_error_names_missing_command_and_says_not_on_path — spawns a binary
    name that does not exist and asserts the variant, the command name, and the
    not found / path wording.
  • spawn_error_names_command_on_non_notfound_failure (unix) — writes a 0644
    file and spawns it, producing PermissionDenied, and asserts the command is
    still named.

Deletion probes, both compiling and both failing:

  • Force missing to String::new() → the NotFound test fails on the PATH
    assertion (1 passed, 1 failed).
  • Revert cmd.spawn().map_err(...) back to cmd.spawn()? → both tests fail on
    the AcpError::Spawn match (0 passed, 2 failed).

Verification

Run in a detached worktree pinned at the branch head, clean tree before and
after:

cargo fmt --all -- --check                        exit 0
cargo clippy --workspace --all-targets -- -D warnings   exit 0
./scripts/run-tests.sh unit                       All tests passed
cargo test -p buzz-acp                            805 passed; 0 failed

Note for maintainers: scripts/run-tests.sh unit does not include buzz-acp,
so cargo test -p buzz-acp was run separately. Two pre-existing tests in
crates/buzz-acp/src/config.rs (lazy_pool_defaults_off,
idle_pool_sleep_defaults_disabled_and_accepts_cli_value) fail if
BUZZ_ACP_LAZY_POOL / BUZZ_ACP_IDLE_POOL_SLEEP are exported in the shell,
because they assert parser defaults while clap reads the env. Unrelated to
this change, but it may be worth clearing those vars inside the tests.

Out of scope

Error text for any other spawn site, and the desktop surfacing of this error.

…ence

Signed-off-by: Sanjay Ramadugu <sramadugu1@gmail.com>
Signed-off-by: Sanjay Ramadugu <sramadugu1@gmail.com>
@sanjay3290
sanjay3290 requested a review from a team as a code owner August 21, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

buzz-sprig container does not include Goose binary but UI allows Goose harness selection for k3s agents

1 participant