Repository navigation
fix(relay): honor the remote OpenSSH login shell for Windows SSH terminals - #9455
Conversation
📝 WalkthroughWalkthroughWindows shell resolution now reads and caches the OpenSSH 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
eb5f9d1 to
29c4076
Compare
|
Thanks so much for this, @rodboev — honor the remote OpenSSH login shell for Windows SSH terminals. Verified (fail-on-main/pass-on-branch), rebased on latest |
…inals (stablyai#9455) * fix(relay): honor the remote OpenSSH login shell for Windows SSH terminals (stablyai#9327) * Prove OpenSSH DefaultShell fallback stays safe on bad registry reads
Summary
Windows SSH terminals now open the shell the remote host actually configured, honoring the OpenSSH
DefaultShellregistry value instead of always falling back to inbox PowerShell.ELI5
When you SSH into a Windows machine, it has a setting for which shell to launch. We were ignoring that setting and forcing PowerShell; now we read it and give you the shell the server was told to use.
Root cause & fix
resolveWindowsDefaultShellnever consulted the OpenSSHDefaultShellvalue inHKLM\SOFTWARE\OpenSSH, so a host configured for a different login shell was overridden by the inbox-PowerShell fallback. The fix adds an exportedreadOpenSshDefaultShell()that runsreg.exe query, parses and memoizes the value, and inserts it into the resolution chain between the$SHELLcheck and the PowerShell fallback. On failure, malformed output, or a missing path it returns'', so the existing$SHELL→ WindowsPowerShell →ComSpec→powershell.exeorder is preserved unchanged.Evidence
Validated & rebased onto latest main during a bug-bash triage on 2026-07-23. Rebase was clean onto merge-base
7ab601487c; the PR touches onlysrc/relay/pty-shell-utils.tsand its test.TypeError: readOpenSshDefaultShell is not a function).oxlint src/relay/pty-shell-utils.ts— no findings.Trade-offs
None — pure fix.
Regression risk
Zero-regression by construction: the registry lookup is reached only when
$SHELLis unset/nonexistent, and empty or failed reads short-circuit to the prior fallback chain, so non-SSH and non-Windows paths are unchanged. The code path is gated behindprocess.platform === 'win32', and the result is memoized in a module-scoped var (injectable in tests). Proven by the passing branch tests and the revert-fails check.Credit to @rodboev for the original fix. Validated, rebased, and (where applicable) hardened via automated bug-bash review; original fix design preserved.