Repository navigation
sessions: bring back pinned canvases after a restart - #348343
Merged
Ulugbek Abdullaev (ulugbekna) merged 3 commits intoNov 15, 2026
Merged
Conversation
After a restart, a chat can lose a canvas it had open: a lazily activated canvas provider stays dormant until something asks for its canvas, and a session that ran without canvases has none. A pin whose chat no longer listed its canvas showed "This canvas is no longer open in its chat", and selecting it only looked for the canvas again, so it never came back. When a shown pin's chat lacks its canvas, the pin now asks the chat to open that instance again through ISessionsManagementService.openCanvas and binds once the chat publishes it. - Each request is scoped to the session object it was made through. A request made through a session that goes away or is replaced is abandoned, its late answer is ignored, and the pin asks again through the returning session. - After the chat reports the canvas opened, the pin waits a bounded time for the chat to publish that instance, ignoring unrelated membership changes. The chat can answer without publishing it, for example when a close superseded the open. - If the open fails or the canvas is not published in time, the pin shows as unavailable, the user is told why when the open failed, and showing the pin again retries. - When the user declines the consent that the canvas's extension asks for, the pin shows as unavailable, and the warning's Try Again asks again and shows the pin. openCanvas now takes only the canvas type identity (canvasId and extensionId), which is all providers use, so a pin can reopen its canvas without the chat's registered canvas types, which may not be listed yet after a resume. Co-authored-by: Copilot App <[email protected]>
A Copilot session decides whether it runs canvases when it launches. A session that launched before the client's configuration enabled canvases, for example while an experiment-controlled setting had not resolved yet at startup, kept running without canvases until something unrelated relaunched it. Opening its canvases failed with "Canvases are disabled for this session.", so a pinned canvas could not be reopened. The runtime refresh now compares a session's launch-time canvas enablement with the current configuration: - A mismatch is a new refresh reason, canvasesEnabledChanged, so the session relaunches before its next turn. This also applies when canvases are turned off. - Opening a canvas relaunches an idle session first. A session with an active turn is not interrupted; the open reports canvases disabled and the next turn relaunches it. - Listing canvases never relaunches a session. A refresh for opening a canvas, like one for starting an MCP server, is outside a turn: it never sends the chat's draft or takes a turn's cancellation token. The setting description now says that running sessions pick up changes. Co-authored-by: Copilot App <[email protected]>
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Joaquín Ruales (@jruales)Matched files:
Sandeep Somavarapu (@sandy081)Matched files:
Ladislau Szomoru (@lszomoru)Matched files:
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The refresh path checks only hasActiveTurn before destroying the runtime, so changing canvas enablement and opening a canvas can stop running background subagents unless hasActiveSubagents is also checked.
1 open issue
What changed in this PR
Restores pinned canvases in the Agents window after restart by reopening missing instances through their owning chats and refreshing runtimes with outdated canvas enablement.
Changes:
- Adds pin reopening, bounded publication waits, session-replacement handling, and consent retries.
- Refreshes stale canvas runtimes before turns or idle canvas opens.
- Narrows canvas-opening APIs to identity fields and updates tests, documentation, and recovery messaging.
| File | Description |
|---|---|
src/vs/workbench/contrib/sessions/providers/agentHost/browser/baseAgentHostSessionsProvider.ts |
Accepts canvas identity fields for opening. |
src/vs/workbench/contrib/sessions/providers/agentHost/AGENT_HOST_SESSIONS_PROVIDER.md |
Documents canvas enablement refreshes. |
src/vs/workbench/contrib/sessions/common/sessionsProvider.ts |
Narrows the provider’s canvas-open contract. |
src/vs/workbench/contrib/sessions/common/sessionsManagement.ts |
Narrows the management canvas-open contract. |
src/vs/workbench/contrib/sessions/browser/sessionsManagementService.ts |
Aligns canvas-open delegation with the contract. |
src/vs/workbench/contrib/sessions/browser/pinnedCanvases.ts |
Documents pin reopening behavior. |
src/vs/sessions/SESSIONS.md |
Documents pin recovery and request lifetimes. |
src/vs/sessions/contrib/canvases/test/electron-browser/sessionCanvasService.test.ts |
Updates canvas-open test types. |
src/vs/sessions/contrib/canvases/test/electron-browser/sessionCanvasRegistryService.test.ts |
Updates registry test types. |
src/vs/sessions/contrib/canvases/test/browser/pinnedCanvasService.test.ts |
Covers recovery, timeouts, replacements, and retries. |
src/vs/sessions/contrib/canvases/electron-browser/pinnedCanvasPage.ts |
Updates unavailable-canvas recovery guidance. |
src/vs/sessions/contrib/canvases/browser/pinnedCanvasService.ts |
Implements reopening and consent retry handling. |
src/vs/platform/agentHost/test/node/copilotAgent.test.ts |
Tests enablement changes and runtime relaunches. |
src/vs/platform/agentHost/node/copilot/copilotSessionLauncher.ts |
Shares the canvas runtime enablement predicate. |
src/vs/platform/agentHost/node/copilot/copilotRuntimeRestartTelemetry.ts |
Adds the canvas enablement refresh reason. |
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts |
Exposes launch-time canvas enablement. |
src/vs/platform/agentHost/node/copilot/copilotAgent.ts |
Refreshes stale runtimes and handles idle operations. |
src/vs/platform/agentHost/common/agentHostStarter.config.contribution.ts |
Clarifies when running sessions apply setting changes. |
Review effort: Balanced
Dmitriy Vasyura (dmitrivMS)
previously approved these changes
Nov 15, 2026
…nvas Opening a canvas relaunched an idle runtime whose canvas enablement was stale, but the refresh only treated an active turn as busy. Background subagents can outlive their turn and would stop with the runtime, so such a runtime now keeps running: the open reports canvases disabled, and the session relaunches at its next turn, as it does during a turn. Co-authored-by: Copilot App <[email protected]>
Dmitriy Vasyura (dmitrivMS)
approved these changes
Nov 15, 2026
Ulugbek Abdullaev (ulugbekna)
deleted the
ulugbekna-fix-pinned-canvas-reopen
branch
November 15, 2026 11:35
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.

Fixes pinned canvases in the Agents window that show "This canvas is no longer open in its chat" and never come back when selected, typically after an app restart.
Root cause
A pin persists only its canvas's identity, and reconnects by finding the same instance ID in its chat's canvas list. Two things can keep the chat from listing it again:
chat.canvases.enabledhad not resolved yet at startup), it ran without canvases until something unrelated relaunched it. Opening its canvases failed with "Canvases are disabled for this session."In both cases
PinnedCanvasServicemarked the pin unavailable, and selecting it only looked for the canvas again. Nothing asked the chat to open it.Fix
Commit 1 (
sessions): a shown pin reopens its canvas. When a pin is shown and its chat's canvas list lacks its canvas, the pin asks the chat to open that instance again throughISessionsManagementService.openCanvas, then binds once the chat publishes it.openCanvasnow takes onlyPick<ISessionCanvasDefinition, 'canvasId' | 'extensionId'>, which is all providers use, so a pin can reopen without the chat's canvas definitions, which may not be listed yet after a resume.Commit 2 (
agentHost): a session with stale canvas enablement relaunches. The runtime refresh compares a session's launch-time canvas enablement with the current configuration.canvasesEnabledChanged, so the session relaunches before its next turn. This also applies when canvases are turned off.isIdleRefreshOperationtreats theopenCanvasrefresh likestartMcpServer's: it never sends the chat's draft or takes a turn's cancellation token.Recordings
Recorded in Code OSS with a project-scoped demo canvas whose page shows when its provider process started.
Session resumed with canvases off, then canvases turned on, then the pin is selected. Before (commit 1 only): the reopen fails with "Canvases are disabled…".
race-before-host-fix.mp4
After (both commits): the session relaunches and the canvas is back.
race-after-fix.mp4
Lazily activated canvas after a full quit and relaunch. Before (
main): the pin goes straight to unavailable.before-fix.mp4
After: the pin reopens the canvas, and the provider starts at the moment of the click.
after-fix.mp4
Validation
pnpm run typecheck-client: passed.pnpm run valid-layers-check: passed.pnpm run oxlinton the changed files, andpnpm run precommit(hygiene) on each commit: passed../scripts/test.sh --run src/vs/sessions/contrib/canvases/test/browser/pinnedCanvasService.test.ts --run src/vs/sessions/contrib/canvases/test/electron-browser/sessionCanvasRegistryService.test.ts --run src/vs/sessions/contrib/canvases/test/electron-browser/sessionCanvasService.test.ts --run src/vs/sessions/contrib/sessions/test/browser/sessionsList.test.ts: 656 passing../scripts/test.sh --run src/vs/platform/agentHost/test/node/copilotAgent.test.ts --run src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts --run src/vs/platform/agentHost/test/node/agentService.test.ts --run src/vs/platform/agentHost/test/node/copilotSessionLauncher.test.ts: 4484 passing, 17 pending.pinnedCanvasService.test.tscovers:copilotAgent.test.tscovers the relaunch sequence:main, which brought in the extension-consent changes from agentHost: ask before a Copilot extension reads sensitive environment variables #348216, I re-ran the first scenario on this branch: the pin went from unavailable to live in about 2 seconds, and the host logged a refresh withoperation=openCanvas.Not covered: canvases that require input. A reopen sends no input, which works when the runtime still has the instance, but this hasn't been tried after a restart.