Repository navigation
agent host: refactor: adopt experimental AHP canvas channels - #337780
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
External views are still registered normally, and unresolved lifecycle, redaction, readiness, and accessibility-bounding issues remain.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 2
Open (6)
Evicted request IDs cause secret-bearing URLs to leak · New Unlisted browser views leak into the integrated-browser registry · New Shutdown race registers sessions after disposal · New Late event subscription can miss extension load completion · New Accessibility tree materialization bypasses the node limit · New Dismissed canvas revisions leak after provider removal · New
What changed in this PR
Adds Copilot canvas support across Agent Host protocol, Copilot runtime integration, Sessions presentation, embedded BrowserView rendering, and accessibility.
Changes:
- Projects revision-fenced canvas state and source resolution through AHP.
- Adds a Sessions-owned canvas editor using ephemeral BrowserViews.
- Adds accessibility snapshots, Help, Accessible View, and focused tests.
| File | Description |
|---|---|
src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.ts |
Forwards canvas-source requests. |
src/vs/workbench/contrib/browserView/test/electron-browser/browserEditorInput.test.ts |
Updates BrowserView test stub. |
src/vs/workbench/contrib/browserView/electron-browser/webContentsViewHost.ts |
Extracts native view hosting behavior. |
src/vs/workbench/contrib/browserView/electron-browser/features/webContentsViewRendererFeature.ts |
Adopts the extracted host. |
src/vs/workbench/contrib/browserView/electron-browser/browserViewWorkbenchService.ts |
Creates external ephemeral views. |
src/vs/workbench/contrib/browserView/common/browserView.ts |
Extends BrowserView contracts. |
src/vs/workbench/contrib/browserView/browser/browserView.contribution.ts |
Adds unsupported web stub. |
src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.ts |
Registers canvas verbosity. |
src/vs/sessions/SESSIONS.md |
Documents the canvas contract. |
src/vs/sessions/sessions.desktop.main.ts |
Loads the canvas contribution. |
src/vs/sessions/services/sessions/common/session.ts |
Adds provider-neutral canvas state. |
src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts |
Tests capability projection. |
src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts |
Projects AHP canvases into Sessions. |
src/vs/sessions/contrib/providers/agentHost/AGENT_HOST_SESSIONS_PROVIDER.md |
Documents provider behavior. |
src/vs/sessions/contrib/canvases/test/common/sessionCanvas.test.ts |
Tests input identity and restoration. |
src/vs/sessions/contrib/canvases/electron-browser/sessionCanvasService.ts |
Manages canvas presentation lifecycle. |
src/vs/sessions/contrib/canvases/electron-browser/sessionCanvases.contribution.ts |
Registers services, editor, and accessibility. |
src/vs/sessions/contrib/canvases/electron-browser/sessionCanvasEditor.ts |
Implements canvas rendering and accessibility. |
src/vs/sessions/contrib/canvases/electron-browser/media/sessionCanvas.css |
Styles the canvas editor. |
src/vs/sessions/contrib/canvases/common/sessionCanvas.ts |
Defines canvas editor input and service. |
src/vs/platform/browserView/test/electron-main/browserViewAccessibility.test.ts |
Tests AX-tree formatting. |
src/vs/platform/browserView/electron-main/browserViewMainService.ts |
Exposes accessibility snapshots. |
src/vs/platform/browserView/electron-main/browserViewDebugger.ts |
Retrieves Chromium AX trees. |
src/vs/platform/browserView/electron-main/browserViewAccessibility.ts |
Formats bounded semantic output. |
src/vs/platform/browserView/common/browserView.ts |
Adds accessibility snapshot API. |
src/vs/platform/agentHost/test/node/providerIntegration/copilotMockLlm.integrationTest.ts |
Exercises real SDK canvas projection. |
src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts |
Updates AgentService mock. |
src/vs/platform/agentHost/test/node/copilotSessionLauncher.test.ts |
Tests canvas launch configuration. |
src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts |
Tests live projection and revision fencing. |
src/vs/platform/agentHost/test/node/copilotAgent.test.ts |
Tests capability and launch admission. |
src/vs/platform/agentHost/test/electron-browser/agentHostProtocolClient.test.ts |
Tests source-resolution RPC. |
src/vs/platform/agentHost/test/common/ahpJsonlLogger.test.ts |
Tests URL redaction. |
src/vs/platform/agentHost/node/protocolServerHandler.ts |
Routes source-resolution requests. |
src/vs/platform/agentHost/node/copilot/copilotSessionWrapper.ts |
Exposes SDK canvas events. |
src/vs/platform/agentHost/node/copilot/copilotSessionLauncher.ts |
Enables released canvas assets. |
src/vs/platform/agentHost/node/copilot/copilotRuntimePaths.ts |
Resolves runtime and extension assets. |
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts |
Projects and resolves live canvases. |
src/vs/platform/agentHost/node/copilot/copilotAgent.ts |
Adds launch admission and capability. |
src/vs/platform/agentHost/node/agentService.ts |
Routes canvas requests to providers. |
src/vs/platform/agentHost/electron-browser/localAgentHostService.ts |
Forwards local canvas requests. |
src/vs/platform/agentHost/common/state/sessionState.ts |
Re-exports canvas protocol types. |
src/vs/platform/agentHost/common/state/protocol/version/registry.ts |
Advances protocol version metadata. |
src/vs/platform/agentHost/common/state/protocol/common/messages.ts |
Registers the canvas command. |
src/vs/platform/agentHost/common/state/protocol/common/actions.ts |
Registers the canvas action. |
src/vs/platform/agentHost/common/state/protocol/channels-root/state.ts |
Adds canvas capability metadata. |
src/vs/platform/agentHost/common/state/protocol/channels-chat/state.ts |
Defines synchronized canvas state. |
src/vs/platform/agentHost/common/state/protocol/channels-chat/reducer.ts |
Reduces canvas state changes. |
src/vs/platform/agentHost/common/state/protocol/channels-chat/commands.ts |
Defines source-resolution RPC. |
src/vs/platform/agentHost/common/state/protocol/channels-chat/actions.ts |
Defines canvas replacement actions. |
src/vs/platform/agentHost/common/state/protocol/action-origin.generated.ts |
Updates generated action ownership. |
src/vs/platform/agentHost/common/state/protocol/.ahp-version |
Records synchronized AHP revision. |
src/vs/platform/agentHost/common/ahpJsonlLogger.ts |
Redacts canvas source URLs. |
src/vs/platform/agentHost/common/agentService.ts |
Extends service interfaces. |
src/vs/platform/agentHost/common/agent.ts |
Extends provider chat APIs. |
src/vs/platform/agentHost/browser/nullAgentHostService.ts |
Adds unsupported fallback. |
src/vs/platform/agentHost/browser/agentHostProtocolClient.ts |
Implements canvas RPC client. |
src/vs/platform/accessibility/browser/accessibleView.ts |
Adds canvas provider identity. |
build/lib/i18n.resources.json |
Registers canvas localization resources. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Screenshot ChangesBase: Changed (2)2 insignificant change(s) omitted (≤20 px, Δ≤2). See CI logs for details. |
|
Code OSS Chess canvas verification recording — extension registration, native canvas tool use, and the rendered Sessions canvas tab. chess-canvas-code-oss-verification.webm |
|
Strict no-click automatic canvas reveal verification After the prompt is submitted, the model calls chess-canvas-strict-auto-reveal.webm |
|
Native Chess canvas recording The earlier workbench recording captures only the Electron renderer and omits the OS-composited chess-canvas-native-view.webm |
7545a66 to
a59d078
Compare
Commit-by-commit reviewer guideThe history remains four signed semantic commits. Follow-up fixes and canvas-originated chat visibility are folded into the feature commits that own their behavior. ContextThe released Copilot runtime already supports extension-provided canvases and the native model tools
1.
|
|
Definitive OS-composited verification: Agents window + native Chess canvas This window-level recording captures both the Electron renderer and the native agents-window-chess-canvas-auto-reveal.mp4 |
ba1f61c to
fa17bb7
Compare
99270b1 to
6a795d7
Compare
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Benjamin Christopher Simmonds (@benibenj)Matched files:
Sandeep Somavarapu (@sandy081)Matched files:
Ladislau Szomoru (@lszomoru)Matched files:
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The synchronized chat-status wire change breaks archived-chat compatibility when protocol 0.9 is negotiated.
Review effort: Balanced
Findings: 1
Open (1)
Resolved since last review (6)
Unlisted browser views leak into the integrated-browser registry Evicted request IDs cause secret-bearing URLs to leak Dismissed canvas revisions leak after provider removal Accessibility tree materialization bypasses the node limit Late event subscription can miss extension load completion Shutdown race registers sessions after disposal
Replace the VS Code-specific canvas snapshot and source-resolution transport with the merged Agent Host Protocol canvas channel. Chat state advertises canvas resource references while live state is synchronized through experimental canvas channels. Preserve the AHP 0.9 archived catalog field alongside 0.10 status flags, and gate chat read actions to 0.10 for negotiated compatibility. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
6a795d7 to
a728eb8
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>


Summary
Migrates the local Copilot canvas support already on
mainfrom its temporary VS Code-specific transport to the experimental canvas channel merged in microsoft/agent-host-protocol#472.ahp-canvas:channelsvscode/canvases/v1notification, source-resolution request, initialize capability, and parallel snapshot modelchat.agentHost.canvases.enabledruntime/presentation gate and durable local-Copilot-only product policyThe synced AHP source is pinned to the merged PR commit
6eec1b91.Architecture
flowchart LR Runtime["Copilot runtime canvas events"] Projection["CopilotAgentSession projection"] Chat["ChatState.canvases references"] Canvas["Experimental CanvasState channel"] Client["AHP resource subscription"] Sessions["Provider-neutral ISessionCanvas"] Editor["Existing Sessions canvas editor"] Runtime --> Projection Projection -->|membership only| Chat Projection -->|metadata + optional URL| Canvas Chat --> Client Canvas --> Client Client --> Sessions Sessions --> EditorHost projection and lifecycle
A true canvas-open event creates a new lifetime-scoped
ahp-canvas:resource. Metadata or source changes retain that resource and emitcanvas/stateChanged; provider unavailability clears the source through full-state replacement. Closing the canvas removes chat membership and prunes the channel. Session/chat teardown also clears owned channels.Canvas subscriptions are live-only. They return existing host state, pin the owning session through the normal subscription residency path, and never restore a provider or replay an open/action request. The existing eight-canvas bound and restart non-restoration behavior remain unchanged.
Client and Sessions adaptation
The protocol client uses the standard subscription manager and canonical canvas reducer, preserving exact host-advertised resource URIs rather than reconstructing remote identities.
The Agent Host Sessions provider follows each advertised canvas reference with a cached resource-scoped subscription and projects immutable provider-neutral state. Unknown membership is distinct from an authoritative empty collection, and pending/error channel state retains membership without a live source.
Presentation support remains a local provider decision: durable local Copilot sessions expose
supportsCanvases; remote, Claude, and Codex sessions do not. The existing setting and AI entitlement still control actual runtime enablement and editor presentation.Privacy and stale-load protection
Canvas URLs are redacted from AHP action, snapshot, initialize/reconnect, and replay diagnostics without mutating live state. Sources remain HTTP(S)-only. The editor keeps local input, source, owner, and load-sequence checks and disposes superseded BrowserViews. Metadata/source changes do not reopen a user-dismissed canvas.
Removed temporary surfaces
AgentCanvasAvailability,IAgentCanvas, andIAgentCanvasSnapshotIAgentHostCanvasesandIAgentService.onDidChangeCanvasesvscode/canvases/v1/changedandvscode/canvases/v1/resolveSourceA separate AHP agent capability is intentionally absent: clients cannot initiate canvas operations in this scope, and server-published chat references are sufficient discovery. A capability can be introduced later alongside client-originated open/action operations if needed.
Validation
npm run typecheck-client— passednpm run transpile-client— passednpm run valid-layers-check— passedgit diff --check— passedExplicitly deferred