Skip to content

canvases: feat: hide canvas-created sessions from the sessions list by default - #350587

Merged
Ulugbek Abdullaev (ulugbekna) merged 4 commits into
mainfrom
ulugbekna/agents/canvas-sessions-default-hidden
Nov 26, 2026
Merged

Ulugbek Abdullaev (ulugbekna) merged 4 commits into
mainfrom
ulugbekna/agents/canvas-sessions-default-hidden

Conversation

@ulugbekna

@ulugbekna Ulugbek Abdullaev (ulugbekna) commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Why

Opening a canvas from the Canvases section starts an empty backing quick chat. Listing that zero-turn session in the Sessions list creates a duplicate sidebar entry while the user is working with the canvas.

Summary

  • Client-side listing state in ISessionsListModelService. Persist hidden canvas sessions in profile-scoped machine storage (sessionsListControl.hiddenCanvasSessions, StorageTarget.MACHINE) as a Map<sessionId, 'default' | 'explicit'>. Integrate it into isSessionListed, identity migration (onDidReplaceSession and previousIdentities, including pending Hide Undo targets), and onDidDeleteSession cleanup. Suspend canvas-session exclusion while chat.canvases.enabled is disabled without discarding stored reasons, firing CanvasListing when availability changes. Automation sessions keep their own listing rules.
  • Flicker-free creation. Expose sessionId on ISessionsProviderCanvasDraft and ICanvasSessionDraft. NewCanvasSessionAction hides the draft session as 'default' before opening the canvas, tracks session replacement, and rolls back if opening fails or pinning hits the cap.
  • Auto-reveal to avoid orphaned sessions.
    • Sending a user message (IChatService.onDidAcceptRequest) reveals a 'default'-hidden canvas session, while leaving 'explicit'-hidden sessions hidden.
    • Removing the last pinned canvas of an unarchived session reveals it in PinnedCanvasService. Closing a canvas from the sidebar (markChatDone: true) keeps a confirmed archived session hidden and reveals the session if marking it done did not archive it.
    • Reconcile hidden, unpinned sessions when a pending archive is rejected or a confirmed archive is undone, while leaving confirmed archived sessions hidden.
  • Explicit Show and Hide controls. Add Show in Sessions List and Hide from Sessions List on the sidebar pin context menu (Menus.SidebarCanvasContext) and the canvas page header (AgentsWindowMenus.CustomViewCanvas, with Codicon.eye / Codicon.eyeClosed), plus Hide from Sessions List on SessionItemContextMenuId for sessions that have a pinned canvas, with an Undo notice.
  • Specification. Document the cross-surface listing rule and machine-state persistence in src/vs/sessions/SESSIONS_LIST.md.

Validation

  • pnpm run build-fast — passed
  • pnpm run build-fast --client-only — passed
  • ./scripts/test.sh --reporter dot --run across all modified and new test suites (sessionsListModelService.test.ts, pinnedCanvasService.test.ts, newCanvasSessionAction.test.ts, pinnedCanvasActions.test.ts, pinnedCanvasPage.test.ts, automationSessionsListing.test.ts, sessionsList.test.ts, sessionsListActions.test.ts) — 792 passing, 0 failing after review fixes (and 39 passing in pinnedCanvasService.test.ts after final type adjustment)
  • pnpm run typecheck-client — passed (0 errors)
  • pnpm run oxlint on all changed TypeScript files — passed (0 issues)
  • pnpm run valid-layers-check — passed
  • Verified live in an isolated Code OSS Agents window across both sessions.sidebar.separateNavigation: true and false layouts (create hidden, Show/Hide from pin menu and session menu with Undo, Remove from Sidebar auto-reveal, sidebar Close Canvas staying hidden, Go to Chat staying hidden, and reply auto-reveal).

…y default

Sessions started from the Canvases section are left out of the Sessions
list by default while their canvas is pinned in the sidebar. They appear
automatically once the user sends a message in the session or removes its
last pinned canvas without marking it done, and can be shown or hidden
explicitly from the pin context menu, canvas page header, or session
context menu.

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

Unresolved visibility and recovery defects can leave sessions hidden without accessible pins, sync hidden state across devices without matching pins, and cause Undo to fail after session replacement.

4 open issues
What changed in this PR

This PR keeps canvas-created backing sessions out of the Agents window’s Sessions list by default, avoiding duplicate sidebar entries while retaining explicit listing controls.

Changes:

  • Persists canvas-session visibility and carries it across session replacement.
  • Adds Show/Hide actions with Undo and automatic reveal on replies or last-pin removal.
  • Documents the listing contract and adds lifecycle, action, and sidebar tests.
File Description
src/​vs/​workbench/​contrib/​sessions/​test/​browser/​sessionsListModelService.test.ts Tests visibility persistence, replacement, Undo, and cleanup.
src/​vs/​workbench/​contrib/​sessions/​test/​browser/​sessionsListActions.test.ts Tests Hide action eligibility and Undo.
src/​vs/​workbench/​contrib/​sessions/​providers/​agentHost/​browser/​baseAgentHostSessionsProvider.ts Exposes the canvas draft’s session ID.
src/​vs/​workbench/​contrib/​sessions/​common/​sessionsProvider.ts Adds session identity to provider canvas drafts.
src/​vs/​workbench/​contrib/​sessions/​common/​sessionsManagement.ts Adds session identity to managed canvas drafts.
src/​vs/​workbench/​contrib/​sessions/​common/​sessionCommands.ts Defines the canvas-session Hide command.
src/​vs/​workbench/​contrib/​sessions/​browser/​views/​sessionsListCommon.ts Adds a pinned-canvas context key.
src/​vs/​workbench/​contrib/​sessions/​browser/​views/​sessionsListActions.ts Implements Hide with an Undo notice.
src/​vs/​workbench/​contrib/​sessions/​browser/​views/​sessionsList.ts Supplies visibility state to context menus.
src/​vs/​workbench/​contrib/​sessions/​browser/​sessionsManagementService.ts Forwards draft session identity.
src/​vs/​workbench/​contrib/​sessions/​browser/​sessionsListModelService.ts Stores and manages canvas-session visibility.
src/​vs/​workbench/​contrib/​sessions/​browser/​pinnedCanvases.ts Shares listing context keys and ownership helpers.
src/​vs/​sessions/​SESSIONS_LIST.md Documents visibility ownership and lifecycle rules.
src/​vs/​sessions/​services/​sessions/​test/​browser/​sessionsManagementService.test.ts Tests draft identity forwarding.
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​sessionsListTestUtils.ts Supports hidden canvas sessions in list fixtures.
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​sessionsList.test.ts Tests context menus in both sidebar layouts.
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​automationSessionsListing.test.ts Tests reply-triggered canvas-session reveal.
src/​vs/​sessions/​contrib/​sessions/​browser/​automationSessionsListing.ts Reveals default-hidden sessions on user replies.
src/​vs/​sessions/​contrib/​providers/​agentHost/​test/​browser/​localAgentHostSessionsProvider.test.ts Tests draft-to-committed identity replacement.
src/​vs/​sessions/​contrib/​canvases/​test/​electron-browser/​pinnedCanvasPage.test.ts Tests reactive page listing context.
src/​vs/​sessions/​contrib/​canvases/​test/​electron-browser/​pinnedCanvasActions.test.ts Tests Show/Hide menus and command routing.
src/​vs/​sessions/​contrib/​canvases/​test/​electron-browser/​newCanvasSessionAction.test.ts Covers creation hiding and failure rollback.
src/​vs/​sessions/​contrib/​canvases/​test/​browser/​pinnedCanvasService.test.ts Covers reveal behavior after unpinning and closing.
src/​vs/​sessions/​contrib/​canvases/​electron-browser/​pinnedCanvasPage.ts Updates header context and accessibility help.
src/​vs/​sessions/​contrib/​canvases/​electron-browser/​pinnedCanvasActions.ts Adds Show/Hide actions to canvas surfaces.
src/​vs/​sessions/​contrib/​canvases/​electron-browser/​newCanvasSessionAction.ts Hides drafts before opening and restores listing on failure.
src/​vs/​sessions/​contrib/​canvases/​browser/​pinnedCanvasService.ts Coordinates last-pin reveal with archive and close behavior.

Review effort: Balanced

- Reconcile hidden, unpinned sessions when a pending archive is rejected or
  a confirmed archive is undone, while keeping confirmed archives hidden.
- Suspend canvas-session exclusion while `chat.canvases.enabled` is off,
  preserving stored reasons and firing `CanvasListing` on changes.
- Update pending `hideCanvasSessions` Undo targets during identity migration.
- Persist hidden canvas sessions as `StorageTarget.MACHINE` and update
  `src/vs/sessions/SESSIONS_LIST.md`.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ulugbekna
Ulugbek Abdullaev (ulugbekna) added this pull request to the merge queue Nov 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 26, 2026
Resolve import conflicts in sessionsList.ts and sessionsList.test.ts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…text menu test

Give each test session a distinct descending `createdAt` timestamp so
`SessionsSorting.Created` ordering does not depend on wall-clock ticks
between `createTestSession` calls.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ulugbekna
Ulugbek Abdullaev (ulugbekna) added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit 291360c Nov 26, 2026
53 checks passed
@ulugbekna
Ulugbek Abdullaev (ulugbekna) deleted the ulugbekna/agents/canvas-sessions-default-hidden branch November 26, 2026 20:53
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