agentHost: support SSH ProxyCommand and ProxyJump - #336347
Draft
roblourens wants to merge 1 commit into
Draft
roblourens wants to merge 1 commit into
roblourens wants to merge 1 commit into
Conversation
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>
Contributor
There was a problem hiding this comment.
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
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
ssh2with 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' |
This was referenced Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
ProxyCommandandProxyJumpconfiguration when connecting remote Agent Hostsssh2final-host connectionSecurity
ProxyCommandsubstitutions are validated and expanded in one passProxyJumpuses an absolute OpenSSH executable,shell: false, and an argument arrayValidation
npm run compilenpm run typecheck-clientProxyCommandandProxyJumproutesSSHRemoteAgentHostMainServicecompleted config resolution, SSH, remote CLI discovery, endpoint selection, and WebSocket relay for both routescopilotcliandmockagentsNotes
cmd.exeselection, argument construction, and cleanup are covered by tests; live Windows validation remains for CI/follow-upFixes #313164.
(Written by Copilot)