Repository navigation
Conversation
…mote Move CLI resolution, compatibility checks, workspace readiness and SSH config writing into ConnectionSetup so a window without Remote-SSH can reuse them. The SSH config file and ssh path are now passed in by the caller.
Coder: Open Workspace in Agents Window starts the workspace if needed, writes the SSH config to ~/.ssh/config for plain ssh, and opens the template's directory (or the last folder opened on the workspace) in the Agents window. The command shows only where VS Code has the Agents window.
EhabY
force-pushed
the
feat/agents-window-support
branch
from
November 25, 2026 15:04
cf80158 to
ea77c68
Compare
This branch has not been deployed
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.
Refs #1218
Part of VSC-62
Makes the extension work in the VS Code Agents window, in three commits:
feat: declarescapabilities.agentsWindow.supported, and skips the "Remote SSH not found" error there (the Agents window disables Remote SSH).refactor(remote): pulls the window-independent connection steps (CLI, compatibility, workspace readiness, SSH config) out ofRemoteintoConnectionSetup, with no behavior change. The tests moved with the code. Best reviewed on its own.feat: adds Coder: Open Workspace in Agents Window. It picks a workspace, starts it if needed, writes the SSH config to~/.ssh/configfor plainssh, and opens the Agents window on the template's directory or the last folder opened on the workspace. Telemetry span:workspace.agents_window.open.Verified live on dogfood with VS Code Insiders 1.148 and the packaged VSIX: the Agents window opened on the workspace over SSH, including when it was already open on a local folder.
coder.openin an editor window still connects after the refactor.The MCP server is in the stacked PR, #1214.
Plan and decision log
Coder extension in the VS Code Agents window
Status: phases 1 and 2 in
feat/agents-window-support(#1213), phase 3 infeat/mcp-serverstacked on it; the Microsoft issue is drafted, not filed.Findings (verified)
Source:
microsoft/vscodemain atede881c5(2026-11-20). Test: VS Code Insiders 1.148.0 (35cb524) under xvfb, with a test build of v1.18.2 that addscapabilities.agentsWindow.supported: trueplusonStartupFinished(test only).openAgentsWindowopens the agent-sessions workspace withforceNewWindow: true(windowsMainService.ts:304-340).isSessionsWindowis fixed when the window is created (:1670). In the test, window1 (isSessionsWindow: true) and window2 (false) each activatedcoder.coder-remoteseparately, and both ran at the same time. No window is ever "switched", so nothing re-activates. Each window activates on its own events.vsce packageaccepts the capability.globalStorageUriis shared: the extension host getsdefaultProfile.globalStorageHome(localProcessExtensionHost.ts:540). The test showed/User/globalStoragein the Agents window.useDefaultFlagsfor them.context.globalStateis not shared. It is PROFILE scope (extensionStorage.ts:161), and the Agents profile has noglobalStatedefault flag. Its storage isprofiles/builtin/agents/globalStorage/state.vscdb, so URL history, deployment access times, surfaced banners andstartupModeare separate.secrets.ts:206-208), so they are expected to be shared. This needs a live check together with thewindowBroadcastlogin sync.gitandcopilotbranch onvscode.workspace.isAgentSessionsWorkspace, for examplegit/src/repository.ts:375,385(no progress UI) andcopilot .../sessionSyncStatus.ts:54. That API is proposed (agentSessionsWorkspace), so Marketplace extensions can't use it on Stable. Other proposed hooks:agentsWindowConfiguration(per-setting defaults in the Agents window) andchat.registerRemoteAgentHost.extensionManifestPropertiesService.ts:76-89). Our registration code for them does no harm.sshConfigParsing.ts:32), socoder-vscode.<host>--*is never listed.ssh -Gand runProxyCommandwith%hexpanded (sshProxyCommand.ts:16), so a typed Coder host should work.ssh-remote+<alias>tosshConfigHost: <alias>(remoteWorkspaceHandoffService.ts:63-70). That means an editor window connected to Coder should hand off to the same workspace without the picker.HTTP(S)_PROXYandCODER_TRACE_SESSION_IDvariables. TodayapplySshEnvironmentsets these in our extension host'sprocess.env, which the Agents window'ssshprocess does not inherit.Proposed work
Phase 1: declare support (commit
c28659d)package.json:capabilities.agentsWindow.supported: true; CHANGELOG entry.isAgentsWindow().coder.open, support bundle, notifications.Phase 2: behave well in the Agents window (commits
1f9c097refactor,ea77c68command)workbench.action.openAgentsWindowwith{ folderUri: vscode-remote://ssh-remote+<coder host>/<dir> }opens the Agents window and connects over SSH through a CoderProxyCommand. Authnonesucceeds, VS Code installs its CLI on the workspace and starts an agent host there, and the Copilot CLI, Claude and Codex agents register on the workspace.pickWorkspaceandmaybeAskAgent);WorkspaceStateMachine);updateSSHConfig), so the host resolves;workbench.action.openAgentsWindowwith the folder URI; if that command is missing, show the host alias to type in the SSH picker.Remote.setupCoderRemote, mixed with work only an editor window needs (label formatter, monitor, inbox, status bar, SSH process monitor). Split out asConnectionSetup(decision 4).HTTP(S)_PROXY,NO_PROXY) reachcoder sshonly through our process environment, which the Agents window's ssh does not inherit.Phase 4: Microsoft issue (draft below, not filed)
Decisions
src/vscode/agentsWindow.ts. VS Code marks a window as the Agents window by this exact path (windowsMainService.ts:1670), and the name is unchanged since the prototype (19209a8c, 2026-01-23).isAgentSessionsWorkspaceis unchanged and still proposed since 2026-01-26, so we don't use it.workspaceStateMachine.ts:124) runs only fromremote.setup, which runs only when the window has anssh-remoteauthority (extension.ts:468). The Agents window has none, so connecting to a stopped workspace there fails incoder ssh --disable-autostartwith no prompt. Start buttons in the Workspaces panel are hidden there too.Remote: extractConnectionSetup(src/remote/connectionSetup.ts): CLI resolution, compatibility, workspace readiness, SSH config writing. One instance is created inextension.tsand shared byRemoteandCommands. The caller passes the SSH config file and ssh path:Remotepasses Remote-SSH's, and the Agents window passesundefined(~/.ssh/config, plainssh), because the Agents window resolves hosts withssh -G -- <host>(sshRemoteAgentHostService.ts:1405). Separate commit, no behavior change; moved bodies diffed against the originals.dir(agent.expanded_directory), then recently opened folders on the workspace, through achooseFolderhelper shared withcoder.open. With neither, warn and open the Agents window without a folder.reveal: "new", otherwise VS Code ignoresfolderUrifor an open Agents window (mainImpl.jsvN). Verified live.coder.agentsWindowSupported, set at activation whenworkbench.action.openAgentsWindowexists. No fix-it button.src/remote/agentsWindowConnection.ts; picking and handoff inCommands.openInAgentsWindow; VS Code specifics (command ID,reveal) insrc/vscode/agentsWindow.ts.WorkspaceStartCancelledError(same message as before), so the command records an abort instead of an error.workspace.agents_window.open(likeworkspace.dev_container.open) with theworkspace.openattributes, abort stagestart_prompt, and phases named as inremote.setup.HTTP(S)_PROXY/NO_PROXYfrom settings don't reachcoder sshin the Agents window. Documented, not fixed (writing proxy env into the ProxyCommand would put credentialed URLs on disk).Live verification (dogfood, Insiders 1.148, real VSIX)
ehab/vscode-agents-window-research, downloads the CLI, waits for agentdev, writes~/.ssh/configinclude, opens the Agents window on/home/coder/vscode-coder; VS Code server and agent host start on the workspace.coder.openafter the refactor:Remote setup complete.Draft Microsoft issue (microsoft/vscode)
Title: Agents window: let extensions contribute SSH hosts, and activate contributed MCP collections