Skip to content

fix(macos): remote mode fails with managed SSH aliases#99661

Merged
steipete merged 2 commits into
mainfrom
codex/fix-macos-ssh-config
Jul 3, 2026
Merged

fix(macos): remote mode fails with managed SSH aliases#99661
steipete merged 2 commits into
mainfrom
codex/fix-macos-ssh-config

Conversation

@steipete

@steipete steipete commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

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 enable ControlMaster or 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.
  • Focused SSH, pairing, config, and target-reset runs: 49 tests in 5 suites passed.
  • src/config/config-misc.test.ts: 91 tests passed.
  • Base config schema and generated config-doc baseline checks passed.
  • SwiftFormat lint: all 14 changed Swift files pass.
  • Oxfmt: all 6 changed config files correctly formatted.
  • SwiftLint: exit 0; existing unrelated warnings only.
  • Live macOS validation: a configured SSH alias established an app-owned, non-multiplexed tunnel; readiness returned healthy and the app held two established WebSocket connections through it.
  • Automated review: no accepted or actionable findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: macos App: macos gateway Gateway runtime size: L maintainer Maintainer-authored PR labels Jul 3, 2026
@steipete
steipete merged commit af420db into main Jul 3, 2026
72 of 78 checks passed
@steipete
steipete deleted the codex/fix-macos-ssh-config branch July 3, 2026 22:19

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +421 to +422
case .openssh:
[]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 4, 2026
* fix(macos): support managed SSH aliases safely

* test(macos): serialize gateway state isolation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant