microsoft / microsoft/vscode

Remote agent host is provisioned over SSH regardless of opt-out (the #326902 fix does not reach the CLI)

Open
#328,397 0 comments 0 reactions 1 assignee Claimed by @connor4312 View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

### What happens

Connecting to an SSH host with Remote-SSH downloads a **second** VS Code server — the agent host — into the remote `$HOME`, at channel-latest rather than my client's commit, with AI features opted out.

On a remote whose `$HOME` had no `.vscode-server` at all:

```
~/.vscode-server/cli/servers/
Stable-8a7abeba…/ 1.129.1 the editor server — matches my client
Stable-e4c7e7b1…/ 1.131.0 the agent host — two releases newer, never requested
```

635 MB each. My client is 1.129.1, with `chat.agentHost.enabled: false` and (for good measure) `chat.remoteAgentHostsEnabled: false`. The v1.131 release notes say "To opt in, enable `setting(chat.agentHost.enabled)`" — I never opted in, and it installs anyway.

### Why the existing fix doesn't cover this

#326902 ("agentHost: Respect disabled AI features", fixes #326634) gates the **local** agent host via `AgentHostEnablementService`. It changed 6 files, all TypeScript, **none under `cli/`**.

The remote supervisor is spawned by the CLI, unconditionally, in the path Remote-SSH uses:

```
cli/src/commands/tunnels.rs:146 pub async fn command_shell(…)
cli/src/commands/tunnels.rs:165 ensure_supervisor_running(&paths, &log)
```

and identically at `cli/src/tunnels/control_server.rs:217`. There is no branch — no setting, no flag on `command-shell`, no environment variable, no CLI config file. So no workbench-layer gate can reach it: the CLI starts before the workbench exists. From my connect log:

```
12:21:46.175 Spawned remote CLI: 4004312
12:21:48 agent host: Downloading server: 210550021/210550021 (100%)
12:21:52.529 [server] Server setup complete <- workbench starts 4s LATER
```

### Why it costs more than the local case

The install is keyed to `$HOME`. Anyone using one home per project, per user, or per ephemeral environment pays 635 MB per home. On one machine with 8 project homes this was **5.4 GiB** of duplicated servers, plus a supervisor per home polling `update.code.visualstudio.com` every 6 hours (`UPDATE_CHECK_INTERVAL`).

It is also unpinnable: #318496 commit-pinned the remote CLI but notes "Agent host has no strict commit-lock with the desktop", so the server it spawns tracks channel-latest. That is why a 1.131.0 tree appears next to a 1.129.1 editor.

### Ask

Have the CLI honour an opt-out before `ensure_supervisor_running`. A `command-shell` flag that the Remote-SSH extension passes when AI features are disabled would be enough, since the client already knows.

The code already treats the supervisor's absence as benign, so the degraded path exists:

```rust
Err(e) => warning!(c.log, "Agent host supervisor unavailable; renderer will not see agentHostProxy: {}", e),
```

### Environment

```
VS Code 1.129.1 (8a7abeba6e03ea3af87bfbce9a1b7e48fed567b8)
Remote-SSH 0.124.0
remote.SSH.localServerDownload: off
Client: macOS arm64
Remote: NixOS, aarch64
Settings: chat.agentHost.enabled = false, chat.remoteAgentHostsEnabled = false
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.