Skip to content

[release/1.148] Reconnect pinned canvases of a canvas-first session after a reload (cherry-pick #349986) - #350071

Merged
Ulugbek Abdullaev (ulugbekna) merged 1 commit into
release/1.148from
ulugbekna/cherry-pick-349986-1.148
Nov 24, 2026
Merged

Ulugbek Abdullaev (ulugbekna) merged 1 commit into
release/1.148from
ulugbekna/cherry-pick-349986-1.148

Conversation

@ulugbekna

Copy link
Copy Markdown
Contributor

Backports #349986 to release/1.148. Refs #349746, a follow-up to #349654, which is already in release/1.148.

A pinned canvas of a session started from the Canvases section, with no message sent, stayed Not connected after Developer: Reload Window or after turning chat.canvases.enabled off and on. Selecting the pin now brings it back Live without opening its chat:

  • A reconnecting pin contributes the window to its session and keeps observing its chat until the canvas has a source.
  • The Agent Host lets a workspace-less draft restore and close its canvases, and the launch that starts a draft takes over the canvases its released runtime had open.
  • Reopening a canvas retries until the just-launched runtime registers it, and a canvas closed while its runtime was released is no longer reopened.

Cherry-picked merged commit 25e7ea7b8ff47efaf5dd69ee2645f1ed1962ed2c with git cherry-pick -x; it applied cleanly.

Validation

On this branch:

  • pnpm run typecheck-client: passed.
  • ./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 after pnpm run transpile-client: passed, 5086 tests.

Not run on this branch: the Agents window scenarios, which #349986 verified on main. The local install could not fetch the Copilot SDK version this branch pins, so the full build was not run.

…349986)

* fix(sessions): reconnect pinned canvases of a canvas-first session after 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 <[email protected]>

* fix(agentHost): retry a restored canvas open on each registry change 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 <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
(cherry picked from commit 25e7ea7)
Copilot AI balanced review requested due to automatic review settings November 24, 2026 06:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Selecting a disconnected pin from another view can release the chat observation and cancel reconnection before its page opens, leaving it Not connected; the selection transaction needs correction and a regression test.

1 open issue
What changed in this PR

Backports #349986 to release/1.148 so pinned canvases from canvas-first sessions can reconnect after a reload or a canvases setting toggle, without opening their chat.

Changes:

  • Keeps reconnecting pins observing their chat and contributing the client until the canvas has a live source.
  • Restores canvases for workspace-less drafts, retries delayed registration, and preserves deferred closes.
  • Adds regression coverage and documents the reconnection lifecycle.
File Description
src/​vs/​workbench/​contrib/​sessions/​providers/​agentHost/​browser/​baseAgentHostSessionsProvider.ts Publishes client contributions while observing a pin’s chat.
src/​vs/​workbench/​contrib/​sessions/​common/​sessionsProvider.ts Documents the expanded chat-observation contract.
src/​vs/​sessions/​SESSIONS.md Describes pin reconnection and draft canvas restoration.
src/​vs/​sessions/​contrib/​providers/​agentHost/​test/​browser/​localAgentHostSessionsProvider.test.ts Tests contribution publication when observing inactive chats.
src/​vs/​sessions/​contrib/​canvases/​test/​browser/​pinnedCanvasService.test.ts Tests observation retention until a canvas gains a source.
src/​vs/​sessions/​contrib/​canvases/​browser/​pinnedCanvasService.ts Retains restoration observations and retries failed canvas subscriptions.
src/​vs/​platform/​agentHost/​test/​node/​copilotAgent.test.ts Covers draft restoration, first-send handoff, and deferred closes.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgentSession.ts Retries canvas registration and keeps deferred closes effective.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgent.ts Enables draft restore/close operations and transfers released canvases to replacement runtimes.

Review effort: Balanced

@ulugbekna
Ulugbek Abdullaev (ulugbekna) merged commit 661626d into release/1.148 Nov 24, 2026
52 checks passed
@ulugbekna
Ulugbek Abdullaev (ulugbekna) deleted the ulugbekna/cherry-pick-349986-1.148 branch November 24, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants