Repository navigation
Sessions: session hosts replace the active session - #346171
Merged
Merged
Conversation
Introduce ISessionHost, ISessionHostService and IFocusedSessionHostService. The main window, chat windows, session views, the shared chat input composer and the automation dialog provide a host, nested through DI. ISessionScope reads the window host. Behaviour is unchanged. Co-authored-by: Copilot <[email protected]>
resolveSessionCommandTarget resolves what a Sessions command acts on from its arguments: a host, editor group, window, chat or session, or the focused host without arguments. Arguments that name something that is not found resolve to nothing. The existing resolvers now read the hosts instead of the scoped services of chat windows. Co-authored-by: Copilot <[email protected]>
The Changes scope carries the session and chat of its window host and whether that is the main window, instead of comparing observables with the main window's active session. The feedback overlay and chat window terminals look up the host of their editor group or window. Root services of the main window look up its host. Helpers that read the selected chat now take the host's chat. Co-authored-by: Copilot <[email protected]>
The agent host mode, permission, approvals and config pickers, the Copilot mode picker, the mobile config picker and the model picker take the session and chat of the host they are created in (ISessionChatSource) instead of the session context, and read that chat instead of the session's selected chat. The phone input context and the worktree suggestion take the chat explicitly. Co-authored-by: Copilot <[email protected]>
The session view passes its session to the chat views it creates (IChatViewOptions.session). The new-session and new-chat-in-session widgets show the draft of their pane instead of reading the active session, which could be another pane's or another window's. Co-authored-by: Copilot <[email protected]>
The canvas context service finds the window that shows a canvas owner through the host of its chat: a chat window that shows the chat, else the main window while it shows the session. The canvas contexts follow the focused host. The session input banners show the session and chat of their window host. Co-authored-by: Copilot <[email protected]>
A canvas opens in the main part of the chat window that shows its owner's chat, else in the main window, instead of in the window whose editor group is active. A canvas of a chat window opened while another window had focus no longer lands in that other window. Co-authored-by: Copilot <[email protected]>
The command center's session title shows the session and chat of the window whose title bar shows it, created with that title bar's services. A chat group view compares its session with that of its window host rather than with the active session. The workspace display info takes the chat explicitly. Co-authored-by: Copilot <[email protected]>
…ground Without a focused document, the focused host is the window host that last had focus instead of the main window, which getActiveWindow falls back to. Commands without arguments run from the background, such as from the dock, act on that window. Co-authored-by: Copilot <[email protected]>
Services and contributions that follow focus read the session and chat of IFocusedSessionHostService.focusedHost instead of ISessionsService.activeSession and its selected chat: agent feedback, browser views, canvases, Changes activity, workspace handoff, AI customizations, artifacts, voice, turn changes, code review, tours, agent host pickers and presenters, customizations, the workspace folders and labels, and telemetry. Behaviour is unchanged. Co-authored-by: Copilot <[email protected]>
The Agent Host provider, GitHub pull request polling, worktree cleanup and the Agent Host customization lookup no longer read the view state of ISessionsService. Shown sessions come from the session hosts, the main window's session from its window host, and the focused session from the focused host. The providers no longer depend on ISessionsService. Behaviour is unchanged. Co-authored-by: Copilot <[email protected]>
Worktree cleanup no longer offers the worktree of a session that any host shows, and pull request polling keeps polling draft CI checks and merged pull requests while any host shows their session, not only the focused one. Polling stays one per session and stops once no host shows it. Co-authored-by: Copilot <[email protected]>
sessionHostServiceOf registers plain hosts for the state of ISessionsService in a real SessionHostService, so the tests of host lookups go through the real nesting, ownership and window rules instead of a parallel fake. Co-authored-by: Copilot <[email protected]>
resolveChatWindow fell back to the chat window that has focus when its arguments named a group or window that is not a chat window's, such as a command run from the main window while a chat window had focus. Arguments that name where a command runs now resolve to that chat window or to none; only commands without them act on the focused chat window. Co-authored-by: Copilot <[email protected]>
The Run actions act on the session and chat of the focused host, and the Run button of a title bar on those of the window host it shows in, instead of the active session and ISessionScope. Behaviour is unchanged. Co-authored-by: Copilot <[email protected]>
Commands that take a session, a chat, a session resource or nothing resolve what they act on with resolveSessionCommandTarget, and the chat-window tab entries, the Changes editor's changeset selection and Open in VS Code read session hosts. resolveSessionActionTarget, findSessionByResource, findSessionByChatOrResource, getFocusedWindowSession and getChatWindowSession are removed. A session that several windows show resolves to its host in the focused window, with the chat that host shows, as the old resolver did. Co-authored-by: Copilot <[email protected]>
A chat window shows a list of chats, each an editor of its chat part, in any group and grid shape of the part. The provider's content is window-level and resolves chats one at a time. The window's chat, chat editor and title are those of its active chat: the chat editor last active in the window. Closing or ending one chat removes only that chat, and the window closes with its last chat. Moving one of several chats out of the window takes only that chat out. Move to Main Window carries all its chats, and restoring keeps the list and the active chat, still reading the entries of one chat or session. The Agents window's provider still shows one chat per window. Co-authored-by: Copilot <[email protected]>
A chat window now holds chats in plain editor groups, one chat editor per chat, rather than a session view of a copied window session. Each chat editor shows one chat, with no inner chat tabs, in a pane host nested in its window's host, which follows the active chat editor. - The chat editor moves to contrib/chatEditor, without depending on chat window services. - A chat a window shows stays out of the main window's grid through ISessionsService.hideChatFromGrid. - Opening a chat a window shows reveals it there, and a chat opened beside one it shows opens beside it, through IChatHostOpenerService. - Focusing a chat window no longer makes its session the active session. - Move to Main Window carries all chats of the window. Co-authored-by: Copilot <[email protected]>
Chat windows show chats as chat editors, so the sessions service no longer shows sessions in windows of their own. Removes showSessionInWindow and the window sessions of the visibility model, with their activation on window focus, and the window session views of the sessions part. windowSessions stays empty, and mainWindowActiveSession is the active session, until the session API shrinks. Co-authored-by: Copilot <[email protected]>
Main-window-only UI (the layout controller and its strategies, the sessions list, the sessions view, the mobile title bar and the comparison grid) reads what the main window's session host shows instead of the sessions service's active session. The grid exposes `activePaneId` and `focusActiveSession()` for its own pane identity and focus. Co-authored-by: Copilot <[email protected]>
Voice reads the focused session host, so it follows the chat window the user talks to; new sessions still open in the main window, whose composer it checks. The new-session view tours read the main window host, which owns the new-session view they guide through. Co-authored-by: Copilot <[email protected]>
Commands that act on a session or chat resolve it with resolveSessionCommandTarget: their arguments, else the focused host. Commands of the main window's grid act on the grid's active pane through ISessionsPartService.getActiveSessionView(), and neither match their keybindings nor act while a chat window is the focused host, so its chat editors and editor groups keep their keys. Follow-ups after opening a new session, and the main window's Changes and sessions list, read the main window host. - Focus Chat Input focuses the input of the chat the focused chat window shows. - A side chat is sent in the background only when the window that shows its source chat navigates away from it. - Delegating to an agent host takes the folder of the focused host's session, and opens beside it when the grid shows it. - The chat input toolbar finds the session of a chat among the grid's panes. Co-authored-by: Copilot <[email protected]>
… sessions service SessionsService creates the main window's host on the grid's selection and exposes it as gridHost; the host lookups register that instance, and the main window's UI injects it, through a temporary alias that C10 removes. activeSession, mainWindowActiveSession and windowSessions leave ISessionsService: the grid's selection stays internal to the service, and others read the windows' hosts. Test mocks keep the grid state they model as test fields, typed by ITestSessionsGridState, from which the session host test helpers derive the hosts. Co-authored-by: Copilot <[email protected]>
…osts UI reads the session and chat of the host it is in. The Sync Changes button reads its host, so in a chat editor it shows the editor's chat rather than the grid's active session, and returns focus to its own surface. SESSIONS.md describes the session host contract. Co-authored-by: Copilot <[email protected]>
The root no longer provides a session host: the main window's parts (the sessions grid, custom views, panel, sidebar, auxiliary bar, editors and title bars) and window canvases are created from a child scope that provides the grid host, so a root singleton that injects a session host fails instead of silently getting the main window's. The focused host and the automation dialog look their hosts up. Items of workbench-wide chat input menus that apply in session hosts only show nothing elsewhere, such as in Quick Chat. Co-authored-by: Copilot <[email protected]>
…sions A pane host's session is the pane's own view of the session: a slot of the grid and a detached pane of one of its chats have different views of it. Code outside the grid no longer reads the grid's detached-pane field off a host's session, nor compares hosts' sessions as objects to find the session's pane. - The grid answers for a pane's own session whether it is the active pane and whether it is detached (ISessionsService.isActivePane and isDetachedPane, backed by its detached panes). - getHostOfSession picks, of the panes of a window that show a session, the window's active pane (the grid's, or the one that shows the window's chat), else the one that is not detached. - The session a pane's toolbars pass still names that pane, detached or not. - The pin and close commands check the chat the passed pane shows, and the comparison grid asks the grid whether its Judge pane is detached. - Opening a session in a chat window no longer filters detached panes out of the grid's visible sessions, which never include them. A canonical session object shared by all hosts of a session is left to a follow-up that removes the grid's detached-pane field. 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.
🟡 Changes recommended
Missing session-host service registrations cause artifact-details, Changes view, and title-bar fixtures to fail with unknown-service errors instead of rendering.
3 open issues
What changed in this PR
Replaces global active-session access with scoped session hosts so Agents window UI, commands, and services target the chat shown by the appropriate surface.
Changes:
- Migrates session consumers and command targeting to scoped or focused hosts.
- Updates window-part creation, chat composers, and editor integration.
- Adapts tests, fixtures, documentation, and localization registration.
| File | Description |
|---|---|
| src/vs/workbench/test/browser/componentFixtures/sessions/sessionsTitleBarWidget.fixture.ts | Updated as part of this pull request. |
| src/vs/workbench/test/browser/componentFixtures/sessions/changesView.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/chatWindow/test/browser/chatWindowLayoutActions.test.ts | Updated as part of this pull request. |
| src/vs/workbench/contrib/chatWindow/browser/chatWindowLayoutActions.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/sessionViewTestUtils.ts | Updated as part of this pull request. |
| src/vs/sessions/test/browser/sessionView.test.ts | Updated as part of this pull request. |
| src/vs/sessions/sessions.common.main.ts | Updated as part of this pull request. |
| src/vs/sessions/services/workspaceFolderLabel/browser/workspaceFolderLabelService.ts | Updated as part of this pull request. |
| src/vs/sessions/services/sessions/test/browser/sessionOpenTelemetryService.test.ts | Updated as part of this pull request. |
| src/vs/sessions/services/sessions/common/sessionsManagement.ts | Updated as part of this pull request. |
| src/vs/sessions/services/sessions/browser/sessionScopedContextKeys.ts | Updated as part of this pull request. |
| src/vs/sessions/services/sessions/browser/sessionScope.ts | Updated as part of this pull request. |
| src/vs/sessions/services/sessions/browser/sessionOpenTelemetryService.ts | Updated as part of this pull request. |
| src/vs/sessions/services/presentation/browser/chatPhoneInputContext.ts | Updated as part of this pull request. |
| src/vs/sessions/services/chatView/browser/chatViewFactory.ts | Updated as part of this pull request. |
| src/vs/sessions/services/canvas/browser/windowCanvasService.ts | Updated as part of this pull request. |
| src/vs/sessions/LAYOUT.md | Updated as part of this pull request. |
| src/vs/sessions/electron-browser/parts/titlebarPart.ts | 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/worktreeSuggestion/test/browser/worktreeSuggestionService.test.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/workspace/browser/workspaceFolderManagement.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/terminal/test/browser/chatWindowTerminalActions.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/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/sessionsTelemetry.contribution.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsSessionManagementActions.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/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/test/browser/aiCustomizationShortcutsWidget.fixture.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/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/mobile/mobileOverlayContribution.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/sessions/browser/customizationsNavigationState.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostActions.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/copilotChatSessions/test/browser/modePicker.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsActions.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/test/browser/agentMergeActions.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/agentHostModePicker.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/agentHostCodexApprovalsPicker.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/test/browser/agentHostClaudePermissionModePicker.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/test/browser/agentHostAgentPicker.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/browser/openAgentHostStateFileAction.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/browser/mobile/mobileChatPhoneInputPresenter.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/browser/exportDebugLogsAction.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/browser/codexCustomizationSettings.contribution.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/browser/codexContinuation.contribution.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/browser/agentMergeActions.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/browser/agentHostSettings.contribution.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/browser/agentHostPolicyContinuationPresenter.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/browser/agentHostPermissionPickerActionItem.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/browser/agentHostForkActions.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/providers/agentHost/browser/agentHostClaudePermissionModePicker.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/policyBlocked/test/browser/sessionsPolicyBlocked.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/policyBlocked/browser/sessionsPolicyBlocked.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/onboardingTours/test/browser/parallelTasksTour.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/onboardingTours/test/browser/newSessionViewV3Prompt.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/onboardingTours/test/browser/newSessionViewTourTrigger.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/onboardingTours/test/browser/agentsWindowInvitationOnboarding.test.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/newSessionViewV3TourContribution.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/onboardingTours/browser/newSessionViewV2TourContribution.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/agentsWindowInvitationOnboarding.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/layout/test/browser/chatLayoutOwnership.test.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/desktopDetailPanelCoordinator.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/inboxOne/browser/inboxNotificationsView.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/github/test/browser/githubService.test.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/github/browser/createSessionFromPullRequestAction.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/editor/browser/editor.contribution.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/editor/browser/addTabActions.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/codeReview/browser/codeReview.contributions.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chatWindow/browser/chatWindow.contribution.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/sessionsGrid.fixture.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/newSessionPickerTryout.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/test/browser/newChatWidget.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/test/browser/newChatVoiceTarget.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/test/browser/newChatInSessionWidget.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/test/browser/modelPicker.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/test/browser/artifactIntegrationPresentation.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/agentsWindowWorkspaceHandoff.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/sessionTurnChanges.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/browser/sessionsChatAccessibilityHelp.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/browser/newSessionAction.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/browser/newChatVoice.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/browser/newChatInSessionWidget.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/browser/chatView.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/chat/browser/artifactActivitiesModel.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/sessionActionsHost.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/changes/test/browser/sessionActionContextKeys.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/changes/browser/sessionActionsHost.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/changes/browser/checksActions.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/changes/browser/changesetReviewActions.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/changes/browser/changesActivity.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/browserView/test/browser/sessionBrowserNetwork.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/browserView/browser/sessionBrowserNetwork.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/automations/test/browser/automationDialog.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/applyCommitsToParentRepo/browser/applyChangesToParentRepo.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/agentFeedbackItemsBackend.test.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/agentFeedback/browser/agentFeedbackPRReviewSeeder.ts | Updated as part of this pull request. |
| src/vs/sessions/contrib/agentFeedback/browser/agentFeedbackItemsBackend.ts | Updated as part of this pull request. |
| src/vs/sessions/common/contextkeys.ts | Updated as part of this pull request. |
| src/vs/sessions/common/chatLayout.ts | Updated as part of this pull request. |
| src/vs/sessions/browser/sessionWorkspace.ts | Updated as part of this pull request. |
| src/vs/sessions/browser/parts/titlebarPart.ts | Updated as part of this pull request. |
| src/vs/sessions/browser/parts/mobile/contributions/mobileChangesView.ts | Updated as part of this pull request. |
| src/vs/sessions/browser/parts/customViewGridParts.ts | Updated as part of this pull request. |
| src/vs/sessions/browser/parts/chatView.ts | Updated as part of this pull request. |
| src/vs/sessions/browser/parts/chatGroupView.ts | Updated as part of this pull request. |
| src/vs/sessions/browser/paneCompositePartService.ts | Updated as part of this pull request. |
| src/vs/sessions/browser/actions/vscodeActions.ts | Updated as part of this pull request. |
| src/vs/sessions/AI_CUSTOMIZATIONS.md | Updated as part of this pull request. |
| build/lib/i18n.resources.json | Updated as part of this pull request. |
Review effort: Balanced
Contributor
|
Base:
|
The fixtures model the grid with a test sessions service. Since the title bar and the grid commands read the main window's host, the focused host and the grid's pane queries, the fixtures give the main window's host and the focused host the grid's active session, and their sessions service answers the pane queries for its slots. The title bar shows the active session again, and Maximize and Pin act on their pane. Co-authored-by: Copilot <[email protected]>
The test opens a terminal in the window's main part, which moves it to the part that holds the window's terminals on a timeout. The test waits for it, so the move does not outlive the test (it leaked on WebKit). Co-authored-by: Copilot <[email protected]>
Vritant Bhardwaj (vritant24)
previously approved these changes
Nov 5, 2026
Components now read the window's session host, the host lookups or the focused host instead of the sessions service: the Changes view, the title bar, the input banners, the sessions list, the new chat widget, the automation dialog, artifact activities and session changes. Their fixtures only modelled the session on the sessions service, so they failed to construct. They now stub the main window's host showing the fixture's session, the host lookups and, where needed, the focused host. The title bar's mock session reports itself created, as a real host reads that. Co-authored-by: Copilot <[email protected]>
roblourens
approved these changes
Nov 5, 2026
Christof Marti (chrmarti)
added a commit
that referenced
this pull request
Nov 5, 2026
…5832) <!-- Thank you for submitting a Pull Request. Please: * Read our Pull Request guidelines: https://github.com/microsoft/vscode/wiki/How-to-Contribute#pull-requests * Associate an issue with the Pull Request. * Ensure that the code is up-to-date with the `main` branch. * Include a description of the proposed changes and how to test them. --> Fixes microsoft/vscode-internalbacklog#10484 ## What changed "Open in Agents Window" from an SSH, WSL or Tunnel editor window opened the Agents Window without the folder. Only local folders and local Dev Containers were handed off, so the composer fell back to an unrelated local folder, and telemetry recorded `unsupportedWorkspace`. - **Same folder, same host.** The window-opening handoff resolves `vscode-remote` folders through a new provider-neutral `IRemoteWorkspaceHandoffService` (`sessions/common`), implemented by the remote agent host contribution. It matches the registered SSH, WSL or Tunnel host, or registers it the way Remotes management does. It then preselects the folder in that host's `vscode-agent-host` URI space, reveals the host, and starts a user-initiated connection. - **Dev Containers** on SSH and Tunnel hosts, and in WSL (identified by a `\\wsl.localhost\…` source path), resolve to the source folder on that host with the Dev Container preferred. This is the inverse of the existing Open in Editor mapping. - **No silent fallback.** Remotes that can't be used start with no workspace and a notification explaining why, with a Choose Workspace action. This covers Codespaces, attached containers, WSL on another machine, and failed host lookups. - **Inferred defaults** ("Open Agents Window", `folderUriIsDefault`) only replace an automatic default. They never add or connect a host while a created session is visible. `selectNoWorkspace` now returns a `WorkspaceSelectionResult` and honors `isDefault`, like `selectWorkspace`. - **A restored Chat choice no longer cancels the handoff.** When the composer started, restoring a saved "no workspace" choice reported a user selection and a navigation. That cancelled a pending handoff before its remote folder resolved, so the Agents Window silently kept the previous choice. It now restores like the automatic fallback next to it. - **Signing in to find a tunnel.** When no signed-in account lists the tunnel and an account needs to sign in first, a dialog explains which account is needed and why. If the user selects **Sign In**, the handoff signs in with that account and looks again. Declining the dialog or cancelling the sign-in explains that signing in is needed. A tunnel the Agents Window already knows gets the same check before the handoff connects it; previously a signed-out account made that connection fail with "No cached authentication available to connect the tunnel." An account without tunnel configuration (Code OSS has no Microsoft tunnel scopes) no longer hides the sign-in behind "No authentication is available to enumerate tunnels." - **SSH user and port.** Like Remote - SSH, an SSH authority without a config alias uses the user and port of SSH config where it omits them. The handoff matches and stores hosts by those effective values, so an omitted user doesn't match another account's host. A stored host without a port is compared on SSH config's port, the one it connects on. - **Cancelled handoffs change nothing.** Once a handoff is cancelled, for example by picking another workspace, it stops before storing a host, caching a distribution or tunnel, clearing a tunnel dismissal or offering a sign-in. - **Starting without a workspace** counts as applied only once Chat has opened. Until a quick-chat target is available, the handoff keeps trying. - **Telemetry.** `agents/firstTimeWindowOpen` and `agents/workspaceSelectionOutcome` gain a bounded `workspaceArgumentRemoteKind`: none, ssh, wsl, tunnel, codespaces, attachedContainer or other. For Dev Containers it is the host of the source folder. It never contains an authority. - **Authority formats** are checked against the Remote - SSH, WSL, Tunnels and Dev Containers extension sources: - Remote - SSH hex JSON and plain `[user@]host[:port]` - `wsl+default` and `wsl+<distro>@<host>` - `tunnel+<name>` and `tunnel+<id>.<cluster>`, looked up with both the GitHub and Microsoft accounts - the `\\wsl\`, `\\wsl$\` and `\\wsl.localhost\` prefixes `sshAuthorityString` (Open in Editor) now mirrors Remote - SSH's `HostInfo.toAuthorityString`, so an SSH config alias with uppercase letters is encoded the same way Remote - SSH encodes it. The remote agent host provider spec gains a paragraph on this registration path. ## Reviewer notes - A chat draft handed off to a remote that is slow to connect still hits the existing 15-second handoff timeout and its Retry notification. - Remote - SSH ignores an encoded port for a configured alias; the Agents Window keeps it. This only affects `alias:port` typed by hand. - Codespaces are not supported yet; they get a dedicated notification. - A restored Chat choice still wins over an inferred default (`_getWorkspaceDefaultBlocker`). Because the restore no longer cancels the handoff, an inferred default from a remote editor window now finishes resolving and connects that host even when the Chat choice stays. Without a saved Chat choice, that already happened. - The tunnel sign-in happens for inferred defaults too, because resolving the folder needs it. The browser tunnel service has no `signIn`, so on the web the handoff still only explains that signing in is needed. - SSH hosts added manually in Remotes management without a port are still keyed as port 22, although they connect on SSH config's port. That keying predates this PR. ## How to test 1. From an SSH, WSL or Tunnel editor window, run **Open in Agents Window**. The same folder is preselected on the matching remote agent host, which is added if needed and connected. 2. From a Codespaces window, or with `code --agents --folder-uri vscode-remote://codespaces+demo/workspaces/project`, the composer starts in Chat with no workspace and shows "The Agents Window cannot open folders from GitHub Codespaces yet." 3. `code --agents --folder-uri vscode-remote://wsl+NoSuchDistro/home/me/project` starts with no workspace and explains that the WSL distribution was not found. 4. In the Agents Window, select Chat (no workspace) and close the window. Then run **Open in Agents Window** from a remote editor window again: its folder replaces the restored Chat choice. 5. From a Tunnel editor window, with the Agents Window not signed in to tunnels, run **Open in Agents Window**. A dialog explains that signing in with GitHub is needed to find the tunnel. After **Sign In** and the GitHub sign-in, the folder is preselected on the tunnel. If you select **Cancel** in the dialog, or cancel the sign-in, the notification says "Sign in to find tunnel '<name>'." The same dialog appears for a tunnel the Agents Window already knows, if its account is signed out. ## Validation After rebasing onto `main` at `8b007fabde2`. The rebase adapted the inferred-default check to the focused session host, which replaced `ISessionsService.activeSession` in #346171: - `pnpm run typecheck-client`: passed. - `pnpm run eslint <changed files>`: passed. - `node --experimental-strip-types build/hygiene.ts <changed files>`: passed. - `.\scripts\test.bat --run <the 9 test files this PR changes, including electron-browser>`: 422 passing. - `pnpm run test-browser-no-install --run <the 8 browser test files of those> --browser chromium`: 408 passing. - `pnpm run valid-layers-check`: passed before the rebase; not rerun. Manually checked in a dev build of the Agents window, before the rebase: - The Codespaces and unavailable WSL notifications. - With temporary logging, since removed: from a Tunnel editor window, the restored Chat choice cancelled the handoff as `userChanged` about 1.6 s after the window opened. The tunnel lookup that kept running found GitHub needing a sign-in and Microsoft unconfigured. - From a Tunnel editor window, before the confirmation dialog was added: the handoff started a GitHub sign-in, then preselected the folder on the tunnel. - With the dialog, for a tunnel the Agents Window already knew while signed out of GitHub: the dialog appeared, and after signing in the folder was preselected and the tunnel connected.
This was referenced Nov 5, 2026
Sandeep Somavarapu (sandy081)
added a commit
that referenced
this pull request
Nov 6, 2026
* Sessions: remove unused ResourceOverrideSession `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]> * Sessions: pickers read the model and mode of the chat a host shows 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]> * Sessions: read whether a session is created from its status `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]> * Sessions: ask the grid about panes by their hosts 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]> * Sessions: pane commands find their pane by its host, not its session 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]> * Sessions: the grid publishes a pane object per grid slot 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]> * Sessions: address panes of the grid by pane objects, not session wrappers `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]> * Sessions: hosts of the grid show the provider's session object 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]> * Sessions: pane views take the content of their pane 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]> * Sessions: composers show the provider's session object 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]> * Sessions: chat windows show the provider's session object 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]> * Sessions: remove ActiveSessionHost 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]> * Sessions: the grid's views show its panes 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]> * Sessions: service tests show sessions and chats, not views of sessions 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]> * Sessions: the focused host stub follows the active window entry 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]> * Sessions: management service tests drive the grid's panes 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]> * Sessions: the canvas focus test compares the session it had before 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]> * Sessions: navigation from a detached pane's views stays in that pane 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]> * Sessions: tests fake the active session as a session with its shown chat 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]> * Sessions: the parts tests show session fakes through panes and pane contents 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]> * Sessions: the chat, chat editor and chat window tests fake sessions with 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]> * Sessions: the contrib tests fake sessions with the chat they show and 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]> * Sessions: Open in Editor transfers only sessions their provider created 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]> * Sessions: Sync Changes from a composer syncs the composer's chat 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]> * Sessions: subagent chat links look up the sessions of the grid's slots 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]> * Sessions: the provider tests fake sessions with the chat they show 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]> * Sessions: the fixtures fake sessions with the chat they show 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]> * Sessions: the session pills fixtures provide the window's session host 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]> * Sessions: the workbench session fixtures fake sessions with the chat 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]> * Sessions: remove the session-view entry points of the grid, its part 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]> * Sessions: the grid's model publishes panes, not its views of sessions 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]> * Sessions: the tab tests of a session's slot drive the grid 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]> * Sessions: the grid round-trip test compares what the restored grid writes 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]> * Sessions: the provider's model selection test shows the draft's own chat 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]> * Sessions: a pane keeps the state of the session it shows, not a view 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]> * Sessions: the session of a host is ISession, and the last session-view 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]> * Sessions: document one session object per session 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]> * Sessions: a pane view keeps showing its session until it binds the next 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]> * Sessions: the grid fixtures fake the pane lookups the pane commands use 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]> --------- Co-authored-by: Copilot <[email protected]>
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.

Sessions: session hosts replace the active session
The Agents window had one global "active session" that UI, commands and services read. Chat windows kept a copy of the session so their UI could read it too. With several windows, and several panes per window, that global no longer described what a given piece of UI shows, so UI in one window could act on another window's session.
This PR replaces it with session hosts (
ISessionHost): a host is a surface that shows a chat, such as the main window, a chat window, a grid pane, a chat editor, a composer or the automation dialog. Hosts nest, and a host's chat is its source of truth: its session derives from that chat, and it has no notion of an active chat beyond the one it shows.ISessionHost; the main window's parts are created in a child scope that provides the main window's (the grid's) host.ISessionHostServicefinds hosts by id, window, editor group, chat or session. It has no selection.IFocusedSessionHostService: the host of the window that last gained focus.resolveSessionCommandTarget, resolves what a command acts on. Arguments can name a host, editor group, window, chat or session; without arguments it resolves the focused host; arguments that name something not found resolve to nothing, so the command does nothing.ISessionsServiceno longer exposesactiveSession,mainWindowActiveSessionorwindowSessions. It owns the grid, and the grid's host (gridHost).ISessionScopeandISessionContextare removed.src/vs/sessions/SESSIONS.mddescribes the contract in its new "Session hosts" section.Commits
The commits are ordered so that each compiles on its own and keeps behaviour, except the commits that are behaviour fixes, which come with tests.
Behaviour changes
UI follows the host it is in
preserveFocusin a chat window no longer moves the focused host.Focus and windows
Lookups
Commands
Chat windows
Pickers outside session hosts
Known deviations and follow-ups
ISessionsService.isActivePane/isDetachedPane).scopedChatResourcestays an internal grid identity, used for detached panes, their persistence, pane identity and opener checks. Sharing one session object across hosts needs the grid's detach representation reworked, so it is a follow-up: a canonical session object, and removingscopedChatResource.GridViewleaks its sash link. A grid that is exactly 2×2 doesn't dispose its sash link. Pre-existing; tracked separately.main; pre-existing and tracked separately.Validation
Based on
e934a7a384a. Each commit compiles on its own, and the tip passes the suites below.Per commit: all 26 commits passed. The command, which also logged each commit's result locally:
Tip
set -o pipefail; corepack pnpm run typecheck-client: passed.corepack pnpm run build-fast --client-only: passed.git diff --name-only --diff-filter=ACMR origin/main HEAD -- '*.ts' | xargs ./node_modules/.bin/eslint: passed (304 files).corepack pnpm run valid-layers-check: passed.corepack pnpm run check-cyclic-dependencies: no cyclic dependencies found.Unit tests, Electron,
./scripts/test.sh --reporter dot --glob <glob>:vs/sessions/**/*.test.jsvs/workbench/contrib/chatWindow/**/*.test.jsvs/workbench/test/browser/parts/editor/**/*.test.jsvs/workbench/services/editor/test/**/*.test.jsvs/workbench/contrib/terminal/test/**/*.test.jsvs/base/test/browser/ui/grid/**/*.test.jsUnit tests, Chromium,
node test/unit/browser/index.js --browser chromium --reporter dot --glob <glob>:vs/sessions/**/*.test.jsvs/workbench/contrib/chatWindow/**/*.test.jsvs/workbench/test/browser/parts/editor/**/*.test.jsvs/workbench/services/editor/test/**/*.test.jsvs/workbench/contrib/terminal/test/**/*.test.jsvs/base/test/browser/ui/grid/**/*.test.jsNo failures in any of them. The
vs/sessions, chat window and terminal suites ran at this tip. The editor (parts/editor,services/editor) and grid results are from the previous tip on the same base: the last changes since touch only the Sessions terminal files, which those suites don't load, so they weren't run again.Live checks in a Code OSS dev build with
--agents, launched in the background:Manual checks (keyboard and focus)
These depend on keyboard input or real window focus, so they weren't covered by the background live checks. Run them with
sessions.chatWindows.enabled: true.Chat windows
Host scopes