Skip to content

agentHost: support SSH ProxyCommand and ProxyJump - #336347

Draft
roblourens wants to merge 1 commit into
mainfrom
roblou/agents/implementing-vscode-feature-request-313164
Draft

roblourens wants to merge 1 commit into
mainfrom
roblou/agents/implementing-vscode-feature-request-313164

Conversation

@roblourens

Copy link
Copy Markdown
Member

Summary

  • honor effective SSH ProxyCommand and ProxyJump configuration when connecting remote Agent Hosts
  • keep executable proxy configuration inside the shared process and bridge proxy stdio into the existing ssh2 final-host connection
  • add cross-platform command construction, trusted OpenSSH lookup, sanitized failures, and complete proxy process-tree cleanup
  • preserve the proxy transport when replacing only the Agent Host relay

Security

  • proxy directives never cross renderer IPC or enter persisted connection metadata
  • ProxyCommand substitutions are validated and expanded in one pass
  • ProxyJump uses an absolute OpenSSH executable, shell: false, and an argument array
  • proxy failures never fall back to direct DNS/TCP dialing
  • independent Claude, GPT, Gemini, and Grok reviews were run; all confirmed findings were fixed and focused re-reviews found no remaining critical, high, or medium issues

Validation

  • npm run compile
  • targeted ESLint for the four changed files
  • npm run typecheck-client
  • 189 focused SSH Agent Host tests
  • live macOS topology with real SSH jump and target servers plus a real mock-enabled Agent Host
    • system OpenSSH completed both ProxyCommand and ProxyJump routes
    • the production SSHRemoteAgentHostMainService completed config resolution, SSH, remote CLI discovery, endpoint selection, and WebSocket relay for both routes
    • an isolated Agents window auto-connected both hosts and registered their remote copilotcli and mock agents

Notes

  • proxy-hop authentication remains owned by local OpenSSH or the configured proxy command; existing Agents prompts continue to handle the final host
  • Windows-specific executable lookup, cmd.exe selection, argument construction, and cleanup are covered by tests; live Windows validation remains for CI/follow-up

Fixes #313164.

(Written by Copilot)

Resolve executable proxy configuration inside the shared process, bridge ProxyCommand or ProxyJump stdio into ssh2, and preserve existing final-host authentication and verification. Add focused security, lifecycle, and cross-platform regression coverage for the new transport path. Fixes #313164.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 16, 2026 00:03

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

POSIX ProxyCommand execution incorrectly forces /bin/sh instead of the user’s login shell.

Get a fresh assessment by requesting another Copilot review.

Review tier: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds SSH ProxyCommand and ProxyJump support for remote Agent Hosts.

Changes:

  • Resolves effective SSH proxy configuration securely.
  • Bridges proxy process streams into ssh2 with lifecycle cleanup.
  • Adds proxy parsing, validation, and cross-platform tests.
File Description
sshRemoteAgentHostService.ts Integrates proxy resolution, spawning, transport, and cleanup.
sshProxyTransport.ts Implements proxy parsing, expansion, validation, and command construction.
sshRemoteAgentHostService.test.ts Tests proxy integration and lifecycle behavior.
sshProxyTransport.test.ts Tests proxy parsing and command validation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

const shell = spec.shell
? process.platform === 'win32'
? join(process.env['WINDIR'] ?? 'C:\\Windows', 'System32', 'cmd.exe')
: '/bin/sh'
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.

agents: ssh ProxyCommand

2 participants