Repository navigation
fix(acp): resolve npx agents from ~/.local/bin and trust the terminal probe - #888
Merged
Merged
Conversation
Sma1lboy
marked this pull request as ready for review
October 8, 2026 07:53
… probe An official-installer CLI (Hermes' `~/.local/bin/hermes`) was invisible to npx-agent resolution, which only checked PATH and the npm global prefix, so a GUI-launched codeg reported it not installed. Both `resolve_npx_command` and the list path's `NpxCommandResolver` now go through `resolve_system_agent_binary` (PATH, then `~/.local/bin`) before the npm prefix, so the official install outranks an npm copy in a GUI launch as it already does on PATH. Diagnostics also only reached `terminal_only_path` with npm evidence; a login-shell hit with no npm record now reports the GUI PATH gap instead of `not_installed`. Fixes spacering-net#875
Sma1lboy
force-pushed
the
fix/npx-agent-local-bin
branch
from
October 8, 2026 08:18
094e7d3 to
a46aba6
Compare
…stale docs Review fixes on top of the ~/.local/bin npx fallback (spacering-net#888). - Document PATH -> ~/.local/bin -> npm prefix on resolve_npx_command, and update the comments that still described PATH -> npm prefix: is_cmd_available, resolve_system_agent_binary, resolve_vendor_cli, the declared version probe, hermes_setup_argvs, the post-install runtime check, the Hermes registry entry and its test, and preflight's adapter probe. - Drop resolve_vendor_cli's second ~/.local/bin lookup; resolve_npx_command now performs it first, so the call could never find anything new. - Add verdict tests that keep the no-record terminal check after the Node checks and before the ACP adapter explainer. Moving it either way left every existing test green. - Extend the resolver test so the list path still falls back to the npm prefix for a command that is not in ~/.local/bin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
codeg work task |
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.
What does this PR do?
Hermes installed with the official installer (
~/.local/bin/hermes, no npmhermes-agent) shows as not installed when codeg is launched from the GUI, and diagnostics reportnot_installed. Two causes, both insrc-tauri/src/commands/acp.rs:resolve_npx_command()andNpxCommandResolver::resolve_for_list()(the agent-list path) only check PATH and the npm global prefix. A GUI app's PATH usually lacks~/.local/bin, so Hermes resolves toNone. Binary agents already fall back to~/.local/binthroughresolve_system_agent_binary(); npx agents did not.compute_verdict()only reachesterminal_only_pathfor an unresolved npx agent whendb_versionordetected_versionis set. Both come from npm, so an install without an npm record falls through tonot_installed, even when the terminal probe found the command.Related Issue
Fixes #875
Type of Change
Changes Made
src-tauri/src/commands/acp.rs:resolve_npx_command()andNpxCommandResolver::resolve_for_list()now callresolve_system_agent_binary(cmd)(PATH, then~/.local/bin) before the npm global prefix. The order is PATH →~/.local/bin→ npm prefix, so when both an official install and an npm copy exist, a GUI launch picks the official one, the same as a terminal launch where it is on PATH. This matches the launch preference described in the Hermes entry inacp/registry.rs.src-tauri/src/commands/acp.rs: incompute_verdict(), an unresolved npx agent with no npm record whose command resolves in the login shell now getsterminal_only_pathinstead ofnot_installed. The Node/npm checks still run first. The check sits before the adapter branch because the terminal probe looks up the agent's own command, so a hit means the adapter itself is installed. The existing npm-evidence branch is unchanged.npx_command_resolution_checks_local_bin_before_npm_prefix: withHOMEpointed at a temp dir, both npx lookup paths find~/.local/bin/<cmd>. The list path also has the same command in an npm prefix and still returns the~/.local/binone. Unix only.verdict_terminal_only_path_without_npm_evidence.How to Test
~/.local/bin/hermesexists, and make sure the npmhermes-agentpackage is not installed.codeg-serverwith a GUI-like PATH that has node/npm but not~/.local/bin, e.g.PATH=<nvm node bin>:/usr/bin:/bin:/usr/sbin:/sbin, and an emptyCODEG_DATA_DIR.POST /api/acp_env_diagnosticswith{"agentType":"hermes"}, plusacp_get_agent_statusandacp_list_agents.Result with Hermes 0.21.5 on macOS 15 (Apple Silicon), same environment for both builds:
main(592131c)hermes (resolve_npx_command)~/.local/bin/hermescommand -v <cmd> (login shell)~/.local/bin/hermes~/.local/bin/hermesnot_installedokinstalled_versionnull0.21.5+5839.gbed0d53The two new unit tests fail on
mainand pass on this branch.Checklist
Code
fix(scope):,feat(scope):, etc.)cargo test --features test-utils --lib commands::acppassescargo clippy -- -D warnings(desktop and server): see the note belowDocumentation & Housekeeping
~/.local/binlookup is the existingresolve_system_agent_binary(), including its.exehandling; the resolver test is unix onlyScreenshots / Logs
cargo test --features test-utils --lib commands::acp: all passed.cargo clippy ... -- -D warningswith Rust 1.96 report one error,clippy::nonminimal_boolatsrc/computer/helper/mod.rs:667. That line exists onmainand is not touched here. With-A clippy::nonminimal_boolboth are clean.cargo fmt --checkalready reports differences across the repo onmain. Formattingacp.rsbefore and after this change gives the same diff as this PR, so the new lines are formatted.