Skip to content

Canvases: UI for opening Canvases from Editor Window - #341597

Merged
Joaquín Ruales (jruales) merged 6 commits into
mainfrom
jruales-jubilant-bassoon
Oct 15, 2026
Merged

Joaquín Ruales (jruales) merged 6 commits into
mainfrom
jruales-jubilant-bassoon

Conversation

@jruales

@jruales Joaquín Ruales (jruales) commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add a final Canvas submenu under the Editor Window's New Chat split button when the active initialized Chat view has applicable canvases
  • keep brand-new provisional chats lazy: no canvas discovery and no Canvas submenu before the provider chat is initialized
  • list registered extension canvases by their actual names, refresh them with runtime registry changes, and exclude definitions that require another input flow
  • use stable instance IDs so selecting the same canvas refocuses or reopens its existing tab, while avoiding duplicate entries for registered defaults
  • share canvas definition labeling, filtering, ordering, and stable-ID helpers with the Agents Window implementation
  • document the submenu and keyboard navigation in Chat Accessibility Help

Related to microsoft/vscode-internalbacklog#10058.

Actual runtime evidence

Captured from this branch through the production path:

  • core agent-host-copilotcli session opened by the workbench
  • first request sent through Agent Host using VS Code's smoke-test mock LLM transport
  • project canvases registered by a real @github/copilot-sdk/extension provider
  • menu populated through listSessionCanvases
  • Chess opened through openSessionCanvas into the real canvas editor

The mock LLM only makes the model response deterministic; it does not contribute UI, menu items, chat state, or canvases.

Before the first message: the provisional chat has no Canvas item.

Provisional Agent Host chat without a Canvas item

After the real Agent Host response: the registered canvas names appear under the final Canvas submenu.

Initialized Agent Host chat with the Canvas submenu

Opening Chess: the real canvas editor opens beside its owning chat.

Chess opened in the real canvas editor

actual-agenthost-canvas-menu.mp4

Validation

  • npm run build-fast -- --client-only — passed
  • npm run typecheck-client — passed
  • changed-TypeScript ESLint — passed
  • npm run test-browser-no-install -- --browser chromium --run src/vs/workbench/contrib/canvases/test/browser/editorCanvasActions.test.ts --reporter dot — 1 passing; covers menu registration, refresh, stable-instance behavior, disabled canvases, and absence for an uninitialized chat without canvasContext
  • npm run test-browser-no-install -- --browser chromium --run src/vs/workbench/contrib/chat/test/browser/accessibility/chatAccessibilityHelp.test.ts --reporter dot — 50 passing
  • canvas common browser tests — 11 passing
  • npm run valid-layers-check — passed
  • npm run check-cyclic-dependencies — passed
  • live production-path run — verified no Canvas before initialization, Cache Stats / Chess / Token Pac-Man after the first Agent Host response, real Chess canvas open, and one stable Chess tab after repeat selection

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 14, 2026 17:57
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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

Streaming updates can repeatedly trigger discovery, and same-context refreshes invalidate commands retained by open menus.

2 open findings
What changed in this PR

Adds a Canvas submenu to the Editor Window’s New Chat menu, sharing canvas behavior with the Agents Window.

Changes:

  • Lists applicable canvases for initialized chats, with stable-instance opening and refocusing.
  • Shares canvas helpers and bridges registered canvas operations.
  • Adds tests and updates Chat Accessibility Help.
File Description
src/​vs/​workbench/​contrib/​chat/​test/​browser/​accessibility/​chatAccessibilityHelp.test.ts Checks submenu help text.
src/​vs/​workbench/​contrib/​chat/​browser/​actions/​chatAccessibilityHelp.ts Documents canvas menu navigation.
src/​vs/​workbench/​contrib/​canvases/​test/​common/​agentHostCanvas.test.ts Tests chat-owned canvas operations.
src/​vs/​workbench/​contrib/​canvases/​test/​browser/​editorCanvasActions.test.ts Tests menu registration, refresh, and opening.
src/​vs/​workbench/​contrib/​canvases/​electron-browser/​editorCanvases.contribution.ts Registers the editor menu contribution.
src/​vs/​workbench/​contrib/​canvases/​common/​canvas.ts Adds shared definitions and helpers.
src/​vs/​workbench/​contrib/​canvases/​common/​agentHostCanvas.ts Exposes definition discovery and opening.
src/​vs/​workbench/​contrib/​canvases/​browser/​editorCanvasActions.ts Implements dynamic canvas menu actions.
src/​vs/​sessions/​contrib/​canvases/​electron-browser/​sessionCanvasService.ts Reuses shared filtering and ordering.
src/​vs/​sessions/​contrib/​canvases/​common/​sessionCanvas.ts Delegates labeling and stable IDs to shared helpers.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@jruales
Joaquín Ruales (jruales) marked this pull request as ready for review October 14, 2026 21:23
@jruales
Joaquín Ruales (jruales) marked this pull request as draft October 14, 2026 21:23
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3c546c0c-56be-485f-9b6f-ca08c5cc4cba
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3c546c0c-56be-485f-9b6f-ca08c5cc4cba

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

Obsolete queued discovery can still run, and snapshot refreshes can leave Canvas definitions stale.

2 open findings
2 resolved since last review

🧠 Review effort: Balanced

@jruales
Joaquín Ruales (jruales) marked this pull request as ready for review October 14, 2026 22:41
@jruales
Joaquín Ruales (jruales) marked this pull request as draft October 14, 2026 22:41
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3c546c0c-56be-485f-9b6f-ca08c5cc4cba
@jruales Joaquín Ruales (jruales) changed the title Canvases: Add Canvas submenu to Editor Window New Chat menu Canvases: UI way of opening Canvases from Editor Window Oct 14, 2026
@jruales Joaquín Ruales (jruales) changed the title Canvases: UI way of opening Canvases from Editor Window Canvases: UI for opening Canvases from Editor Window Oct 14, 2026
@jruales
Joaquín Ruales (jruales) marked this pull request as ready for review October 14, 2026 23:07
@jruales
Joaquín Ruales (jruales) marked this pull request as draft October 14, 2026 23:07
@jruales
Joaquín Ruales (jruales) requested a balanced review from Copilot October 14, 2026 23:07

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.

🔵 Needs a closer look

Canvas recovery and failed snapshot-refresh paths retain unresolved correctness issues.

0 open findings

2 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Reopen dismissed canvas when its unavailable source recovers

src/​vs/​workbench/​contrib/​canvases/​browser/​editorCanvasActions.ts:231

If a user closes a stable canvas instance and its source becomes unavailable, selecting its definition calls openCanvas without clearing the dismissal. This can occur during a runtime configuration refresh, which preserves canvas channels but removes their URLs. When the same source recovers, CanvasService still suppresses the tab: reopening requires either an explicit reveal or a new successful model open_canvas request, neither of which this call supplies. Preserve the user's reveal intent until the live instance is available, while respecting owner visibility and enablement. Add a regression covering a dismissed, unavailable instance that recovers after selection.

Medium severity Refresh canvas definitions after cancelled snapshot replays changes

src/​vs/​workbench/​contrib/​canvases/​common/​agentHostCanvas.ts:98

The successful-snapshot notification does not cover a failed refresh. BaseAgentSubscription.cancelSnapshotRefresh() replays buffered actions through _reconcile() but emits neither event observed here. If a ChatCanvasesChanged action was buffered and the chat owner stays unchanged, the subscription updates without refreshing definitions, leaving removed canvases selectable and new ones absent. Notify definition consumers when cancellation replays registry changes, without refreshing on ordinary streamed updates, and add a regression that buffers a registry change before cancelling the refresh.

🧠 Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3c546c0c-56be-485f-9b6f-ca08c5cc4cba
@jruales

Copy link
Copy Markdown
Contributor Author

Addressed the two "Previously missed" Copilot findings in f3d198ccaf0:

  • Selecting a registered definition now records explicit reveal intent even when the stable canvas instance temporarily has no source. If the source recovers, the dismissed tab reopens; the provider open request still runs to restore the source.
  • Cancelled snapshot refreshes now report the buffered actions they replayed. Canvas definition invalidation filters that signal to successful ChatCanvasesChanged actions, so failed reconnect recovery refreshes the menu without reacting to ordinary streamed updates.

Validation: 88 focused browser tests passed, 15 CanvasService Electron tests passed, client type-check passed, ESLint passed, and pre-commit hygiene passed.

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.

🟢 Approval recommended

No unresolved defects remain, and supplied regression coverage addresses the principal lifecycle paths; tests were not rerun.

0 open findings

🧠 Review effort: Balanced

@jruales
Joaquín Ruales (jruales) marked this pull request as ready for review October 15, 2026 00:07
@jruales Joaquín Ruales (jruales) added the canvases Issues related to Copilot canvases label Oct 15, 2026
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Ulugbek Abdullaev (@ulugbekna)

Matched files:

  • src/vs/sessions/contrib/canvases/common/sessionCanvas.ts
  • src/vs/sessions/contrib/canvases/electron-browser/sessionCanvasService.ts

@jruales
Joaquín Ruales (jruales) merged commit b02a600 into main Oct 15, 2026
36 checks passed
@jruales
Joaquín Ruales (jruales) deleted the jruales-jubilant-bassoon branch October 15, 2026 00:25
@vs-code-engineering vs-code-engineering Bot added this to the 1.143.0 milestone Oct 15, 2026
@jruales

Joaquín Ruales (jruales) commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Tracks the Editor Window Canvas menu feature implemented by #341597. The corresponding Agents Window feature is microsoft/vscode-internalbacklog#10058, under the broader microsoft/vscode-internalbacklog#9997 work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

canvases Issues related to Copilot canvases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants