Skip to content

Add a direct SSH mode without ControlMaster - #1113

Merged
thesiti92 merged 2 commits into
remote/14-windows-skip-remote-hostsfrom
remote/15-ssh-direct-mode
Oct 15, 2026
Merged

thesiti92 merged 2 commits into
remote/14-windows-skip-remote-hostsfrom
remote/15-ssh-direct-mode

Conversation

@thesiti92

Copy link
Copy Markdown
Contributor

Win32-OpenSSH has no ControlMaster, so Windows needs a way to reach a host without sharing one connection. This adds a direct session (a ReviewSshSession without controlPath), following the approach Remote-SSH took for Windows in microsoft/vscode-remote-release#96:

  • each command opens its own connection, with BatchMode=yes, so ssh never prompts;
  • one long-lived ssh -N -T -D 127.0.0.1:<port> per host; it binds its SOCKS port only after logging in, which is the ready check;
  • -L forwards become in-process loopback listeners that tunnel through that SOCKS port (reviewSocksForward.ts);
  • the installer's -R npm relay runs in its own ssh, and reads the port from ssh's Allocated port line (forced to LogLevel=INFO).

Nothing selects direct mode yet except DEV_FAST_REVIEW_SSH_DIRECT=1 in development builds. Control mode is unchanged.

Tests: unit tests for the SOCKS forward and the direct args; reviewSshDirect.containers.test.ts runs a real direct master, a forward to the host's sshd, and a held -R round trip against a container (WB_TEST_CONTAINERS=1). The remote-host journey reaches online in direct mode. Its later Home step fails at this stack tip in both modes because the Home rewrite (#1098) removed the table it looks for.

Stacked on #1110.

@thesiti92
thesiti92 force-pushed the remote/15-ssh-direct-mode branch from ee4fc3c to 6faad1f Compare October 14, 2026 07:13
@thesiti92
thesiti92 force-pushed the remote/15-ssh-direct-mode branch 2 times, most recently from b746a75 to 9d03d4e Compare October 14, 2026 17:27
@thesiti92
thesiti92 force-pushed the remote/15-ssh-direct-mode branch from 9d03d4e to d9d7797 Compare October 14, 2026 17:41
@thesiti92
thesiti92 force-pushed the remote/15-ssh-direct-mode branch from d9d7797 to 2fd6a76 Compare October 14, 2026 17:51
@thesiti92
thesiti92 force-pushed the remote/15-ssh-direct-mode branch from 2fd6a76 to 98e193c Compare October 14, 2026 18:21
@thesiti92
thesiti92 force-pushed the remote/15-ssh-direct-mode branch from 98e193c to 5b4acf7 Compare October 14, 2026 19:20
@thesiti92
thesiti92 force-pushed the remote/15-ssh-direct-mode branch 2 times, most recently from 0f0692b to 598a510 Compare October 14, 2026 19:36
@thesiti92
thesiti92 force-pushed the remote/15-ssh-direct-mode branch from 598a510 to 9d69f35 Compare October 14, 2026 19:37
@thesiti92
thesiti92 force-pushed the remote/15-ssh-direct-mode branch 2 times, most recently from 4fb5b75 to ec501cc Compare October 14, 2026 19:53
@thesiti92
thesiti92 force-pushed the remote/15-ssh-direct-mode branch from ec501cc to 8591e1e Compare October 14, 2026 19:56
@thesiti92
thesiti92 force-pushed the remote/15-ssh-direct-mode branch from 8591e1e to bd75b93 Compare October 14, 2026 20:06
@thesiti92
thesiti92 force-pushed the remote/15-ssh-direct-mode branch from bd75b93 to 9107d8b Compare October 14, 2026 20:44
@thesiti92
thesiti92 force-pushed the remote/15-ssh-direct-mode branch from 9107d8b to c0c65f9 Compare October 14, 2026 21:52
@thesiti92
thesiti92 force-pushed the remote/15-ssh-direct-mode branch from 2f9178c to 0cde9eb Compare October 15, 2026 01:14
@thesiti92
thesiti92 added this pull request to stack #1148 October 15, 2026 01:14
@thesiti92
thesiti92 marked this pull request as ready for review October 15, 2026 01:14
Win32-OpenSSH cannot share a connection. A direct session runs each
command over its own connection with BatchMode, keeps one ssh -D master
per host, forwards ports in-process through its SOCKS port, and holds
the installer's -R relay in an ssh of its own. Development builds can
force it with DEV_FAST_REVIEW_SSH_DIRECT=1; nothing selects it yet.
…rr, give the probe the connect allowance, and read the dev switch as 1
@thesiti92
thesiti92 force-pushed the remote/15-ssh-direct-mode branch from 0cde9eb to 0c1bd80 Compare October 15, 2026 01:45
@thesiti92
thesiti92 merged commit 89335a3 into main Oct 15, 2026
3 of 6 checks passed
@thesiti92
thesiti92 deleted the remote/15-ssh-direct-mode branch October 15, 2026 02:12
thesiti92 added a commit that referenced this pull request Oct 15, 2026
Turns remote hosts back on for Windows laptops (reverting #1110's early
return) with direct sessions from #1113.

- The inbox `%SystemRoot%\System32\OpenSSH\ssh.exe` is used when
present, ahead of an MSYS ssh (Git for Windows) on PATH.
- ssh runs with `windowsHide` and not detached; a detached ssh gets a
console window on Windows.
- Windows needs a key ssh-agent can use and a host already in
known_hosts. A refused key says to use `ssh-add`; an unknown host key
already says to run `ssh <alias>` in a terminal.
- `Include` globs in ssh_config take forward slashes on Windows.
- docs/remote-hosts.md: the Windows setup.

Checked in a Windows 11 VM (24H2, ARM64, inbox OpenSSH 9.5p1) against a
Linux container with the real modules and the Desktop's spawn options:
picks the inbox ssh.exe; exec and the probe run with no prompt and no
window; `uploadFile` is byte-exact into a path with a space; the `-D`
master, a forward to the host's sshd and a held `-R` round trip work; an
unknown host key and an unauthorized key fail fast with ssh's own
messages; an `Include` with a Windows path lists its aliases; no ssh.exe
is left after. A dev build of this branch also ran in that VM (ARM64
Electron), against a Linux host with Whiteboard on its PATH, using an
ssh-agent key: online in 10 s, `/health` through the SOCKS forward, a
killed master recovered in under 2 s, and a normal quit left no ssh.exe.
Dev-only gaps on Windows ARM64, unrelated to this change, kept it from
the UI and the dev install: `run.sh` looks for `review` rather than
`Whiteboard.exe` and hands MSYS paths to node, the curated extensions
and `diffr` have no win32-arm64 target, and the dev pack (`pnpm pack`)
fails there.

Stacked on #1113.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants