Repository navigation
Description
When the agent host process restarts, for example after quitting and relaunching VS Code, canvases that were open in Agents-window Copilot chats don't come back. A resumed chat projects no canvases, so its canvas tabs and canvas list stay empty. A canvas pinned to the sidebar (in progress) stays "Unavailable", and selecting it can't bring the canvas back.
Restarts inside a running host already keep canvases: a configuration refresh and a telemetry-revocation restart hand them over to the replacement session, and an extension reload rehydrates them.
Seen in Code OSS from main at a0fba2a (plus the in-progress pinned canvas changes), macOS 27.2 arm64.
Steps to Reproduce:
- Enable
chat.canvases.enabled. In the Agents window, have a local Copilot chat open a canvas, for example withopen_canvas. - Quit and relaunch VS Code.
- Open the chat again.
Actual: The canvas is gone from the chat. The Copilot runtime restored the instance, but the host hides it.
Expected: A canvas the user deliberately kept, such as a pinned one, can be brought back from the UI without asking the agent to reopen it under the same instance ID.
Why
- It's the documented contract: "Any other new SDK residency starts with an empty projected canvas collection and does not restore prior open canvases" (AGENT_HOST_SESSIONS_PROVIDER.md). Per Agents window: explicitly reopening a restored Canvas does not show it #343711, merely resuming a session should not reopen old canvases, to avoid automatically displaying old URLs.
- On resume, the host adds every runtime-restored instance it doesn't project to
_ignoredRestoredCanvasInstanceIds(copilotAgentSession.ts) and drops their rehydrationsession.canvas.openedevents (copilotAgentSession.ts). - The suppression lifts only on an explicit open of the same
instanceId(openCanvas, Agents window: explicitly reopening a restored Canvas does not show it #343711) or on the next user message (copilotAgentSession.ts). The user message replays nothing, so the canvas stays hidden until the runtime emits anotheropenedevent for it. - In-host restarts survive because
takeCanvasProjectionhands the projection to the replacement (configuration refresh, telemetry revocation)._canvasHandoffslives in host memory (copilotAgent.ts), so a process restart loses it. Agent Host: open canvases close when a send triggers a session configuration refresh #340508 deliberately left cold residencies (eviction, host restart) starting empty. - Canvas subscriptions, which pins hold, never resume a provider or replay an open (same spec paragraph), so a pin can't bring its canvas back by itself.
- Today's workaround is partial. The editor + → Canvas menu opens with a fixed instance ID,
${extensionId}-${canvasId}(canvas.ts, editorCanvasActions.ts), so it can restore canvases first opened from that menu. A canvas the agent opened under its own ID comes back only if the agent reopens it with that ID.
Proposal
- Pinned canvases (recommended; client only). When the user selects an unavailable pin, call the existing optional
ISessionsProvider.openCanvas(sessionsProvider.ts) with the pin's storedcanvasId,extensionIdandinstanceId. The host'sopenSessionCanvasresumes a cold chat (copilotAgent.ts), andopenCanvaslifts the suppression for that ID, so no host or protocol change is needed. It also stays within Agents window: explicitly reopening a restored Canvas does not show it #343711's explicit-reopen rule. The pin then rebinds byinstanceId. To decide or validate:- Reopen only on selection (resumes one chat) or eagerly after startup (resumes up to five chats, one SDK residency each).
- If the runtime no longer has the instance, the same request opens a fresh one under that ID. Is that acceptable for a pin?
- On a cold resume, check that the reopen isn't dropped while canvas projection is still starting.
- Broader (needs product input). Either list restored-but-hidden instances in the chat's canvas menu as "Reopen …" entries, which needs the host to publish them, or project restored instances on resume, which reverses Agents window: explicitly reopening a restored Canvas does not show it #343711 and the documented contract.
Not verified: whether recovering from a Copilot runtime crash (closed connection) keeps canvases.
Related
- Agents window: explicitly reopening a restored Canvas does not show it #343711: an explicit reopen of a restored canvas didn't show it.
- Agent Host: open canvases close when a send triggers a session configuration refresh #340508: canvases closed on a configuration refresh; fixed with the handoff above.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity