fix(macos): remote mode fails with managed SSH aliases#99661
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 249998aa57
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| case .openssh: | ||
| [] |
There was a problem hiding this comment.
Preserve SSH-config ports for managed aliases
When sshHostKeyPolicy: "openssh" is used with a managed Host gateway-alias that sets Port 2222, this still connects to port 22 because parseSSHTarget("gateway-alias") defaults the port to 22 and sshArguments later unconditionally appends -p 22, overriding the alias before the OpenSSH policy can be used. I checked OpenSSH's config rules: command-line options are read before user config and the first value wins; ssh -G -p 22 -F <config-with-Port-2222> gateway-alias reports port 22, while omitting -p reports port 2222.
Useful? React with 👍 / 👎.
* fix(macos): support managed SSH aliases safely * test(macos): serialize gateway state isolation
What Problem This Solves
Fixes an issue where macOS users connecting through an SSH alias could fail when that alias defined an explicit host-key policy, or could lose tunnel monitoring when the alias enabled connection multiplexing. It also prevents macOS remote-configuration tests from temporarily overwriting the installed app's real preferences and eliminates two shared-state test races found while validating the fix.
Why This Change Was Made
The app keeps strict host-key verification by default, adds an explicit per-remote opt-in for using the effective OpenSSH trust policy, and disables multiplexing/backgrounding only for the app-owned tunnel so its exact child process remains monitorable and restartable. Remote-configuration tests receive isolated preference suites, and gateway tests route state-directory changes through the existing isolation lock.
User Impact
Remote mode remains strict by default and can deliberately support managed aliases through
sshHostKeyPolicy: "openssh"; changing the target resets that opt-in to strict. App-owned SSH processes stay recoverable when aliases enableControlMasteror post-authentication backgrounding. Contributors can run the macOS suite without changing a live OpenClaw setup or hitting the two reproduced state races. Silent auto-pairing always requires a trusted host key and bypasses multiplexed masters.Evidence
swift test --package-path apps/macos --quiet: 604 tests in 114 suites passed.src/config/config-misc.test.ts: 91 tests passed.