Skip to content

fix: make SSH command launch and cleanup portable to Windows - #181

Merged
sethtroisi merged 5 commits into
googlecolab:mainfrom
lw-liuwang:fix-windows-ssh-compatibility
Oct 22, 2026
Merged

sethtroisi merged 5 commits into
googlecolab:mainfrom
lw-liuwang:fix-windows-ssh-compatibility

Conversation

@lw-liuwang

@lw-liuwang lw-liuwang commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

On native Windows, the generated SSH ProxyCommand uses POSIX single quotes around Python paths and fails to start. ssh --proxy-mode --rm also raises AttributeError on the missing signal.SIGHUP before connecting. This PR fixes these SSH blockers as an incremental step toward #85.

Closes #178. The quoting diagnosis was previously documented by @Le-Anh-Duy in discussion #97; related broader work includes #86 and #167.

Windows support plan and remaining validation: #180

Replaces #179 with the same commits under the descriptive fix-windows-ssh-compatibility branch name.

Changes

  • Generate Windows ProxyCommand arguments with subprocess.list2cmdline; retain POSIX shlex.join and exact-argument/security regression coverage.
  • Register only the available cleanup signals and use os.devnull for the local known-hosts sink.
  • Add real Windows child-process tests using a Python installation path containing spaces, plus a real Windows OpenSSH/local-stub launch check. No Colab resources are used by these tests.
  • Add a native Windows live integration script and update the SSH design documentation.

Validation

Tested on native Windows 11 build 26200, Python 3.12.14, with Windows OpenSSH:

  • TDD: all 22 new regression cases fail before the production changes and pass afterward.
  • SSH suite: 115 passed (test_ssh.py, test_ssh_autocreate.py, test_ssh_lifecycle.py, test_ssh_wire_contract.py, test_ssh_workdir.py, test_windows_ssh.py), including both colored and plain help output.
  • Full suite before the fix: 21 failed, 333 passed, 2 skipped. After the fix: 15 failed, 362 passed, 2 skipped. Remaining failures were reproduced before the change: 2 help-output parsing, 2 Windows temporary-file editing, 11 headless REPL construction.
  • Ruff passes on all changed Python files. Repository-wide Ruff still reports 5 pre-existing E402 errors in examples/finetune_run.py.
  • CLI ssh --help smoke passes.
  • Three-platform SSH validation passed: Windows, Linux, macOS. The upstream workflow security scan and Google CLA check pass.

Live Colab validation passed on 2026-10-20. After authenticating on native Windows with OAuth2, uv run python integration/repro_windows_ssh/test.py created one CPU runtime, launched Windows OpenSSH with the generated ProxyCommand and an identity path containing spaces, and received windows-ssh-ok from the remote shell. The recorded test endpoint was released and the final CLI sessions query reported no active assignments. The script cleans up only its own endpoint and preserves unrelated sessions, including assignments used from WSL.

The existing Linux/macOS-only support statement is retained. This PR does not claim complete native Windows support or guaranteed cleanup after forced process termination. Native interactive console, file-editing and headless REPL fixes remain separate work.

Comment thread .github/workflows/ssh-compatibility.yml Resolved
Comment thread src/colab_cli/commands/ssh.py Resolved
@sethtroisi
sethtroisi merged commit 4025416 into googlecolab:main Oct 22, 2026
7 checks passed
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.

Windows: fix generated SSH ProxyCommand launch and missing SIGHUP cleanup signal

2 participants