Repository navigation
Reconnect pinned canvases of a canvas-first session after a reload - #349986
Open
Ulugbek Abdullaev (ulugbekna) wants to merge 2 commits into
Open
Ulugbek Abdullaev (ulugbekna) wants to merge 2 commits into
Ulugbek Abdullaev (ulugbekna) wants to merge 2 commits into
Conversation
…ter a reload A session started from the Canvases section has no turn, so its Copilot runtime persists no history and the chat stays a draft on the host, also after a restart. Once its runtime was released (a window reload, or turning canvases off and on), its pinned canvas stayed "Not connected": - The host restores released canvases only for a contributing client, and only the focused session gets one; showing a pin never contributed. - Restoring the canvases of a draft was rejected, and a draft's next launch did not take over its released canvases. A reconnecting pin now contributes this client to its session and keeps observing its chat until the canvas has a source, observing the canvas again when an earlier observation failed while the session was released. The host lets a workspace-less draft restore and close its canvases, and the launch that materializes a draft takes over the canvases its released runtime had open. Reopening a handed-over canvas waits for a just-launched runtime to register it, and a canvas closed while released is no longer reopened. Found while verifying #349746, a follow-up to #349654. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
An unrelated registry change can exhaust the only retry and leave the canvas pin disconnected, and regression coverage does not exercise restoring a canvas-first draft without sending a message.
2 open issues
What changed in this PR
This follow-up restores pinned canvases after reload or runtime release, including canvas-first sessions that have not sent a message.
Changes:
- Reconnecting pins contribute the client to their session and retain chat observation until a canvas source is available.
- Workspace-less drafts reclaim released canvases, preserve closes, and retry reopening while extensions initialize.
- Adds regression coverage and documents the reconnect lifecycle.
| File | Description |
|---|---|
src/vs/workbench/contrib/sessions/providers/agentHost/browser/baseAgentHostSessionsProvider.ts |
Publishes client contributions when observing a reconnecting pin’s chat. |
src/vs/workbench/contrib/sessions/common/sessionsProvider.ts |
Documents the observation hook’s contribution behavior. |
src/vs/sessions/SESSIONS.md |
Explains pin reconnection and canvas-first draft restoration. |
src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts |
Tests repeated client contributions during observation. |
src/vs/sessions/contrib/canvases/test/browser/pinnedCanvasService.test.ts |
Tests retaining chat observation until a source appears. |
src/vs/sessions/contrib/canvases/browser/pinnedCanvasService.ts |
Retains reconnect observation and retries failed canvas observations. |
src/vs/platform/agentHost/test/node/copilotAgent.test.ts |
Tests draft canvas continuity and deferred closes across runtime release. |
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts |
Adds registration-aware reopen retries and preserves settled closes. |
src/vs/platform/agentHost/node/copilot/copilotAgent.ts |
Enables draft restore/close operations and transfers released canvas continuity. |
Review effort: Balanced
…until one deadline Another extension's registry change could consume the only retry while the restored canvas was still unregistered. Each attempt now waits on a fresh listener, and unavailable opens retry until a shared deadline. Also cover restoring a released canvas-first draft without a send: a window that observes and contributes to the chat brings its canvas back with a source while no runtime receives a send. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Christof Marti (chrmarti)
approved these changes
Nov 23, 2026
SteVen Batten (sbatten)
approved these changes
Nov 23, 2026
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.

Follow-up to #349654, found while verifying the test plan item #349746.
Problem
A session started from the Canvases section has no turn. Its Copilot runtime persists no history before a turn, so the chat stays a draft on the Agent Host, also after a restart. Once that runtime is released (Developer: Reload Window, or turning
chat.canvases.enabledoff and on), its pinned canvas stayed Not connected, and selecting it showed "The canvas provider is temporarily unavailable." or "This canvas is no longer available.". Two gates stopped it from coming back:Canvas operation requires an initialized Copilot chat.), and the launch that started a draft did not take over its released canvases.Change
Workbench:
BaseAgentHostSessionsProvider.observeChatCanvases, used only by a reconnecting pin, now also contributes this client to the session while held, as showing the session would. A new contribution always publishes, since the host drops contributions to a session it releases without telling the client.PinnedCanvasService: a shown pin keeps observing its chat until its canvas has a source, so the chat can restore it. It also observes its canvas again when an earlier observation failed while the session was released.Agent Host (Copilot):
_materializeProvisionalclaims the chat's released canvas continuity, so the launch takes over its canvases, as a resume does. An early launch made without them is discarded (canvasContinuity).CopilotAgentSessionwaits, bounded, for a just-launched runtime to register a canvas before reopening it, instead of failing withCanvas "…" is not registered.. It also no longer reopens a canvas that was closed while its runtime was released.SESSIONS.mddescribes the new reconnect and restore behaviour.Takeoff canvas after
chat.canvases.enabledoff and on, then selecting its pin:How to test
With
"sessions.list.canvasesSection": truein the Agents window:chat.canvases.enabledtofalse, wait about 15 seconds, set it back totrue, then select the pin: it becomes Live again.Validation
./scripts/test.sh --run src/vs/platform/agentHost/test/node/copilotAgent.test.ts --run src/vs/platform/agentHost/test/node/agentService.test.ts --run src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts --run src/vs/sessions/contrib/canvases/test/browser/pinnedCanvasService.test.ts --run src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts --run src/vs/sessions/services/sessions/test/browser/sessionNavigation.test.ts --run src/vs/sessions/contrib/canvases/test/browser/canvasActivityBar.test.ts: passed, 5099 tests. Each new or changed test fails without its fix.pnpm run typecheck-client: passed.pnpm run oxlinton the changed TypeScript files: passed.