Repository navigation
Sessions: one session object per session - #346561
Merged
Sandeep Somavarapu (sandy081) merged 39 commits intoNov 6, 2026
Merged
Conversation
`VisibleSessions.updateResourceOfSession` and its `ResourceOverrideSession` adapter have no production caller. Remove both, and keep the metadata forwarding test for the visible session wrapper. First commit towards one canonical session object shared by all session hosts (follow-up of #346171). Co-authored-by: Copilot <[email protected]>
The model and mode pickers read `IActiveSession.modelId`/`mode`, which a session wrapper of the Agents window overrides with its active chat's. Once hosts share one session object, there is no such wrapper. Read the chat the host shows instead: - `SessionModelSelection` takes an `ISessionChatSource` (session and chat) and reads the chat's model, re-binding when the chat changes. A composer bound to another chat than its session's active one now selects that chat's model. - `ScopedModePickerModelCache` is keyed by the source and reads its chat's mode; the agent-host agent picker reads the focused host's chat. - The phone input context and the chat view's preparation input read the chat's model. Co-authored-by: Copilot <[email protected]>
`IActiveSession.isCreated` is the session wrapper's map of `status`: created once it is no longer untitled. Hosts will show the provider's session, which has no such member. Add `isSessionCreated(session, reader?)` next to the other status helpers and read it at every place that asked a host's or a pane's session, keeping narrowing where the session was optional. Test fakes that set `isCreated` now set the `status` that agrees with it, through the shared `withCreatedStatus` test helper; the layout test session derives `isCreated` from its status. Co-authored-by: Copilot <[email protected]>
The grid answers which of its panes is active or detached for a pane's own session object (`isActivePane`/`isDetachedPane`), which identifies a pane only while each pane has its own copy of the session. Add host-addressed queries that do not depend on that identity: - `ISessionGridPanes.isActivePaneHost`/`isDetachedPaneHost`/`isGridPaneHost`: the grid host stands for the grid's active pane, the host of a slot's or a detached pane's view for that pane, including the new-session slot; other hosts, such as a chat window's, for none. - `ISessionsPartService.getSessionViewOfHost` finds the view of a host. - `getHostOfSession` keeps its URI signature and uses them. The session-addressed queries stay until their last caller moves. Co-authored-by: Copilot <[email protected]>
…object Pane commands, such as Pin, Close or Toggle Maximize, found their pane by the identity of the session object the pane's toolbars pass. Once panes share one session object, that names no pane. Name the pane by its host: - The menus of a pane's header, toolbars and chat tabs append the host's command context to their arguments (`sessionMenuArgs`: `[session, chat | undefined, hostContext]`), so session-level commands shared with the sessions list still get the session first. - `resolvePaneCommandTarget` resolves the pane of the host the arguments name: its view and session for a pane of the grid, else the opener of the surface that shows its chat (`getChatHostOpenerOfHost`); without a host, as from keybindings, the grid's active pane. - `resolveSessionCommandTarget` no longer names a host by the identity of a session object; a session resolves by its resource. - The Changes view's action bars pass the command context of their window's host too, so its actions, such as skill buttons, act on a chat window's chat. - `ISessionsService.getPaneSessionOfHost` maps a host to the grid's view of its pane's session until the pane API replaces it. Co-authored-by: Copilot <[email protected]>
Add `ISessionGridPane` (sessionGridPane.ts): a pane of the main window's grid, a slot or a detached pane, with its kind, the session and chat it shows, its pin and its tab strip. The grid owns it, and it lives as long as its grid slot: its id is the slot id, which a replacement of the session, such as a draft graduating, keeps. - `VisibleSessions.panes`/`activePane`/`getPane` publish the panes in the same transaction as the wrapper arrays and the active session, so no reader sees a pane list and a session list that disagree. - Until the views move to the pane, each pane shows the state of the current adapter (`VisibleSession`) of the session incarnation it shows. A replacement gives the pane a new adapter, as it gives the grid a new wrapper today, and keeps the pane and its id, so views that rebind on a new wrapper keep rebinding. - `ISessionGridPanes.getPaneOfHost(host)`: the grid host stands for the active pane, including the new-session slot's; the host of a view of the grid for the pane of its slot (`ISessionsPartService.getPaneIdOfHost`); other hosts for none. The `*Host` booleans are reimplemented over it. - Tests: panes of a slot and a detached pane share the session object and keep their ids; same- and different-id replacement keeps the panes and publishes atomically; a detached active pane writes the remembered active chat while closed tabs stay the slot's; a layout of only a detached pane saves, restores, closes and reopens. Co-authored-by: Copilot <[email protected]>
…pers `ISessionsService` gains the pane API: `panes`, `slotPanes`, `activePane`, `activatePane`, `closePane`, `collapseToPane`, `detachChat(pane, chat)`, and focus, move and resize in a direction by pane. `closeChat` takes the session. Until the views move to panes, the pane members act through the adapter of the session incarnation a pane shows. - `ISessionGridPanes` takes its final shape: `getPaneOfHost(host)`, and `isActivePane(host)`/`isDetachedPane(host)`, renamed from the `*Host` queries together with their last callers. The queries by session wrapper, `isGridPaneHost`, `getPaneSessionOfHost`, `activePaneId` and `getSessionPaneId` are removed. - The part fires `onDidFocusPane` with the slot id of the view that gains focus, and focuses a pane by `focusPane`. - Pane commands act on `IPaneCommandTarget.pane`. - Migrated to panes: the comparison grid controller (pane ids for its isolated judge), Back/Forward's current entry (the active pane's session and chat), reopen-closed focus, the window notifier, Sync Changes, the conversation actions, and agent feedback channels. Request telemetry counts the slots that show a session, as before. - Focus moves into the active pane when the pane or the session it shows changes, but not into the grid's initial pane, and the active pane's view listeners rebind for either. - Test fakes of the sessions service publish panes for their sessions (`testGridPanes`, `testGridPane`). Co-authored-by: Copilot <[email protected]>
A host's session is the provider's `ISession`, one object for every host that shows it; the state of the pane that shows it, its pin and tab strip, is the pane's. - `IHostSession` is `ISession`. `ISessionPaneTabs` and the new `IPaneViewState` (pin, tab strip, detached) move to the common layer. - `setHostSessionContextKeys(session, chat, paneState, ...)` reads the pin and tab keys from the pane state. Without a pane, as for the Changes view's scoped session actions, the session is not pinned and shows no tab strip; only grid-window commands and the session header read those keys. - `SessionHost` shows a session and a chat of it, observing both without owning them. `ActiveSessionHost`, which the chat windows, composers and the automation dialog still use, is a subclass that shows a session view's active chat. - The grid host shows the active pane's session and chat. A view's host shows the provider's session of the grid's view it binds (`canonicalSessionOf`, until views bind their pane). - `findSessionOfChat`, the input toolbar and its pills take `ISession`. A pill action activates the pane of the grid that shows its session (`activateSessionPane`): through `setActive` for a session view, else the first pane that shows the session object, the pane that showed it before. Co-authored-by: Copilot <[email protected]>
The pane chrome takes the content of the pane it is a view of, `ISessionPaneContent`: the provider's session, the chat the pane shows, the pane's state (pin, tab strip, detached), and how to close the pane. A view cannot close its pane by closing the session it shows any more: for a detached pane that would close the session's slot. - ChatGroupsView runs on the content: whether the pane is detached decides the carried layout, the drop target and persistence; its tabs come from the pane's state; closing its last group closes the pane. - The chat group context, ChatHeader, SessionHeaderBar, ChatCompositeBar and SessionRemoteConnection take the provider's session; a chat drag and the parent context read whether the pane is detached, and closing the main chat's tab closes the pane. - SessionView builds the content of the grid's view it binds, and closes its own pane (`closePane` of its host's pane) only while it still shows that content: a content kept past a rebind, such as a replacement of the session, or past its pane leaving the grid, closes nothing. - A chat window's editor builds the content of its window's view of the session, and closes through its opener until the window shows the provider's session. - Until the views bind their pane, ChatGroupsView and SessionHeader also take a view of a session, as their tests still give them. Co-authored-by: Copilot <[email protected]>
The new-session composer, the composer of a new chat in a session and the automation dialog run on the provider's `ISession`, not a view of it: the draft a pane or the dialog shows is the provider's draft object itself. - `IChatViewOptions.session` is the provider's session; a pane passes the chat it shows as `chat`. A chat window's editor passes its window's active chat the same way. - NewChatWidget shows the provider's draft (`newSession`) or its pane's session without wrapping it; quick chat creation returns the session. - NewChatInSessionWidget, SharedChatInputComposer, the composer input, the migration notice and the worktree suggestion take `ISession`; the composer's host is a `SessionHost` of the chat it shows. - The automation dialog observes the provider's automation draft non-owningly; its host and model selection show that draft and its main chat. - `shownChatOf`/`readShownChat` resolve the chat a composer shows while views of a session still reach it: the explicit chat, else the view's active chat, else the main chat. Co-authored-by: Copilot <[email protected]>
A chat window shows the provider's `ISession` and the chat of it, which it observes without owning, instead of a copy of the session scoped to the chat: closing the window or moving its chat disposes no session. - A window's chat holds the provider's session and chat; its editor's pane shows them as a detached pane does, its one chat. Closing the pane closes the chat in its window, through the window's opener, only while the window still shows that chat of that session: a content kept past the chat being replaced, or ending, closes nothing. - The window's host and its editor's host are hosts of the provider's session and chat; the editor binds the keys of its pane's content. - The grid no longer special-cases a copy that another surface shows: `setActive` and `closeSession` act on the grid only. - A pill activates the pane its host is in, also from a host nested in it. A host of the main window outside its panes, such as the Inbox's, activates the pane of this grid that shows the chat it acts on: the detached pane of the chat, else the session's slot. A pill in a chat window leaves the grid as it is. Co-authored-by: Copilot <[email protected]>
No host shows a view of a session any more: every host shows the provider's session and the chat it shows of it. The tests and component fixtures that built hosts of views of sessions build `SessionHost`s, giving the chat they show explicitly. Co-authored-by: Copilot <[email protected]>
The sessions part renders the grid's panes rather than views of sessions: the view of each grid slot shows that slot's pane, and binds again as the pane shows another session, such as a replacement of it, while it follows the pane's chat and tabs. Code outside the grid's model reads its panes. - The sessions service renders the panes (`updatePanes`), also as a pane's session changes, before it moves focus into the active pane. `SessionView.openPane(pane)` binds to the pane's session, and follows a replacement by the same object through the pane's tabs and chat. - The part looks up panes by position, neighbor and view, and maximizes, resizes and focuses a pane; `updateVisibleSessions` and the lookups that returned views of sessions are removed. - Moving, focusing and resizing in a direction act on the exact pane, a detached one too. The chat commands of the grid read the active pane's tabs and chat. - The readers of the sessions the grid shows read its slot panes, and the main window's context keys its active pane. - The sync-changes button returns focus to the view of its own host. - Views of sessions remain only for tests, deprecated. Co-authored-by: Copilot <[email protected]>
The host and pane test helpers take what a host or pane shows (the provider's session and a chat of it, with a pane's pin, tab strip and detached state), and accept the old views of sessions transitionally. Six service suites build their hosts and panes from those. Co-authored-by: Copilot <[email protected]>
stubSessionHostsFromSessionsService found the focused chat window by the session it shows, so with one session in two windows it always picked the first. It now picks the window of the active entry. Co-authored-by: Copilot <[email protected]>
The tests read the grid through its panes (the active pane, the slots and the detached panes, and each pane's session, chat, tabs and pin) and act on panes, rather than through views of sessions. Co-authored-by: Copilot <[email protected]>
The check compared two reads of the active pane's session after the operation, which agree whenever the pane does. It now captures the pane and its session before opening the canvas and compares those. Co-authored-by: Copilot <[email protected]>
The views of a detached pane passed their own view of the session to openChat and openNewChatInSession, which kept the navigation in that pane. Since they pass the provider's session, opening another chat of a session whose slot is closed replaced another session's slot. They now pass their host: from a host that stands for a detached pane of the session, the navigation stays in that pane and the session's slot goes beside it. Without a host, as from the sessions list, nothing changes. Co-authored-by: Copilot <[email protected]>
A mechanical rename of the IActiveSession type to ITestSessionWithChat in the tests whose fakes are only ever seen as a session and the chat its host shows. ITestSessionWithChat, a session fake carrying activeChat, lives in the test utilities; new tests use ITestShownChat. The tests whose fakes still reach members typed IActiveSession move in later commits. Co-authored-by: Copilot <[email protected]>
…ontents The parts tests give their views panes (SessionView.openPane) and pane contents (ChatGroupsView and SessionHeader setSession) instead of views of sessions, through test helpers that keep one pane and one content per session fake, so a view given the same fake keeps what it shows. Their fakes are sessions that carry the pane state the grid gave them. No fallout fixes were needed in other tests or fixtures: the shared session fake keeps lastClosedChat, so it still satisfies the members that take IActiveSession until they are removed. Co-authored-by: Copilot <[email protected]>
…ith the chat they show The tests fake the sessions their hosts show as sessions carrying the chat they show, and give UI a source of the session and chat (testChatSourceOf), a pane (testPaneOf) or a pane content (testPaneContentOf) instead of views of sessions. Their sessions service stubs model the grid's panes with gridShown rather than visibleSessions. Type-only: the openQuickChat fake in newSessionAction.test returns the type of ISessionsService.openQuickChat. Co-authored-by: Copilot <[email protected]>
… act on panes The remaining contrib tests (apart from the providers) fake the sessions their hosts show as sessions carrying the chat they show, model the grid's panes with gridShown, and their fakes of the sessions service and part override the pane members production calls instead of the members kept for views of sessions. ITestSessionWithChat now declares, as optional, the pane state legacy fakes carry (tab strip, pin, isCreated, the chat of a detached pane). Type-only fixes: - sessionsActions.test: two openQuickChat fakes return the type of ISessionsService.openQuickChat. - sessionsActions.test and sessionsPolicyBlocked.test: the fakes of focusActiveSession pass their session to the part's focusSession as its parameter type. - newChatMigrationNotice.test: isCreated overrides the member it declares again. Co-authored-by: Copilot <[email protected]>
getChatSessionToOpenInEditor decided that a session was created from an isCreated member, treating its absence as created, so a provider's draft session (status Untitled, no such member) and its chat could be handed to another window. It now reads the provider's status (isSessionCreated). Without a chat, Open in VS Code opens the folders of the session's main chat rather than of an active chat the session does not have. Co-authored-by: Copilot <[email protected]>
The composer's repository toolbar passes its session to Sync Changes,
which read the active chat of that session. Composers have shown the
provider's session, which has no active chat, so Sync Changes from a
composer threw. The toolbar now passes the chat the composer shows with
its session, and the action syncs that chat.
Changed expectation: the sessionSyncChanges test of the menu action, which
mirrors the composer's argument, now expects { session, chat } instead of
{ session }, as the composer passes.
Co-authored-by: Copilot <[email protected]>
The subagent chat lookup reads the sessions of the grid's slots from its panes rather than from the views of sessions the grid kept for them: the same sessions in the same order, without the new-session slot. Its tests fake the grid with the slot panes, and a test pins the order and the skipped new-session slot. Co-authored-by: Copilot <[email protected]>
The provider tests fake the sessions their hosts show as sessions carrying the chat they show, give UI a source of the session and chat (testChatSourceOf) instead of views of sessions, and model the grid's panes with gridShown rather than visibleSessions. Co-authored-by: Copilot <[email protected]>
The component fixtures fake sessions as the tests do: as the provider's session with the chat a pane shows (`ITestSessionWithChat`), with the grid's shown sessions in `gridShown` and its slot panes built from them, instead of the deprecated `IActiveSession` and `visibleSessions`. - The grid fixture activates a focused pane through a fixture-local `activate`, and maximizes the left session through its view's pane. - The workbench fixture utils count slot panes for the multiple-sessions key, and the part fake maximizes a pane. No fixture renders differently: every `sessions/**/Light` fixture renders the same before and after this change. Co-authored-by: Copilot <[email protected]>
The session chat input toolbar takes the host it is shown in since chat windows show the provider's session object, and the session pills and chat reference fixtures failed to render without one. Their services now provide the main window's host of the fixture session and chat, which the input banners already used, so the toolbar and the banners share it. Co-authored-by: Copilot <[email protected]>
…they show The session component fixtures under the workbench fake sessions as the other fixtures do: as the provider's session with the chat a pane shows (`ITestSessionWithChat`), and the grid's shown sessions in `gridShown` with its slot panes built from them, instead of `IActiveSession` and the deprecated `visibleSessions`. - The pills fixture's session carries no pane state, so it is an `ISession`. - The header fixture gives the header its pane's content (`testPaneContentOf`), which the header built from the session before. - The composite bar's fake keeps its tab strip's `shouldShowChatTabs` required. No fixture renders differently: every `sessions/` fixture renders the same before and after this change. Co-authored-by: Copilot <[email protected]>
…and its views
The grid, its part and its views are addressed by pane only. The members
that took a view of a session in a pane (`IActiveSession`) go, with the
helpers that converted one. `IActiveSession` remains only inside the
grid's model, which the next commits rewrite.
- `ISessionsService` loses `visibleSessions`, `visibleSessionPanes`,
`setActive`, `focusSessionInDirection`, `moveSessionInDirection`,
`resizeSession` and `collapseToSession`. The service keeps the ones
its model still drives as private members.
- `ISessionsPartService` loses `focusSession` and
`toggleMaximizeSession`. `focusNewSessionSlot` replaces
`focusSession(undefined)`, the one use left, and focuses the same view.
- `SessionView.openSession` goes. `SessionHeader.setSession` and
`ChatGroupsView.setSession` take their pane's content only, and the
header no longer depends on the sessions service.
- `paneContentOf`, `isSessionPaneContent`, `canonicalSessionOf`,
`paneViewStateOfActiveSession`, `setActiveSessionContextKeys`,
`sessionChatSourceOf` and `readShownChat` go.
- A surface given no chat shows its session's main chat: `shownChatOf`
and the composer's bound chat no longer read the active chat of a view
of a session. No surface relies on it: the grid's composers pass their
pane's chat, and other composers show provider sessions.
- `openQuickChat` returns the provider's session. The github PR and
issue actions take sessions.
Tests:
- Fakes of the service and the part override the pane members and
`focusNewSessionSlot`, keeping their recorded labels. Service fakes
record `focusActiveSession` themselves instead of through the part.
Host stubs read `gridShown` only.
- `testPaneContentOf` gives the main chat when a fake has no active
chat, as a session view gives its content.
- Tests that relied on the active-chat fallback pass their chat.
- Changed expectation: the composer test now pins the main chat
("binds the host's chat when it has one, otherwise the session's main
chat"); with the old fallback it binds the fake's active chat.
Co-authored-by: Copilot <[email protected]>
The grid's model publishes its panes and the sessions of its slots, the provider's sessions, instead of the views of sessions it keeps per pane. The sessions service reads the grid only through its panes. The model still keeps a view of each session inside, which the next commit replaces. Model: - `gridSessions`, `activeSession`, `visibleSessions`, `getGridSession` and `getAdapterOfPane` are no longer public, and `isActivePane`, `isDetachedPane` and `isGridPane`, which nothing called, go. - `slotSessions` publishes the sessions of the slots as `visibleSessions` published their views: in the same order and transactions, with `undefined` for the new-session slot. - `setActive` takes a session or one of the grid's own panes, and ignores another grid's pane. `getChatPane` returns the detached pane. Service: - The chat a detached pane shows, its `chat`, replaces the scoped chat of its view. A pane's active chat follows its pane. - `closePane` attaches the chat of a detached pane back to its slot; `closeSession` closes a slot. Closed-session history and the new-session discard get the provider's session. - The reactions to the active pane read the chat it shows of their session only while it shows that session, as they read the chat of the session's view before. - The grid state saves its bindings from the panes, as version 1 did. Tests: - The model's tests read panes. Two tests whose subject was the view are renamed for the pane, with the same expectations: "the active pane shows the provider's session itself, with its metadata" and "replaces the session of the pane even when the session id is unchanged". - The atomic replacement test reads the slot sessions and the active pane's session; its four variants and expected values are unchanged. - New: "a stored grid of slots and a detached chat restores and saves back byte for byte (v1)", which also passes on the previous commit. Co-authored-by: Copilot <[email protected]>
The tests of a session's tab state drive a grid that shows the session in a slot, instead of the view of the session the grid keeps per slot: the grid seeds the slot from the session's persisted state, the tab operations go through the grid, and the state is read from the slot's pane. Their bodies and expectations are unchanged. The test of the view forwarding every session property goes: a pane shows the provider's session itself, which "the active pane shows the provider's session itself, with its metadata" covers. Co-authored-by: Copilot <[email protected]>
…ites The test of a stored grid restoring and saving back byte for byte removes the stored state after the restore, so it compares what the restored grid writes with what it was restored from. Before, the stored state was still there, and the test passed even if the restored grid wrote nothing. Co-authored-by: Copilot <[email protected]>
The test of the shared model selection for automation drafts gives the selection the draft and its main chat, as the composer shows them, instead of a view of the draft that the grid keeps per slot. Its expectations are unchanged. Co-authored-by: Copilot <[email protected]>
…of it The grid's model no longer wraps the sessions it shows. Each pane keeps the state of the incarnation of the session it shows, and a replacement of the session swaps that state in one transaction, keeping the pane: - the state of a session's slot: its active chat, and its tab strip with the chats closed in it, the subagent chats shown in it and the chats other panes or windows show; - the state of a detached pane: the one chat of its session it shows, and that chat as its tab strip. The state is not a session: it doesn't forward the session's properties or carry its active chat's model and mode, and `IActiveSession` goes. A detached pane is its state's kind, not a session scoped to a chat. Co-authored-by: Copilot <[email protected]>
…w names go - `IHostSession`, an alias of `ISession`, goes: hosts show the provider's session itself (by tool, 28 files). - The test-only fake's detached flag is `detachedChat`, not `scopedChatResource`, which production no longer has (by tool). - The sessions part's `toggleMaximizeSession`, which nothing calls, goes, and its `focusSession` is `focusNewSessionSlot`: it was only called to focus the new-session slot, which it finds as before. Co-authored-by: Copilot <[email protected]>
The session host contract and the layout documents describe the grid after the session views went: every host shows the provider's session object, and the grid keeps each pane's state (the chat it shows, its tab strip, its pin), with a detached pane as a kind of pane. Co-authored-by: Copilot <[email protected]>
…xt one A pane outlives the sessions it shows, and a view of it bound its content to the pane's own tabs and chat. Opening a session over the one a slot shows changed those before the view was bound to the new session: for a moment the view showed the old session with the new session's tabs, so its chat group found no chat of the old session, built a new-chat composer, and then a chat view again for the new session, instead of handing its chat view over. The content a view binds now follows the pane only while the pane shows that session, and keeps what it last was afterwards (paneShownOfSession). The view keeps its chat view and hands it to the next session, as before panes were introduced. Co-authored-by: Copilot <[email protected]>
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Kyle Cutler (@kycutler)Matched files:
Joaquín Ruales (@jruales)Matched files:
Ulugbek Abdullaev (@ulugbekna)Matched files:
Ladislau Szomoru (@lszomoru)Matched files:
|
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
This cross-window identity and pane-lifecycle refactor needs maintainer validation of drag-and-drop, split-chat groups, and remote-host behavior, which the reported live checks did not cover and cannot be exercised here.
No open issues 🎉
What changed in this PR
Migrates Sessions consumers to the provider-owned ISession, with pane-specific presentation state accessed through grid panes and shown chats read from their hosts.
Changes:
- Updates navigation, headers, layout, notifications, and actions to use pane and host state.
- Centralizes created-session checks and reads chat-specific model information from
IChat. - Adapts tests, component fixtures, and architecture documentation.
No actionable defects were identified in the supplied changes. Validation was limited to static inspection; tests and fixture rendering were not run.
| File | Description |
|---|---|
| src/vs/workbench/test/browser/componentFixtures/sessions/chatReferences.fixture.ts | Updated as part of this pull request. |
| src/vs/workbench/test/browser/componentFixtures/sessions/blockedSessionsList.fixture.ts | Updated as part of this pull request. |
| src/vs/workbench/test/browser/componentFixtures/fixtureUtils.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/test/browser/worktreeSuggestion/worktreeSuggestionTestUtils.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/test/browser/worktreeSuggestion/worktreeSuggestionController.test.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/test/browser/chat/sharedChatInputComposer.test.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/test/browser/chat/sessionBrowsersControl.test.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/test/browser/chat/sessionBackgroundActivitiesControl.test.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/test/browser/chat/sessionArchiveNudge.test.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/test/browser/chat/newChatVoiceTarget.test.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/test/browser/chat/newChatUserInteraction.test.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/test/browser/chat/newChatMigrationNotice.test.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/test/browser/chat/artifactIntegrationPresentation.test.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/providers/agentHost/test/browser/openAgentHostStateFile.test.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/providers/agentHost/test/browser/mobileChatPhoneInputTarget.test.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/providers/agentHost/test/browser/agentHostCodexApprovalsPicker.test.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/providers/agentHost/test/browser/agentHostClaudePermissionModePicker.test.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/providers/agentHost/browser/openSubagentChat.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/providers/agentHost/browser/mobile/mobileChatInputConfigPicker.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/providers/agentHost/browser/baseAgentHostSessionsProvider.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/providers/agentHost/browser/agentHostSkillButtons.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/providers/agentHost/browser/agentHostPermissionPickerDelegate.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/providers/agentHost/browser/agentHostModePicker.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/common/session.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/worktreeSuggestion/worktreeSuggestionService.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/worktreeSuggestion/worktreeSuggestionController.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/views/sessionsView.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/sessionNavigation.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/sessionCanvasesControl.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/parts/sessionHeader.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/parts/sessionDropTarget.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/parts/chatView.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/parts/chatHeader.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/parts/chatGroupView.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/closedItemHistory.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/chatPhoneInputContext.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/chatHostOpener.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/chat/sessionBrowsersControl.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/chat/sessionBackgroundActivitiesControl.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/chat/newSessionAction.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/chat/newChatVoice.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/chat/newChatUserInteraction.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/chat/newChatMigrationNotice.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/chat/newChatComposerInput.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/chat/chatView.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/changes/sessionChangesEditor.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/changes/sessionActionsHost.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/sessions/browser/changes/sessionActionContextKeys.ts | Updated as part of this pull request. |
| src/vs/sessions/test/common/chatLayout.test.ts | Updated as part of this pull request. |
| src/vs/sessions/test/browser/workbench.test.ts | Updated as part of this pull request. |
| src/vs/sessions/test/browser/vscodeActions.test.ts | Updated as part of this pull request. |
| src/vs/sessions/test/browser/sessionWorkspace.test.ts | Updated as part of this pull request. |
| src/vs/sessions/test/browser/sessionsParts.test.ts | Updated as part of this pull request. |
| src/vs/sessions/test/browser/mainWindowSessionHost.test.ts | Updated as part of this pull request. |
| src/vs/sessions/services/workspaceFolderLabel/test/browser/workspaceFolderLabelService.test.ts | Updated as part of this pull request. |
| src/vs/sessions/LAYOUT.md | Updated as part of this pull request. |
| src/vs/sessions/LAYOUT_CONTROLLER.md | Updated as part of this pull request. |
| src/vs/sessions/electron-browser/actions/vscodeActions.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/workspace/test/browser/workspaceFolderManagement.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsWorkspaceSelectionTelemetry.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsViewPane.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsTypedCharactersTracker.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsTitleBarWidgetRemoteHost.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsTitleBarWidget.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsListTestUtils.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsListFixtureUtils.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsListContextMenu.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/test/browser/customizationsToolbar.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/test/browser/blockedSessionsIndicatorModel.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/test/browser/automationsView.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/test/browser/automationsView.fixture.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/browser/views/sessionsViewActions.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/browser/sessionsWorkspaceSelectionTelemetry.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/browser/sessionsWindowNotifier.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/browser/sessionsTypedCharactersTracker.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/browser/sessionsTelemetry.contribution.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/browser/blockedSessionsIndicatorModel.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessionComparison/test/browser/sessionComparisonViewService.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/remoteAgentHostActions.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/test/browser/agentHostSessionConfigPicker.fixture.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/test/browser/agentHostPolicyContinuationPresenter.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/test/browser/agentHostForkActions.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/test/browser/agentHostChatInputPickersScope.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/policyBlocked/test/browser/sessionsPolicyBlocked.fixture.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/onboardingTours/browser/parallelTasksTourContribution.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/onboardingTours/browser/newSessionViewTourTrigger.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/onboardingTours/browser/newSessionViewTourContribution.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/onboardingTours/browser/newSessionTourContribution.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/onboardingTours/browser/agentsWindowInvitationOnboarding.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/layout/test/browser/desktopStrategies.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/layout/browser/desktopLayoutController.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/layout/browser/desktop/desktopLayoutStrategy.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/layout/browser/desktop/desktopDraftSessionStrategy.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/layout/browser/desktop/desktopDockedTabsCoordinator.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/layout/browser/baseSessionLayoutController.md | Updated as part of this pull request. |
| src/vs/sessions/contrib/github/test/browser/pullRequestActions.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/github/test/browser/issueActions.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/github/test/browser/githubContribution.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/github/browser/pullRequestActions.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/github/browser/issueActions.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/getStarted/test/browser/getStartedTourRunner.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/getStarted/browser/getStartedTourRunner.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/codeReview/test/browser/codeReviewService.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chatWindow/browser/openChatInWindow.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chatWindow/browser/chatWindowActions.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chatEditor/test/browser/chatEditor.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chatEditor/browser/chatEditor.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/test/browser/sessionsWorkbenchFixtureUtils.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/test/browser/sessionsChatAccessibilityHelp.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/test/browser/runScriptAction.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/test/browser/responseSelectionSideChatController.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/test/browser/artifactIntegrationPresentation.fixture.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/test/browser/aiCustomizationWorkspaceService.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/test/browser/agentHostDelegation.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/electron-browser/chat.contribution.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/browser/sideChatProvider.contribution.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/browser/agentHostDelegation.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/changes/test/browser/sessionChangesEditorInput.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/changes/test/browser/checksActions.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/changes/test/browser/changesActivity.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/canvases/test/electron-browser/sessionCanvasWorkingSet.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/canvases/test/electron-browser/sessionCanvasRegistryService.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/canvases/test/browser/pinnedCanvasService.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/canvases/electron-browser/sessionCanvasService.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/browserView/test/browser/sessionBrowserNetwork.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/agentFeedback/test/browser/agentFeedbackPRReviewSeeder.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/agentFeedback/test/browser/agentFeedbackEditorOverlay.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/agentFeedback/browser/agentFeedbackService.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/agentFeedback/browser/agentFeedbackItemsBackend.ts | Updated as part of this pull request. |
Review effort: Balanced
The header's pane commands resolve their target from the host their menu passes: the part service's view of that host, then the sessions service's activatePane (Maximize) and closePane (Close). The grid fixtures' fakes lacked those, so Maximize from a pane's More Actions threw before it maximized, failing the Playwright test "sessions grid header actions update their owning state". Co-authored-by: Copilot <[email protected]>
Ulugbek Abdullaev (ulugbekna)
approved these changes
Nov 6, 2026
Sandeep Somavarapu (sandy081)
deleted the
agents/canonical-session-object-design
branch
November 6, 2026 16:45
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.
Follow-up to #346171 ("Sessions: session hosts replace the active session"), from its "Known deviations".
What changed
Every host of a session in the Agents window now shows one session object: the provider's
ISession. This covers grid slots, detached panes, chat windows, chat editors and composers. There are no per-pane copies of a session anymore.VisibleSessions) owns its panes (ISessionGridPane: id, kindSlot/Detached, session, chat, sticky, tabs). Per-pane state moves from session wrappers onto the pane: the tab strip, closed chats, shown subagent chats, pin, the active chat, and whether the pane is detached. When a session's incarnation is replaced (for example a draft that becomes a created session), the pane swaps its state atomically. The pane object and its id stay the same.IActiveSession,VisibleSession,IHostSession,ActiveSessionHost,ResourceOverrideSessionandscopedChatResource. They have no references left in code or docs.ISessionsServiceandISessionsPartServiceaddress panes:panes/slotPanes/activePane,activatePane,closePane,collapseToPane,focus/move/resizePaneInDirection,focusPane,toggleMaximizePane,focusNewSessionSlot.isActivePane/isDetachedPane/getPaneOfHostanswer by host.getHostOfSessionkeeps its signature.resolveCommandOriginHost), not by a session wrapper.visibleSessions,setActive,*SessionInDirection,resizeSession,collapseToSession,focusSession,toggleMaximizeSession,SessionView.openSession).activeChatfrom a session wrapper.SESSIONS.md,LAYOUT.md,LAYOUT_CONTROLLER.mdandbaseSessionLayoutController.mddescribe the pane model.Why
Before this change, every host of a session kept its own view of it. A grid slot and a detached pane of one of its chats were different objects, with their own tab strip and pin state. Code outside the grid had to compare sessions by resource, and had to ask the grid which pane was active or detached.
scopedChatResourceacted as an internal grid identity, used for detached panes, their persistence, pane identity and opener checks. With one session object per session and the presentation state on the grid's panes:Behaviour
No user-visible change is intended. Layout, tabs, pinning, detached panes, chat windows, focus and the restored grid behave as on
main.Moving consumers from session wrappers to the provider session introduced the regressions below in earlier commits of this series. Each is fixed in the same series and pinned by a test:
openChat(…, { from })): the session's slot opens beside the detached pane, as onmain. Without a host (for example from the sessions list), the behaviour is the same as onmain.{ session, chat }, and the action no longer reads a wrapper's active chat (which threw).main.Tests
All on the final head, rebased onto
main:corepack pnpm run typecheck-client(withpipefail) andcorepack pnpm run eslint <the commit's changed files>passed on each of the 38 commits../scripts/test.sh --reporter dot --runGlob 'vs/{sessions,workbench/contrib/sessions}/**/*.test.js': passed, 10534 passing, 27 pending, 0 failing../scripts/test.sh --reporter dot --run <file>for each ofsrc/vs/workbench/contrib/chatWindow/test/**,src/vs/workbench/contrib/chat/test/browser/chatWindowNotifier.test.tsandsrc/vs/workbench/contrib/chat/test/browser/widget/chatWindowBlurListener.test.ts.corepack pnpm run eslintpassed on all TypeScript files the branch changes, with 0 problems.corepack pnpm run valid-layers-checkpassed.a pane keeps the state of the session it shows) changes no tests../node_modules/.bin/component-explorer render --project ./test/componentFixtures/component-explorer.json --fixture-id-regex '^sessions/chatWindow/titleBar/' --target <dir> [--compare --compare-target <baseline>]). All 24 are identical.Live and performance validation
main: the same seeded profile and the same scripted sequence ran on this branch and on its merge base withmain, in isolated profiles without sending any chat requests. After each step, the state of every window (grid panes with their sizes, titles and chats; chat-window tabs; the sessions list and its selection; the focused element) was captured and compared.main: the same scripted scenarios ran on this branch and on its base, interleaved in several pairs on fresh builds, measuring CPU, long tasks, and the counts of view, binding, context key, toolbar and menu work.mainrebinds it four times). Long tasks and wall time per swap are equal tomain.How to test
Review
main, including how the branch was adapted to upstream changes: chat links in chat windows, hiding a chat from the grid, the move of the Sessions code tovs/workbench/contrib/sessions, the chat window title bar and Session Activity Bar strip, and the guards on moving editors across windows. Each review approved with no findings.