fix(acp): name the command in agent spawn errors and flag PATH absence - #6486
Open
sanjay3290 wants to merge 2 commits into
Open
fix(acp): name the command in agent spawn errors and flag PATH absence#6486sanjay3290 wants to merge 2 commits into
sanjay3290 wants to merge 2 commits into
Conversation
…ence Signed-off-by: Sanjay Ramadugu <sramadugu1@gmail.com>
Signed-off-by: Sanjay Ramadugu <sramadugu1@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6473.
When
buzz-acpfails to launch an agent, the error surfaced as a bareIO error: No such file or directory (os error 2). That reads like a missingworking 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::spawnnow maps theCommand::spawnfailure into a newAcpError::Spawn { command, source, missing }variant instead of letting itfall through to the blanket
#[from] std::io::Errorarm. The message names thecommand, and when the underlying kind is
NotFoundit appends— binary not found on PATH.Before:
After:
Non-
NotFoundfailures (e.g. a file that exists but is not executable) keep theplain
sourcetext but still name the command.Tests
Two tests in
crates/buzz-acp/src/acp.rs, added in a commit that precedes thefix. Both drive the real
AcpClient::spawn, not a synthetic error value:spawn_error_names_missing_command_and_says_not_on_path— spawns a binaryname that does not exist and asserts the variant, the command name, and the
not found/pathwording.spawn_error_names_command_on_non_notfound_failure(unix) — writes a0644file and spawns it, producing
PermissionDenied, and asserts the command isstill named.
Deletion probes, both compiling and both failing:
missingtoString::new()→ theNotFoundtest fails on the PATHassertion (1 passed, 1 failed).
cmd.spawn().map_err(...)back tocmd.spawn()?→ both tests fail onthe
AcpError::Spawnmatch (0 passed, 2 failed).Verification
Run in a detached worktree pinned at the branch head, clean tree before and
after:
Note for maintainers:
scripts/run-tests.sh unitdoes not includebuzz-acp,so
cargo test -p buzz-acpwas run separately. Two pre-existing tests incrates/buzz-acp/src/config.rs(lazy_pool_defaults_off,idle_pool_sleep_defaults_disabled_and_accepts_cli_value) fail ifBUZZ_ACP_LAZY_POOL/BUZZ_ACP_IDLE_POOL_SLEEPare exported in the shell,because they assert parser defaults while
clapreads the env. Unrelated tothis change, but it may be worth clearing those vars inside the tests.
Out of scope
Error text for any other spawn site, and the
desktopsurfacing of this error.