Repository navigation
sessions: Reveal tunnel sessions across Editor and Agents windows - #346290
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved handoff bugs can discard workspace folders, route sessions to the wrong agent host without warning, and leave the wrong chat visible.
3 open issues
What changed in this PR
Extends the existing remote-folder handoff to reveal tunnel-hosted sessions when switching between Editor and Agents windows.
Changes:
- Adds session-type translation and remote-host resolution for cross-window session reveals.
- Updates desktop and web Open in Editor actions, with notifications for unsupported remote sessions.
- Adds handoff tests and documents the tunnel-specific behavior.
| File | Description |
|---|---|
src/vs/workbench/contrib/chat/test/electron-browser/agentSessionsDraftHandoff.test.ts |
Adds the environment-service test stub. |
src/vs/workbench/contrib/chat/test/electron-browser/agentSessionsActions.test.ts |
Tests remote-machine context in session handoffs. |
src/vs/workbench/contrib/chat/electron-browser/agentSessions/agentSessionsActions.ts |
Sends remote workspace context with session reveals. |
src/vs/sessions/test/electron-browser/vscodeActions.test.ts |
Tests tunnel translation and unsupported-remote notifications. |
src/vs/sessions/test/browser/vscodeActions.test.ts |
Updates web action test dependencies. |
src/vs/sessions/electron-browser/actions/vscodeActions.ts |
Maps sessions before opening desktop Editor windows. |
src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/remoteWorkspaceHandoffService.test.ts |
Tests host resolution and connection outcomes. |
src/vs/sessions/contrib/providers/remoteAgentHost/REMOTE_AGENT_HOST_SESSIONS_PROVIDER.md |
Documents cross-window session handoffs and limitations. |
src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteWorkspaceHandoffService.ts |
Extracts host resolution and reports connection completion. |
src/vs/sessions/contrib/chat/test/electron-browser/agentsWindowWorkspaceHandoff.test.ts |
Tests remote session routing and failure notifications. |
src/vs/sessions/contrib/chat/electron-browser/chat.contribution.ts |
Resolves tunnel hosts and reveals mapped sessions. |
src/vs/sessions/common/remoteWorkspaceHandoff.ts |
Defines the host-resolution contract. |
src/vs/sessions/browser/openInVSCodeUtils.ts |
Adds shared session mapping and notification helpers. |
src/vs/sessions/browser/actions/vscodeActions.ts |
Applies session mapping to web Open in Editor links. |
src/vs/platform/agentHost/common/agentHostSessionType.ts |
Adds local/remote session-type conversion helpers. |
Review effort: Balanced
Christof Marti (chrmarti)
force-pushed
the
chrmarti/remote-session-reveal
branch
from
November 6, 2026 15:32
d7c8e87 to
844a9bd
Compare
3 tasks done
A tunnel's editor windows and the Agents Window share code tunnel's agent host, but name its sessions differently: agent-host-<provider> in the editor window and remote-<authority>-<provider> in the Agents Window. Map the session scheme in both directions so the open session is revealed when switching windows, as it already is for local sessions. The editor window passes its folder so the Agents Window can resolve and connect the host first. SSH, WSL and Dev Container editor windows use an agent host started by their VS Code server, with a session registry separate from the one the Agents Window starts, so their sessions can't move between windows. Both directions now explain this instead of failing silently. Co-authored-by: Copilot <[email protected]>
The action was only contributed to the title-bar Chat menu, which evaluates its when clause against the window context. The session type it checks is set only in the Chat view's scoped context, so the action never appeared. Move it to the Chat view's title menu, next to the Move Chat actions, and report it as a separate open source. Co-authored-by: Copilot <[email protected]>
- Treat a tunnel whose gateway selected an editor's agent host as a different host, in both directions - Fall back to opening the remote window's folder when its session can't be revealed - Compare the focused host's shown chat in the fast path Co-authored-by: Copilot <[email protected]>
…eir folder Co-authored-by: Copilot <[email protected]>
Christof Marti (chrmarti)
force-pushed
the
chrmarti/remote-session-reveal
branch
from
November 8, 2026 20:12
cfe53d2 to
f47d830
Compare
Christof Marti (chrmarti)
marked this pull request as ready for review
November 8, 2026 20:36
Christof Marti (chrmarti)
enabled auto-merge (squash)
November 8, 2026 20:37
Alexandru Dima (alexdima)
approved these changes
Nov 8, 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.

Follow-up to #345832 (microsoft/vscode-internalbacklog#10484).
What changed
When you switch between an editor window and the Agents Window, the open session is revealed in the other window for local Copilot sessions. Remote sessions weren't revealed. A remote editor window treats the agent host on its remote machine as its own and names those sessions
agent-host-<provider>:, while the Agents Window names the same sessionsremote-<authority>-<provider>:after its connection to that host. Neither window could find the other's session.revealRemoteAuthorityoption) and its workspace folder, so the Agents Window can identify the machine. The Agents Window resolves the host with the newIRemoteWorkspaceHandoffService.resolveHost, which reuses the folder handoff's matching, registration, sign-in and connection steps. It then maps the scheme withtoRemoteAgentHostSessionTypeand opens the session once it appears, unless that chat is already shown.getEditorWindowSessionResourcemaps a remote session back to the editor window's local scheme withtoLocalAgentHostSessionType. Both the desktop and web Open in Editor actions use it.whenclauses against the window context, but thechatSessionTypekey the action checks exists only in the Chat view's scoped context, so the action never appeared. It now appears in the Chat view's title "..." menu after the Move Chat actions, and is reported with thechatViewTitleopen source.code tunnelbridges its VS Code servers to one agent host, so only tunnels share sessions between the two window types. SSH, WSL and Dev Container editor windows use an agent host started by their VS Code server, with a session registry separate from the agent host the Agents Window starts. The window's folder opens instead of the session. Moving a session from the Agents Window to such an editor window also shows a notification instead of failing silently. In the other direction, the Agents Window selects the editor window's remote and folder without a notification, as the folder handoff does.ITunnelAgentHostService.getSelectedServerType). When it is'editor', both directions treat the handoff as unsupported, with a notification and the same folder fallback.Reviewer notes
OpenChatSessionInAgentsWindowActionis still offered only for Copilot CLI sessions. The chat editor still doesn't show it, because its title menu can't see the widget's scoped context. The title-bar "Open in Agents" still opens only the workspace.How to test
Validation
pnpm run typecheck-client: passed.pnpm run valid-layers-check: passed.pnpm run eslint <14 changed TypeScript files>: passed.pnpm run build-fast --client-only, then.\scripts\test.bat --reporter dot --run <7 affected test files>: 198 passing..\scripts\test.bat --reporter dot --runfor theresolveRemoteAuthority,chatWindowEditorAreaandagentHostConnectionsServicetests: 65 passing..\scripts\test.bat --runfor theagentSessionsActionsandagentSessionsDraftHandofftests: 99 passing;pnpm run eslinton the changed files: passed.pnpm run typecheck-client: passed.pnpm run valid-layers-check: passed.pnpm run eslint <25 changed TypeScript files>: passed.pnpm run build-fast --client-only, then.\scripts\test.bat --reporter dot --runfor theagentsWindow,agentSessionsActions,agentsWindowWorkspaceHandoff, bothvscodeActions,remoteWorkspaceHandoffService,tunnelAgentHost.contribution,browserTunnelAgentHostServiceandtunnelAgentHostServiceImpltests: 166 passing.pnpm run build-fast --client-only, then.\scripts\test.bat --runfor theagentsWindowWorkspaceHandofftests: 16 passing;pnpm run eslinton the changed files: passed.mainat21fe348d869:pnpm run typecheck-client: passed;pnpm run eslint <28 changed TypeScript files>: passed;pnpm run build-fast --client-only, then.\scripts\test.bat --reporter dot --run <9 changed test files>: 201 passing.commitandqualityinproduct.overrides.jsonso the tunnel serves a matching server. Editor → Agents Window and SSH/WSL remotes not yet verified end to end.