Skip to content

The agent that grows with you

fix(desktop-ssh): stop resolving exec-wrappers to python in locateHermes (#74411)

webtecnica8b752603c476
diff --git a/apps/desktop/electron/remote-lifecycle.ts b/apps/desktop/electron/remote-lifecycle.ts
index db4d5b20dda..b8a385c2e7e 100644
--- a/apps/desktop/electron/remote-lifecycle.ts
+++ b/apps/desktop/electron/remote-lifecycle.ts
@@ -128,25 +128,16 @@ function expandRemotePath(p) {
// non-login `ssh host cmd` PATH misses user installs), then known install paths.
async function locateHermes(ssh, remoteHermesPath) {
const resolveLauncher = async (candidate: string) => {
- const script =
- 'import os,shlex,sys\n' +
- `p=os.path.expanduser(${shq(candidate)})\n` +
- 'out=p\n' +
- 'try:\n' +
- ' data=open(p,"r",encoding="utf-8",errors="ignore").read(4096)\n' +
- ' for line in data.splitlines():\n' +
- ' words=shlex.split(line)\n' +
- ' if len(words)>1 and words[0]=="exec":\n' +
- ' target=os.path.expanduser(words[1])\n' +
- ' if os.path.isabs(target) and os.access(target,os.X_OK):out=target\n' +
- ' break\n' +
- 'except (OSError,ValueError):pass\n' +
- 'print(out)'
-
- const resolved = (await ssh.exec(`python3 -c ${shq(script)}`)).trim()
-
- return resolved || candidate
- }
+ // Return the candidate path directly. The hermes binary or wrapper script
+ // is executable and handles argument forwarding (e.g. `exec <python> <script> "$@"`)
+ // correctly on its own. Previously, this function followed `exec` wrappers and
+ // returned only the python interpreter, which broke:
+ // - version checking: `<python> --version` printed "Python x.y.z" instead of
+ // the Hermes version, and
+ // - capability probing: `<python> serve --help` failed entirely.
+ // See https://github.com/NousResearch/hermes-agent/issues/74411
+ return candidate
+ }
const isExecutable = async (candidate: string) => {
try {