agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

Warn when another ao on PATH shadows the app's bundled CLI

Open AgentWrapper opened this issue 1 month ago • 2 comments

Problem

A user turned on Settings → Remote hosts → Allow access from your devices and then ran ao remote-host status in an AO terminal to get the connection details. The command failed with:

unknown command "remote-host" for "ao"

The cause was an older ao that came before the app's bundled CLI on PATH. AO starts terminals with …/Agent Orchestrator.app/Contents/Resources/daemon first on PATH. The user's ~/.zshrc and ~/.zprofile then unconditionally prepend ~/.local/bin, which held a symlink to a local dev build from June that predates remote-host. A broken npm link of @aoagents/ao (it failed with "no prebuilt binary for darwin-arm64") was also on PATH.

Nothing told the user their ao was not the app's ao. The error looked like an AO bug.

What already exists

  • ao doctor has a checkAOBinary check (backend/internal/cli/doctor.go) that flags an ao on PATH shadowing the daemon's binary. However:
    • it only runs when someone asks for it;
    • when a shadow exists, typing ao doctor runs the shadowing binary, which may be too old to have the check.
  • The desktop CLI link status (frontend/src/shared/cli-link.ts, pathIssue) is Developer Mode only.

Proposal

Warn proactively when the ao a user's shell resolves is not the bundled CLI:

  1. Desktop app: on startup (and maybe when Settings opens), resolve ao through the user's login and interactive shell env (the same shell-env probe the app already uses). If it does not resolve to the bundled binary, show a non-blocking notice. The notice should give the shadowing path and version, the bundled path, and the fix: remove or reorder the shadowing install. Never edit the shell rc files automatically.
  2. CLI: when the bundled CLI is invoked by full path or by the daemon, it could cheaply note a shadow. Item 1 is the main fix, though, because the stale binary can't warn about itself.
  3. Optionally, make docs and settings copy that tells users to run ao … mention the full bundled path as a fallback.

Acceptance

  • With a different ao first on the interactive shell's PATH, the desktop app shows a warning naming both paths.
  • With the bundled ao first (or a symlink to it, such as the Developer Mode CLI link), no warning appears.
  • No shell startup files are modified.

AgentWrapper avatar Oct 26 '26 22:10 AgentWrapper

Hi can I work on this ?

rhithesh avatar Oct 27 '26 02:10 rhithesh

@rhithesh sure, pick up the issue and try to reproduce it. If needed, make a PR and add visual proof as well for the fix

ApexYash11 avatar Oct 29 '26 12:10 ApexYash11