Repository navigation
Canvases: Fix explicit reopening of restored Agent Host canvases - #343706
Merged
Joaquín Ruales (jruales) merged 2 commits intoOct 23, 2026
Merged
Conversation
Project the successful open RPC snapshot for the requested restored canvas without unsuppressing other restored instances. Preserve runtime lifetime guards and add regression coverage for event ordering, failures, ownership and handoff. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 24ac2663-3c86-4675-b0f2-790aac5e3dcb
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Concurrent lifecycle events or user messages can cause delayed open responses to publish stale Canvas state or leave a successful reopen unpublished.
2 open issues
What changed in this PR
This PR fixes explicit reopening of restored Agent Host Canvases without automatically revealing other restored instances. It is independent of the broader Canvas-management work.
Changes:
- Projects the Canvas returned by a successful explicit open when that instance remains suppressed.
- Adds regression tests for event ordering, failed-open retries, routing, and runtime lifecycle boundaries.
- Extends bundled-SDK coverage to verify explicit reopening after cold resume.
| File | Description |
|---|---|
src/vs/platform/agentHost/test/node/copilotSdkCanvas.integrationTest.ts |
Verifies the reopened Canvas returns its current URL without another recorded-open event. |
src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts |
Adds focused reopening, suppression, and lifecycle regression tests. |
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts |
Projects successful explicit-open responses for suppressed restored instances. |
Review effort: Balanced
Keep request-time suppression intent independently of user messages and observe only the requested instance's root lifecycle events until the open RPC settles. Prefer newer opened state, do not revive closed or unavailable canvases, and preserve already-published projections. Add deferred-response, concurrent-open and recovery regressions. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 24ac2663-3c86-4675-b0f2-790aac5e3dcb
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix preserves passive restoration and lifecycle safeguards, with regression coverage for the affected ordering and concurrency paths and no unresolved findings.
No open issues 🎉
2 resolved since last review
Review effort: Balanced
Joaquín Ruales (jruales)
marked this pull request as ready for review
October 23, 2026 07:20
Joaquín Ruales (jruales)
enabled auto-merge (squash)
October 23, 2026 07:32
Contributor
Author
|
CC Ulugbek Abdullaev (@ulugbekna) |
Christof Marti (chrmarti)
approved these changes
Oct 23, 2026
Joaquín Ruales (jruales)
deleted the
jruales-restored-canvas-reopening
branch
October 23, 2026 07:47
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 a pre-existing bug on
main, discovered while testing #340458. This PR is independent of that Canvas-management work; no menu or extension-management changes are included. No separate issue has been filed.Resuming a Copilot session intentionally suppresses unprojected restored Canvas instances so old URLs are not automatically reopened. An explicit Show Canvas request did not remove that suppression, so the runtime successfully opened the Canvas but VS Code never received its state or active membership.
Capture the requested instance's suppression state before
rpc.canvas.open, then publish its successful live result unless a newer lifecycle event or existing projection supersedes it. The bundled runtime emitssession.canvas.openedbefore the RPC resolves, so a request-scoped listener preserves the latest root opened/closed/unavailable event for this instance. Newer opened data takes precedence over the response; closed/unavailable events prevent stale publication. A concurrent user message cannot erase the explicit request's original intent. The listener is disposed infinally, without introducing persistent tracking maps or changing passive restoration behavior.Failures leave suppression intact, and replaced/released/disposed runtimes cannot publish late results. Other restored instances remain hidden, and normal event-driven projection and owner/chat routing are unchanged.
The activity-bar Canvas menu lists active instances, whereas the editor + menu also lists available definitions. Publishing the explicitly reopened instance restores its active membership without changing that distinction.
Independent reviews of the original commit were completed by GPT-6.1 Sol, Claude Opus 5.5, and Gemini 4 Argon. The lifecycle and concurrent-user-message findings were addressed, including newer suppressed state and concurrent response ordering. Suggestions to broaden no-event recovery for already-projected canvases or change passive closed-instance suppression were left out because those are pre-existing behaviors outside this fix. Both GitHub Copilot review threads have been addressed and resolved.
Validation (Node 24.22.0, isolated worktree):
fnm exec --using 24.22.0 npm run build-fast -- --client-only— passed.fnm exec --using 24.22.0 ./scripts/test.sh --run src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts --grep 'explicit restored canvas reopening' --reporter dot— original fix: 4 failing regression cases before the fix; review follow-up: 5 additional race cases failed before the follow-up fix. All are covered by the passing selection below.fnm exec --using 24.22.0 ./scripts/test.sh --run src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts --run src/vs/platform/agentHost/test/node/copilotAgent.test.ts --grep '[Cc]anvas' --reporter dot— passed, 47 tests. Covers before/after/missing open events, failed-open retry, restored-instance isolation, exact chat routing, disabled canvases, disposal, handoff, concurrent user messages, closed/unavailable events and recovery, newer suppressed state, concurrent response ordering, and existing Canvas lifecycle behavior.fnm exec --using 24.22.0 ./scripts/test-integration.sh --run src/vs/platform/agentHost/test/node/copilotSdkCanvas.integrationTest.ts --reporter dot— passed, 3 tests reported. Uses the bundled SDK and a model-free isolated provider; verifies an explicit reopen after cold resume returns the current live URL without a new recorded-open event.fnm exec --using 24.22.0 npm run typecheck-client— passed.fnm exec --using 24.22.0 npm run eslint -- src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts src/vs/platform/agentHost/test/node/copilotSdkCanvas.integrationTest.ts— passed.git diff --checkand commit hygiene hooks — passed.No full test suite or hands-on Agents-window UI run was performed. The existing live OSS window and original Copilot extension files were left untouched.
Manual verification: resume a session with a previously opened Canvas; confirm it is not automatically presented, then choose that Canvas from the editor + menu. It should publish an active Canvas and become available in the activity-bar Canvas menu, while other restored instances remain suppressed.
🤖 Written by GitHub Copilot on behalf of Joaquín Ruales (@jruales).