mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-22 22:12:49 +01:00
* agent-host: add WSL connection support Add WSL-based remote agent host connections as a third connection type alongside SSH and dev tunnels. On Windows, users can pick "WSL..." in the Remote group of the session workspace picker, choose an installed WSL 2 distro, and the agent host is launched inside that distro. Connected distros are persisted as remembered entries and auto-reconnected on startup -- but only when WSL is already running, we never auto-boot a shut-down distro. - New IPC contract `IWSLRemoteAgentHostService` / `IWSLRemoteAgentHostMainService` mirrors the SSH shape. A shared `RelayTransport` base is extracted from `SSHRelayTransport` so SSH and WSL share the IPC relay pump. - Shared-process service spawns `wsl.exe -d <distro> -e bash -lc <bootstrap>`, reuses the SSH CLI install layout helpers verbatim (`~/.vscode-server/cli/...`), parses the `ws://127.0.0.1:PORT?tkn=...` URL the agent host prints, opens a local WebSocket, and pumps frames over IPC. Retries the open on ECONNREFUSED/AggregateError to ride out WSL 2's localhost-forwarding setup delay on first connect. - Contribution layer adds `WSLReconnectState` mirroring `SSHReconnectState` and extracts a shared `_attemptManagedReconnect` template so SSH and WSL share retry-loop logic (status transitions, incompatible short-circuit, cached-session unpublish on failure). WSL retries are gated on `wsl --list --running` so a stopped distro is never auto-booted. - New "WSL..." action gated on `isWindows && chat.remoteAgentHostsEnabled`; surfaces install docs (`aka.ms/vscode-remote/wsl/install-wsl`) when WSL is missing or no WSL 2 distro is installed. The "Select..." button stays enabled even while a distro is stopped -- explicit user click overrides the never-auto-boot rule and boots the distro on demand. - Workspace picker scopes `resolveWorkspace` to the matching connection authority so a folder picked from one agent host is no longer attributed to another. - New `canConnectOnDemand` provider capability keeps `Select...` enabled while disconnected/connecting for providers with a connect-on-demand hook; concurrent on-demand clicks join the in-flight reconnect promise instead of returning early with a misleading toast. - New parser tests for `wsl --list --verbose` / `--running` output and the `wsl.exe` UTF-8 / UTF-16LE decode heuristic. Fixes https://github.com/microsoft/vscode/issues/307568 (Commit message generated by Copilot) * agent-host: fix test URI authorities for resolveWorkspace scoping Tests in remoteAgentHostSessionsProvider.test.ts used hardcoded `vscode-agent-host://auth/...` URIs but the provider's connectionAuthority is derived from the configured address (default `localhost:4321` -> `localhost__4321`). After tightening `resolveWorkspace` to only claim URIs whose authority matches its own (Linux/Browser CI failure on PR #319971), these tests started failing. Update the URI authorities to match the actual default.