Repository navigation
Canvases: restore canvases after an Agent Host restart - #345872
Closed
Ulugbek Abdullaev (ulugbekna) wants to merge 3 commits into
Closed
Ulugbek Abdullaev (ulugbekna) wants to merge 3 commits into
Ulugbek Abdullaev (ulugbekna) wants to merge 3 commits into
Conversation
Retain source-less canvas continuity across idle session residency release and restore it when the chat is observed again, without requiring a model turn. Co-authored-by: Copilot App <[email protected]>
Apply review feedback for close intent during restore, source-less membership publication, continuity retention after navigation, pending-close-only handoffs, and delayed close events. Co-authored-by: Copilot App <[email protected]>
Joaquín Ruales (jruales)
force-pushed
the
jruales-canvas-idle-restoration
branch
from
November 3, 2026 18:08
740e41a to
bb08f54
Compare
Builds on the idle-release canvas continuity in #345740 so a chat's canvases also come back after the Agent Host process restarts (for example, after an update), without a model turn. - A live Copilot runtime reports its source-less canvas continuity (projections plus closes it still owes the runtime) whenever it publishes canvas state or membership; teardown and handoffs never report. - The agent persists it as `copilot.canvasContinuity` in the chat's storage, keyed to the chat and its SDK backing, sequenced per chat and bound to the continuity generation so archive and delete cannot be overwritten. - Observing or resuming a cold chat loads a matching record into the existing released continuity, so the canvases are republished on their original channels and reconciled with the runtime. Observing an archived chat discards it instead. Shutdown keeps the record. - A reopened instance no longer carries its earlier applied close into the next handoff, which dropped the canvas on the next restore. Co-authored-by: Copilot <[email protected]>
Ulugbek Abdullaev (ulugbekna)
force-pushed
the
ulugbekna/agents/canvas-restart-continuity
branch
from
November 3, 2026 18:15
031cdb1 to
475a45b
Compare
Joaquín Ruales (jruales)
force-pushed
the
jruales-canvas-idle-restoration
branch
from
November 4, 2026 06:54
bb08f54 to
b7071d6
Compare
Ulugbek Abdullaev (ulugbekna)
force-pushed
the
jruales-canvas-idle-restoration
branch
from
November 4, 2026 11:57
1150712 to
e730e14
Compare
Joaquín Ruales (jruales)
force-pushed
the
jruales-canvas-idle-restoration
branch
from
November 5, 2026 06:36
e730e14 to
10d912e
Compare
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 #344999
Stacked on #345740: this PR's base is that PR's branch (
jruales-canvas-idle-restoration), so the diff shows only this change. It builds on the idle-release continuity there, not on the alternative in #345767.Summary
#345740 keeps a chat's canvases, without their URLs, in memory when an idle Copilot runtime is released, and restores them when the chat is opened again. A process restart, such as an Insiders update, still loses them. This change stores that record in the chat's storage, so the chat's canvases come back after the Agent Host restarts, without a model turn.
Changes
CopilotAgentSessionreports which canvases it shows (no URLs), plus closes it still owes the runtime, through a newonDidChangeCanvasContinuityoption. It reports whenever it publishes canvas state or membership while its runtime is live; handoffs and teardown never report.CopilotAgentsaves it ascopilot.canvasContinuitymetadata in the chat's own storage. The record is tied to the chat and its SDK session, not to its owner, since chats can move between sessions.watchChatCanvases) or resuming it (default and peer chats) loads a matching record before the resume claims Canvases: restore canvases after idle session release #345740's continuity. The canvases are then republished on their original channels and reconciled with what the runtime still has open.IAgentChatCanvasWatchHost.isArchived. This covers archiving while the session isn't loaded, which never reaches the provider.AGENT_HOST_SESSIONS_PROVIDER.md.Known limitations
How to test
chat.canvases.enabled. In the Agents window, open a canvas in a local Copilot chat.Validation
fnm exec --using=24.22.1 pnpm run build-fast --client-onlyfnm exec --using=24.22.1 ./scripts/test.sh --reporter dot --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/agentSessionResidency.test.ts --run src/vs/platform/agentHost/test/node/chatContributions.test.ts --run src/vs/platform/agentHost/test/node/agentService.test.tsbb08f54ac40): 4044 passing, 17 pending. On the previous base, 4 consecutive runs passed. One earlier run reported 1 failure that was not captured and did not reproduce.fnm exec --using=24.22.1 ./scripts/test.sh --run src/vs/platform/agentHost/test/node/copilotAgent.test.ts --run src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts --grep "persisted by an earlier host process|archiving a chat removes its persisted|discards instead of restoring|reports source-less continuity|applied close into the next handoff"fnm exec --using=24.22.1 node_modules/.bin/tsc --project ./src/tsconfig.json --noEmit --skipLibCheck(same aspnpm run typecheck-client)fnm exec --using=24.22.1 pnpm run eslint <6 changed TypeScript files>git diff --check HEAD~1 HEADNot run:
pnpm run valid-layers-check, the integration and smoke suites, and the manual steps above in a Code OSS build.