Skip to content

fix: detect npm/nvm-installed agents on SSH remotes#366

Open
chr1syy wants to merge 1 commit intoRunMaestro:mainfrom
chr1syy:fix-ssh-codex
Open

fix: detect npm/nvm-installed agents on SSH remotes#366
chr1syy wants to merge 1 commit intoRunMaestro:mainfrom
chr1syy:fix-ssh-codex

Conversation

@chr1syy
Copy link
Contributor

@chr1syy chr1syy commented Feb 14, 2026

Summary

  • SSH remote agent detection and execution used a hardcoded PATH that missed Node version manager directories (e.g., ~/.nvm/versions/node/v22.21.1/bin/)
  • Agents installed via npm through nvm, fnm, volta, mise, asdf, or n were not detected on remote hosts
  • Added dynamic shell-based detection of Node version manager bin paths to both buildSshCommand() and buildSshCommandWithStdin(), mirroring the existing local detection logic in detectNodeVersionManagerBinPaths()

Details

The SSH command builder in src/main/utils/ssh-command-builder.ts had a hardcoded PATH that only included static directories:

export PATH="$HOME/.local/bin:$HOME/.opencode/bin:$HOME/bin:/usr/local/bin:/opt/homebrew/bin:$HOME/.cargo/bin:$PATH"

This meant which codex (used for agent detection) and agent execution both failed on remotes where the agent was installed via npm/nvm into a path like /home/user/.nvm/versions/node/v22.21.1/bin/codex.

The fix adds shell snippets that dynamically probe the remote host for version manager installations:

  • nvm: $NVM_DIR/current/bin + all $NVM_DIR/versions/node/v*/bin
  • fnm: aliases/default/bin + all node-versions/v*/installation/bin
  • volta: ~/.volta/bin
  • mise: ~/.local/share/mise/shims
  • asdf: ~/.asdf/shims
  • n: $N_PREFIX/bin

Two variants are provided:

  • buildNodeVersionManagerPathLines() — multi-line script for stdin-based SSH execution
  • buildNodeVersionManagerPathSnippet() — compact single-line version for bash -c '...'

Test plan

  • All 63 existing ssh-command-builder tests pass
  • All 16 ssh-remote-resolver tests pass
  • Manual test: configure SSH remote with nvm-installed Codex and verify detection
  • Manual test: verify agent execution works on remote with nvm-installed agent

🤖 Generated with Claude Code

SSH remote agent detection and execution used a hardcoded PATH that
only included static directories like ~/.local/bin and /usr/local/bin.
This meant agents installed via Node version managers (nvm, fnm, volta,
mise, asdf, n) were not found on remote hosts.

Add dynamic Node version manager PATH detection to the SSH command
builder. Both buildSshCommand() and buildSshCommandWithStdin() now
probe the remote host for version manager installations and prepend
their bin directories to PATH before executing commands.

This mirrors the existing local detection logic in pathUtils.ts
detectNodeVersionManagerBinPaths() but runs as shell commands on the
remote host rather than Node.js filesystem calls.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant