Agents Window SSH creates separate remote agent host under default home instead of existing Remote-SSH home, causing duplicate installs/processes
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
## Summary
When connecting to the same Linux host via:
1. Classic Remote-SSH window, and
2. **Open in Agents Window** (Connect via SSH),
VS Code starts the agent host in two different server roots, resulting in duplicate agent host processes on the same remote machine.
## Environment
- VS Code: latest stable
- Remote OS: Ubuntu Linux
- Local OS: macOS
- SSH host config includes a `RemoteCommand` that switches shell startup context and effective `HOME` for Remote-SSH sessions.
- Remote shell initialization sets `HOME` from that shell context.
## Observed behavior
In a Remote-SSH window, the agent host runs from:
`/home/user/.alt-home/.vscode-server/code- --cli-data-dir /home/user/.alt-home/.vscode-server/cli agent host`
In an Agents Window SSH session to the same host, a second agent host runs from:
`/home/user/.vscode-server/code- --cli-data-dir /home/user/.vscode-server/cli agent host`
Two independent agent host processes are present simultaneously on the same host.
## Expected behavior
- Agents Window SSH should reuse the same effective server root/home model as Remote-SSH for the same host, or provide an explicit setting to configure this.
- At minimum, no duplicate install/process trees for the same host when a user intentionally customizes the remote `HOME` via SSH config and shell startup.
## Root cause analysis
Agents Window SSH and Remote-SSH use different implementation paths:
| | Remote-SSH | Agents Window SSH |
|---|---|---|
| SSH transport | OpenSSH binary (via `child_process`) | `ssh2` Node library |
| SSH config consumption | Full OpenSSH behavior, honors `RemoteCommand` | Only reads `hostname`, `user`, `port`, `identityfile`, `identityagent`, `forwardagent` via `ssh -G` |
| Remote startup shell | Honors `RemoteCommand` / user's configured shell | Hardcoded `bash -l -c ...` |
| Remote home/root resolution | Effective `HOME` set by shell startup via `RemoteCommand` chain | `~` expanded by `bash -l`, resolves to OS-default home |
Because the Agents Window SSH path does not process `RemoteCommand` or invoke the user's configured shell, any `HOME` customization that depends on that chain is bypassed. The two paths install to different roots and each writes its own lockfile, so neither detects the other's agent host as reusable.
Relevant source files:
- `src/vs/platform/agentHost/node/sshRemoteAgentHostService.ts`
- `src/vs/platform/agentHost/common/sshConfigParsing.ts`
- `src/vs/platform/agentHost/node/sshRemoteAgentHostHelpers.ts`
- `cli/src/state.rs`
- `cli/src/commands/agent_host.rs`
## Questions
1. Is this divergence from Remote-SSH behavior intentional?
2. If yes, is there a supported way to make Agents Window SSH honor equivalent remote `HOME`/shell semantics?
3. If no, can Agents Window SSH resolve the effective remote root consistently with Remote-SSH to avoid duplicate agent host installations and processes?
VS Code version: Code 1.131.0 (Universal) (e4c7e7b1d6d060162f4aa7f8225271b67ce1df75, 2026-07-28T10:51:25Z)
OS version: Darwin x64 25.6.0
Modes:
Remote OS version: Linux x64 7.0.0-28-generic
System Info
|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)|
|GPU Status|2d_canvas: enabled
GPU0: VENDOR= 0x1002, DEVICE=0x7340, DRIVER_VENDOR=Intel, DRIVER_VERSION=26.6
GPU1: VENDOR= 0x8086, DEVICE=0x3e9b *ACTIVE*
Machine model name: MacBookPro
Machine model version: 16.1
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: enabled_on
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgpu: enabled
webnn: disabled_off|
|Load (avg)|2, 2, 2|
|Memory (System)|16.00GB (1.71GB free)|
|Process Argv||
|Screen Reader|no|
|VM|0%|
|Item|Value|
|---|---|
|Remote|SSH: uranium|
|OS|Linux x64 7.0.0-28-generic|
|CPUs|12th Gen Intel(R) Core(TM) i7-12650H (16 x 1360)|
|Memory (System)|31.11GB (27.31GB free)|
|VM|0%|
Extensions (53)
Name|Identifier|Author|Version
---|---|---|---
Dash|deerawan.vscode-dash|deerawan|2.4.0
GitHub Repositories|github.remotehub|GitHub|0.64.0
autoconf|maelvalais.autoconf|maelvalais|0.2.0
Meson build.|mrmomo.meson-build|Mrmomo|0.2.1
Dev Containers|ms-vscode-remote.remote-containers|ms-vscode-remote|0.466.0
Remote - SSH|ms-vscode-remote.remote-ssh|ms-vscode-remote|0.124.0
Remote - SSH: Editing Configuration Files|ms-vscode-remote.remote-ssh-edit|ms-vscode-remote|0.87.0
WSL|ms-vscode-remote.remote-wsl|ms-vscode-remote|0.104.3
Remote Explorer|ms-vscode.remote-explorer|ms-vscode|0.5.0
Remote Repositories|ms-vscode.remote-repositories|ms-vscode|0.42.0
DeviceTree|plorefice.devicetree|plorefice|0.1.1
Smart Sort|sgryjp.vscode-stable-sort|sgryjp|1.3.0
A2L|softwareape.vscode-a2l|SoftwareApe|0.3.1
Mako|tommorris.mako|tommorris|0.2.0
LinkerScript|zixuanwang.linkerscript|ZixuanWang|1.0.4
Claude Code for VS Code|anthropic.claude-code|Anthropic|2.1.220
LDF Syntax|c4deszes.ldf-syntax|c4deszes|0.4.2
cmake-format|cheshirekow.cmake-format|cheshirekow|0.6.11
Office Viewer|cweijan.vscode-office|cweijan|4.1.8
markdownlint|davidanson.vscode-markdownlint|DavidAnson|0.62.0
Docker DX|docker.docker|docker|0.18.0
Protobuf VSC|drblury.protobuf-vsc|DrBlury|1.6.9
GitLens — Git supercharged|eamodio.gitlens|eamodio|18.3.0
EditorConfig|editorconfig.editorconfig|EditorConfig|0.18.2
Code Runner|formulahendry.code-runner|formulahendry|0.12.2
git-ai|git-ai.git-ai-vscode|git-ai|0.1.21
GitLab|gitlab.gitlab-workflow|GitLab|6.85.5
Universal Assembly Syntax Highlighting|haxogames.x86-assembly-syntax|HaxoGames|1.2.6
Intel HEX format|keroc.hex-fmt|keroc|1.0.0
Devicetree LSP|kylemicallefbonnici.dts-lsp|KyleMicallefBonnici|0.11.0
DBC Language Syntax|lharri73.dbc|lharri73|2.0.0
clangd|llvm-vs-code-extensions.vscode-clangd|llvm-vs-code-extensions|0.6.0
Bash IDE|mads-hartmann.bash-ide-vscode|mads-hartmann|1.43.0
Container Tools|ms-azuretools.vscode-containers|ms-azuretools|2.4.5
Black Formatter|ms-python.black-formatter|ms-python|2026.6.0
Python Debugger|ms-python.debugpy|ms-python|2026.6.0
isort|ms-python.isort|ms-python|2026.6.0
Pylint|ms-python.pylint|ms-python|2026.6.0
Python|ms-python.python|ms-python|2026.4.0
Pylance|ms-python.vscode-pylance|ms-python|2026.3.1
Python Environments|ms-python.vscode-python-envs|ms-python|1.36.0
CMake Tools|ms-vscode.cmake-tools|ms-vscode|1.23.52
C/C++ DevTools|ms-vscode.cpp-devtools|ms-vscode|0.5.13
C/C++|ms-vscode.cpptools|ms-vscode|1.32.2
Hex Editor|ms-vscode.hexeditor|ms-vscode|1.11.1
Resource Monitor|mutantdino.resourcemonitor|mutantdino|1.0.7
XML|redhat.vscode-xml|redhat|0.29.3
YAML|redhat.vscode-yaml|redhat|1.24.0
GNU Linker Map files|trond-snekvik.gnu-mapfiles|trond-snekvik|1.1.0
reStructuredText Syntax highlighting|trond-snekvik.simple-rst|trond-snekvik|1.5.4
CodeLLDB|vadimcn.vscode-lldb|vadimcn|1.12.2
Markdown All in One|yzhang.markdown-all-in-one|yzhang|3.6.3
json|zainchen.json|ZainChen|2.0.2
Contributor guide
Research direction
Read src/vs/platform/agentHost/node/sshRemoteAgentHostService.ts and src/vs/platform/agentHost/common/sshConfigParsing.ts first, then compare their entry points with sshRemoteAgentHostHelpers.ts, cli/src/state.rs, and cli/src/commands/agent_host.rs. Done means the Agents Window SSH path consistently resolves the same remote root as Remote-SSH, or exposes the supported configuration needed to prevent duplicate agent installations and processes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, typescript
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100