Codex Desktop Remote SSH to Windows OpenSSH fails when default shell is PowerShell
What version of the Codex App are you using?
Codex Desktop 26.513.20950 on macOS.
Remote Codex CLI observed:
- Windows native Codex CLI:
codex-cli 0.130.0-alpha.5 - WSL/Linux Codex CLI workaround:
codex-cli 0.130.0
What subscription do you have?
ChatGPT Pro
What platform is your computer?
Local client:
- macOS on arm64
- Codex Desktop app
Remote host:
- Windows laptop over OpenSSH
- Windows OpenSSH default shell set to PowerShell 7 (
pwsh.exe) - Passwordless SSH key auth succeeds
- Remote Windows workspace path:
C:\MethodDev codex app-server --helpworks when run manually in PowerShell
What issue are you seeing?
Codex Desktop Remote SSH discovers the Windows SSH host and authenticates successfully, but the connection fails during app-server bootstrap because the Desktop SSH transport sends POSIX login-shell bootstrap code to a PowerShell remote shell.
The failing remote command in app breadcrumbs includes a POSIX shell probe/exec shape like:
exec "$SHELL" -i -c '... if ( -r /etc/csh.login ) source ... exec /bin/sh -c "$CODEX_REMOTE_PAYLOAD" ...'
Because the remote OpenSSH login shell is PowerShell 7, PowerShell parses that POSIX/csh/sh syntax and fails with:
ParserError:
Line |
1 | . ec "$SHELL" -i -c '\''set loginsh=1; if ( -r /etc/csh.login ) source ...
| ~
| Missing statement block after if ( condition ).
The Codex Desktop UI then reports the SSH connection as failed/reconnecting.
This appears related to shell compatibility issues such as #18183 and #19302, but this case is specifically native Windows OpenSSH with PowerShell as the configured default shell. In this setup, normal SSH and manual codex app-server invocation both work; the failure is the Desktop Remote SSH bootstrap assuming a POSIX-compatible login shell.
What steps can reproduce the bug?
- On a Windows machine, install OpenSSH Server and Codex CLI/Desktop.
- Configure Windows OpenSSH to use PowerShell 7 as the default shell, for example:
New-ItemProperty `
-Path "HKLM:\SOFTWARE\OpenSSH" `
-Name DefaultShell `
-Value "C:\Program Files\PowerShell\7\pwsh.exe" `
-PropertyType String `
-Force
Restart-Service sshd
- From a Mac, verify SSH works and lands in PowerShell 7:
ssh windows-host '$PSVersionTable.PSVersion.ToString(); (Get-Location).Path; codex app-server --help'
- In Codex Desktop on macOS, add/select the SSH host under Settings -> Connections -> SSH.
- Enable the connection.
- Observe that the connection fails/retries.
- Inspect Codex Desktop breadcrumbs/logs; they show a PowerShell
ParserErrorfrom the POSIX login-shell bootstrap.
What is the expected behavior?
Codex Desktop Remote SSH should support Windows OpenSSH hosts whose default shell is PowerShell, or at least fail with a clear diagnostic that the current Desktop Remote SSH bootstrap requires a POSIX-compatible shell.
A product-level fix could be one of:
- Detect PowerShell/Windows remote shells and use a PowerShell-native bootstrap path.
- Allow per-connection configuration of a bootstrap shell/command, so users can keep PowerShell as their interactive SSH shell while Codex uses an alternate shell for app-server startup.
- Detect unsupported shells before running POSIX syntax and show a clear actionable error.
Workaround
A WSL-backed SSH target works because it gives Codex a POSIX shell:
- run an SSH server inside WSL on another port, e.g.
2222 - connect Codex Desktop to that WSL SSH alias instead of the Windows OpenSSH alias
- install Linux Codex CLI in WSL so
codex app-serveris on PATH - use
/mnt/c/<workspace>for Windows project files - invoke Windows/IIS/PowerShell tools explicitly from WSL with
pwsh.exe,powershell.exe, orcmd.exe
That workaround is usable, but it means native Windows OpenSSH + PowerShell is not a first-class Codex Desktop Remote SSH target today.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗