Skip to content

SSH remote agent detection fails when remote PATH is restricted #878

@b3nw

Description

@b3nw

Description

When configuring an SSH remote for agent execution, Maestro fails to detect installed agents on the remote host if the agent binary is not in the default PATH of the SSH non-login shell. This is common because:

  1. SSH command execution (ssh host 'which claude') uses a non-login, non-interactive shell which loads a minimal PATH (typically /usr/bin:/bin)
  2. Agent binaries are typically installed in user-local directories like ~/.local/bin, ~/.claude/local/, or ~/go/bin/ which are only added to PATH by login shell profiles (.bashrc, .profile, .zshrc)
  3. The current detectAgentsRemote() implementation relies solely on which <binary> — when this fails, the agent is marked as "Not Found" even though it's installed and usable

Steps to Reproduce

  1. Configure an SSH remote in Maestro (Settings → SSH Remotes)
  2. Install an agent (e.g., Claude Code) on the remote host at ~/.local/bin/claude
  3. Ensure ~/.local/bin is only added to PATH in .bashrc or .profile (standard installation)
  4. Open "Create New Agent" modal and select the SSH remote
  5. Observe that the agent shows "Not Found" despite being installed

Expected Behavior

Maestro should detect the agent as available on the remote host, regardless of whether the SSH non-login shell's PATH includes the installation directory.

Actual Behavior

Agent shows "Not Found" in the agent picker. The logs show:

[INFO] [AgentDetector] Agent "Claude Code" not found on remote host

The which claude command returns exit code 1 because the non-login SSH shell doesn't have ~/.local/bin in PATH.

Root Cause

detectAgentsRemote() in src/main/ipc/handlers/agents.ts uses only which <binaryName> to locate agents. Non-login SSH shells have a restricted PATH that excludes common user-local installation directories.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions