Skip to content

sessions: host session views outside the Sessions part - #345076

Closed
Sandeep Somavarapu (sandy081) wants to merge 3 commits into
mainfrom
agents/sessions-hosted-views
Closed

Sandeep Somavarapu (sandy081) wants to merge 3 commits into
mainfrom
agents/sessions-hosted-views

Conversation

@sandy081

@sandy081 Sandeep Somavarapu (sandy081) commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Infrastructure, no user-visible change.

Lets the Agents window show a session outside the Sessions part grid; chat windows (#344666) use this.

  • Show sessions outside the grid: the sessions service keeps window sessions apart from grid sessions. mainWindowActiveSession is the main window's session; it equals activeSession whenever no other window is active.
  • Session actions on a given session: actions accept the session to act on and default to the active one, as before.
  • Changes editors name their chat: a Changes editor whose source names a chat (ISessionChangesEditorOptions.chatResource) shows that chat's changes only, whichever chat or session is active and whichever window has focus. The main window's editor names no chat and shows, as on main, the chat the main window shows for its session; it's never affected by another window having focus. Fix Checks sends its prompt to the widget of the chat its session shows.
  • Hosted session views and an input-only chat view:
    • A session view can be hosted outside the Sessions part.
    • The chat view can show only its input (chatInputPart.setSingleLine, not called yet).
    • IChatViewFactory.createChatView keeps its options: IChatViewOptions, which gains input (placeholder, minimum lines, pills) for a hosted view. The chat view's private composer-only flag, set by IChatViewOptions.inputOnly, is renamed _composerOnly so it doesn't clash with the observable of a view that shows only its input. Its behavior is unchanged.
    • The CSS selectors are widened from .part.sessionspart to :is(.part.sessionspart, .sessions-window-host), a class main never sets. The input-only rules also target classes main never sets.

How to test

No UI change: the Agents window's grid, session actions and chat input behave as before.

Validation (alone on main ae15303)

  • npm run typecheck-client: passed at every commit
  • npm run build-fast -- --client-only: passed
  • ./scripts/test.sh --runGlob "vs/sessions/**/*.test.js": 9783 passing
  • ./scripts/test.sh --runGlob "vs/workbench/services/**/*.test.js": 2880 passing
  • ./scripts/test.sh --runGlob "vs/workbench/test/**/*.test.js": 767 passing
  • ./scripts/test.sh --runGlob "vs/workbench/contrib/chat/**/*.test.js": 16244 passing, 1 failing (ChatListWidget "falls back to a full refresh…", also failing on main ae15303)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Focus-dependent session lookup can make the main window’s Changes editor display another chat’s files, while Fix Checks can target the wrong chat or time out.

2 open issues
What changed in this PR

Prepares the Agents window to host session views outside the Sessions grid, without intentionally enabling new UI.

Changes:

  • Separates main-window session ownership from globally active sessions and adds explicit action targeting.
  • Introduces hosted-view options, session-scoped changes/PR observables, and single-line input infrastructure.
  • Updates styles, fixtures, mocks, and regression tests.

One correctness issue was recorded concerning Changes-editor ownership when two windows show different chats of the same session. Project tests were not run; verification used source inspection and a self-contained ownership check.

File Description
src/​vs/​workbench/​test/​browser/​componentFixtures/​sessions/​changesView.fixture.ts Updated as part of this pull request.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​widget/​input/​chatInputPart.test.ts Updated as part of this pull request.
src/​vs/​workbench/​contrib/​chat/​browser/​widget/​input/​chatInputPart.ts Updated as part of this pull request.
src/​vs/​workbench/​contrib/​chat/​browser/​promptTimeline/​media/​promptTimeline.css 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/​test/​browser/​sessionsParts.test.ts Updated as part of this pull request.
src/​vs/​sessions/​test/​browser/​chatGroupsView.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/​services/​sessions/​test/​browser/​sessionsManagementService.test.ts Updated as part of this pull request.
src/​vs/​sessions/​services/​sessions/​test/​browser/​sessionScope.test.ts Updated as part of this pull request.
src/​vs/​sessions/​services/​sessions/​test/​browser/​sessionActionTarget.test.ts Updated as part of this pull request.
src/​vs/​sessions/​services/​sessions/​browser/​sessionsPartService.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/​sessionActionTarget.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/​agentHost/​test/​browser/​agentHostCustomizationService.test.ts Updated as part of this pull request.
src/​vs/​sessions/​LAYOUT.md 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/​terminal/​test/​browser/​sessionsTerminalContribution.test.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​terminal/​browser/​sessionsTerminalContribution.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​sessionsWindowNotifier.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/​sessionsRename.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/​sessionsList.test.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​sessionsActions.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/​views/​sessionsViewActions.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​sessions/​browser/​views/​sessionsView.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​sessions/​browser/​views/​sessionsList.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​sessions/​browser/​sessionsActions.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​sessionInputBanners/​test/​browser/​sessionInputBanners.test.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​sessionComparison/​test/​browser/​sessionComparisonGridController.test.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/​copilotChatSessionsProvider.test.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​providers/​agentHost/​test/​browser/​openAgentHostStateFile.test.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/​agentHostSkillButtons.test.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​providers/​agentHost/​test/​browser/​agentHostSessionChangesets.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/​agentHost/​agentHostPermissionPickerDelegate.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/​baseAgentHostSessionsProvider.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​providers/​agentHost/​browser/​agentHostSkillButtons.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/​layout/​test/​browser/​layoutControllerTestUtils.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/​desktopExistingSessionStrategy.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/​desktop/​desktopDetailPanelCoordinator.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​layout/​browser/​baseSessionLayoutController.ts 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/​githubService.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/​githubService.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​editor/​test/​browser/​editor.contribution.test.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​chat/​test/​browser/​voiceBridge.test.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​chat/​test/​browser/​sessionTurnChanges.test.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/​sessionChatInputToolbar.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/​newChatWidget.fixture.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/​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/​browser/​sessionChatInputToolbar.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​chat/​browser/​modelPicker.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​chat/​browser/​chat.contribution.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​changes/​test/​browser/​sessionSyncChanges.test.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​changes/​test/​browser/​sessionChangesEditor.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/​changesMultiDiffSourceResolver.test.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​changes/​test/​browser/​changesetReviewActions.test.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​changes/​test/​browser/​changesActionsBar.test.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​changes/​test/​browser/​changesActions.test.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​changes/​common/​changesViewService.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​changes/​browser/​sessionChangesService.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/​changesViewRenderer.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​changes/​browser/​changesViewActions.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​changes/​browser/​changesSummaryWidget.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​changes/​browser/​changesMultiDiffSourceResolver.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/​changes.contribution.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/​browser/​parts/​sessionView.ts Updated as part of this pull request.
src/​vs/​sessions/​browser/​parts/​sessionsParts.ts Updated as part of this pull request.
src/​vs/​sessions/​browser/​parts/​sessionsPart.ts Updated as part of this pull request.
src/​vs/​sessions/​browser/​parts/​media/​sessionView.css Updated as part of this pull request.
src/​vs/​sessions/​browser/​parts/​media/​sessionsPart.css Updated as part of this pull request.
src/​vs/​sessions/​browser/​parts/​media/​chatGroupsView.css 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/​parts/​chatGroupsView.ts Updated as part of this pull request.
src/​vs/​sessions/​browser/​media/​workbench.css Updated as part of this pull request.

Review effort: Balanced

const sessionResource = this._sessionChangesService.getSessionResource(uri)!;

// The per-session chain is created once per resolve; the derived below only selects between it and the shared active one.
const sessionObs = derived(reader => findSessionByResource(this._sessionsService, sessionResource, reader));
}

const sessionResource = activeSession.resource;
const sessionResource = session.resource;
The Agents window can only show a session in the Sessions part grid of its
main window. Add window sessions: ISessionsService.showSessionInWindow shows
one chat of a session outside the grid, in a session view registered with
ISessionsPartService.registerWindowSessionView. A chat shown that way leaves
the tabs of its session in the grid, and the session leaves the grid when that
chat was its only one; closeSession stops showing it.

Active session rule: a session shown in another window becomes active while
that window has focus, unless it is shown passively; the main window's layout
follows its own session. The sessions list, layout controllers, Changes, the
terminal and the agent host provider follow mainWindowActiveSession, which is
the active session while no other window shows a session. The agent host
provider treats sessions shown in other windows as shown, for chat config and
loading.

Nothing shows a session in another window yet, so behavior does not change. A
test covers that the main window follows the active session without other
windows.

Ported from agents/sessions-window-sessions 94f6c11, 5ec09ac,
664d4e7 and 4a10fdb1bb8, e08ab865cad.

Co-authored-by: Copilot <[email protected]>
The title bar's Changes, pull request and review actions, the Changes view and
editor, and the Agent Merge context keys always act on the active session, so
they cannot serve a session that is shown but not active. Make them take a
session:

- Actions resolve their session from an explicit argument (by resource,
  against the sessions shown in the grid and in other windows), else from the
  main window's active session.
- ISessionScope gives a view or editor its session; the Changes view, summary,
  picker, changeset selection, editor, resolver and review actions read their
  changes through IChangesViewService.getSessionChanges(session).
- Session action context keys are bound per context key service, so a title bar
  hosted for a non-active session gets its own scoped keys; their observables
  only react to the keys they read.

Without an argument and without other windows every action still targets the
active session, so behavior does not change.

Squashed from agents/session-scoped-titlebar-actions (94b140f, 4000cd2,
46bf53f, 376161c, 1702616, 49ae8b2, 0be0e13, 258419b,
6b76d9d, 15b99a7, 42e61c7, 9e5e58f, a26d679, 0515ba5,
31e44e5, f575613), with 993cf42, 2f33993 and 65c2e7c for
the main window's session.

A Changes editor shows the changes of the chat its source names, from that chat
only: whichever chat or session is active and whichever window has focus, so
that two editors of two chats of a session, in one window or not, each show
their own (ISessionChangesEditorOptions.chatResource,
getChangesEditorChanges). The main window's editor, which names no chat, shows
the chat the main window shows for its session, as its active session or a
session of its grid, never the session another window shows or has focus, as on
main; once the main window does not show its session, such as when the editor
moves into the window a chat of its session opens in, the chat that window shows. Fix Checks sends its prompt to the widget of the chat its session shows.

Co-authored-by: Copilot <[email protected]>
… an input-only chat view

A session view only works inside the Sessions part: it always shows the session
header and the Session Activity Bar, and its chat input always takes the main
window's options. Session views, chat groups and chat views now take
ISessionViewHostOptions, so a host outside the Sessions part can hide the
session header and the Session Activity Bar and configure the chat input
(placeholder, minimum lines, status pills). SessionView exposes its primary chat
view, and Sessions part styles also apply under
.sessions-window-host.

The chat view gains an input-only mode: it shows only the input, with the latest
message and the progress or outcome of its response above it, and switches back
to the conversation when the chat waits for input that only the conversation
can show. ChatViewInputOnlyEnabledContext and ChatViewInputOnlyContext reflect
it. Waiting for input, failing and cancelation are announced once to screen
readers, and nothing is read from the chat until input-only is enabled. While
input-only, ChatInputPart.setSingleLine lays the input editor out exactly one
line tall.

The Sessions part passes no host options and nothing enables input-only mode,
so behavior does not change.

Ported from agents/sessions-window-sessions c0685f5, 10fb235,
5de12de, adapted to the Session Activity Bar taking its own column.

Co-authored-by: Copilot <[email protected]>
Sandeep Somavarapu (sandy081) added a commit that referenced this pull request Nov 2, 2026
Makes the `ChatInputPart.setSingleLine` change and its test identical to
those of #345076, which the Agents window's chat windows build on, so that the
two carry the same change.

Co-authored-by: Copilot <[email protected]>
Sandeep Somavarapu (sandy081) added a commit that referenced this pull request Nov 3, 2026
Makes the `ChatInputPart.setSingleLine` change and its test identical to
those of #345076, which the Agents window's chat windows build on, so that the
two carry the same change.

Co-authored-by: Copilot <[email protected]>
Sandeep Somavarapu (sandy081) added a commit that referenced this pull request Nov 3, 2026
Makes the `ChatInputPart.setSingleLine` change and its test identical to
those of #345076, which the Agents window's chat windows build on, so that the
two carry the same change.

Co-authored-by: Copilot <[email protected]>
Sandeep Somavarapu (sandy081) added a commit that referenced this pull request Nov 3, 2026
Makes the `ChatInputPart.setSingleLine` change and its test identical to
those of #345076, which the Agents window's chat windows build on, so that the
two carry the same change.

Co-authored-by: Copilot <[email protected]>
Sandeep Somavarapu (sandy081) added a commit that referenced this pull request Nov 4, 2026
Makes the `ChatInputPart.setSingleLine` change and its test identical to
those of #345076, which the Agents window's chat windows build on, so that the
two carry the same change.

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants