You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug][Desktop][Windows] Built-in terminal for SSH remote projects always fails: "File not found:" (empty path) — node-pty get_shell_path cannot resolve bare 'ssh' #5345
Remote host added via Settings → SSH: Linux aarch64, OpenSSH server
Local project terminals work fine; remote project sessions, file access and the agent all work — only the built-in terminal panel fails
Symptom
Opening a terminal in an SSH remote project always fails with:
Error invoking remote method 'kimi:terminal-create': Error: File not found:
Note the path after the colon is empty.
Repro
Settings → SSH → add a remote host
Create a remote project and open it
Press Ctrl+` to open the terminal
Error above appears, 100% reproducible
Root cause (traced to code)
The main process spawns the remote terminal via node-pty with a bare command name: spawn('ssh', args, ...) (found in the terminal module inside resources/app.asar).
node-pty's native layer PtyStartProcess (src/win/conpty.cc) pre-checks relative paths with path_util::get_shell_path (src/win/path_util.cc, identical in v1.1.0 and main). That lookup searches each PATH directory for the literal file name — it never appends PATHEXT/.exe. On Windows only ssh.exe exists, so the pre-check fails and throws "File not found: " + shellpath where shellpath is empty. The subsequent CreateProcessW would resolve ssh.exe correctly (it appends .exe automatically), but it is never reached. Local terminals pass an absolute path (PathIsRelativeW is false), skipping the check — hence they work.
While working around this, I found two additional defects in the same function that defeat user-side workarounds:
Last PATH entry is silently dropped. The parser loop while ((pos = buffer.find(';')) != npos) only collects segments before a semicolon; the final segment remaining in buffer after the loop is never added to paths. Appending a directory containing an extensionless ssh copy to the end of PATH therefore does not help — the directory is never searched.
CWD branch returns an empty string.if (file_exists(filename)) { return shellpath; } returns the emptyshellpath when a file named ssh happens to exist in the process CWD, producing the same empty-path error.
Suggested fix
In the desktop app: resolve ssh to an absolute path (e.g. C:\Windows\System32\OpenSSH\ssh.exe) before calling node-pty, or
Upstream in node-pty: make get_shell_path honor PATHEXT, fix the last-PATH-entry drop, and return filename (not the empty shellpath) from the CWD branch.
Workaround (verified)
Place an extensionless copy of ssh.exe in a directory that is on PATH and is not the last PATH entry (e.g. C:\Users\<user>\.kimi-code\bin\ssh). The pre-check then succeeds and CreateProcessW launches ssh.exe normally; the remote terminal works immediately, no app restart needed.
Activity
fix(desktop): resolve ssh.exe absolute path on Windows for remote ter…
fix(desktop): resolve ssh.exe absolute path on Windows for remote ter…
fix(desktop): resolve ssh.exe absolute path on Windows for remote ter…
fix(desktop): resolve ssh.exe absolute path on Windows for remote ter…