Repository navigation
Agents window: start a new session in a chat window - #346678
Merged
Sandeep Somavarapu (sandy081) merged 16 commits intoNov 7, 2026
Merged
Conversation
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: TylerLeonhardtMatched files:
Ladislau Szomoru (@lszomoru)Matched files:
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Temporary provider-catalog removal clears group placement for an in-flight slot send, causing a subsequently successful session to lose its source session’s custom group.
1 open issue
What changed in this PR
This PR enables new-session composers inside Agents chat windows, keeping their drafts and sends separate from the main window while reusing shared session and editor infrastructure.
Changes:
- Adds independent draft slots, inherited session defaults, input snapshots, and custom-group placement.
- Adds chat-window entry points, composer-to-chat transitions, restoration handling, and unsent-composer move restrictions.
- Persists cleared external-chat drafts and extends regression tests, specifications, and accessibility help.
| File | Description |
|---|---|
src/vs/workbench/services/editor/test/browser/viewEditor.test.ts |
Tests dynamic view-title rendering. |
src/vs/workbench/contrib/sessions/test/common/newChatDraftState.test.ts |
Tests send-attempt snapshot ownership. |
src/vs/workbench/contrib/sessions/test/browser/sessionGroupsService.test.ts |
Tests draft-slot group placement. |
src/vs/workbench/contrib/sessions/test/browser/chat/sharedChatInputComposer.test.ts |
Tests snapshot tracking, recovery, and focus. |
src/vs/workbench/contrib/sessions/providers/agentHost/browser/agentHostAgentPicker.ts |
Reports explicit user agent selections. |
src/vs/workbench/contrib/sessions/common/sessionsManagement.ts |
Defines draft slots and request lifecycle contracts. |
src/vs/workbench/contrib/sessions/common/newChatDraftState.ts |
Adds hosted input snapshots and serialization helpers. |
src/vs/workbench/contrib/sessions/browser/sessionsService.ts |
Keeps independent drafts outside grid navigation. |
src/vs/workbench/contrib/sessions/browser/sessionGroupsService.ts |
Tracks group intent for independent slots. |
src/vs/workbench/contrib/sessions/browser/parts/chatView.ts |
Defines hosted-composer targets and recovery hooks. |
src/vs/workbench/contrib/sessions/browser/newSessionComposerService.ts |
Adds user agent-selection notifications. |
src/vs/workbench/contrib/sessions/browser/chat/sharedChatInputComposer.ts |
Tracks hosted input and send attempts. |
src/vs/workbench/contrib/sessions/browser/chat/sessionWorkspacePicker.ts |
Supports independent workspace selection state. |
src/vs/workbench/contrib/sessions/browser/chat/sessionModelSelection.ts |
Reports explicit user model selections. |
src/vs/workbench/contrib/sessions/browser/chat/newSessionAction.ts |
Extracts inherited session-target resolution. |
src/vs/workbench/contrib/sessions/browser/chat/newChatComposerInput.ts |
Adds snapshot and send-attempt options. |
src/vs/workbench/contrib/chatWindow/test/browser/chatWindowsRestoration.test.ts |
Tests partial and failed window restoration. |
src/vs/workbench/contrib/chatWindow/test/browser/chatWindow.test.ts |
Tests new-chat delegation, adoption, and move vetoes. |
src/vs/workbench/contrib/chatWindow/browser/chatWindowsRestoration.ts |
Retains unopened chats for later restoration. |
src/vs/workbench/contrib/chatWindow/browser/chatWindowService.ts |
Tracks opened chats and delegates new-chat creation. |
src/vs/workbench/contrib/chatWindow/browser/chatWindow.ts |
Extends provider and window lifecycle interfaces. |
src/vs/workbench/contrib/chat/test/common/chatService/chatService.test.ts |
Tests cleared external drafts across reloads. |
src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts |
Persists metadata when stored drafts are cleared. |
src/vs/workbench/browser/parts/editor/viewEditorPane.ts |
Honors dynamic title-rendering state. |
src/vs/workbench/browser/parts/editor/viewEditorInput.ts |
Adds title-rendering control without changing capabilities. |
src/vs/sessions/SESSIONS.md |
Documents draft slots and chat-window composers. |
src/vs/sessions/SESSIONS_LIST.md |
Documents draft-owner custom-group intent. |
src/vs/sessions/services/sessions/test/browser/sessionNavigation.test.ts |
Updates management-service test doubles. |
src/vs/sessions/contrib/sessions/test/browser/sessionsListTools.test.ts |
Adds request lifecycle event stubs. |
src/vs/sessions/contrib/sessions/test/browser/sessionsListChatMoveDnd.test.ts |
Updates drag-and-drop service mocks. |
src/vs/sessions/contrib/sessions/test/browser/sessionsList.test.ts |
Updates list service mocks. |
src/vs/sessions/contrib/sessions/test/browser/sessionsArchiveActions.test.ts |
Updates archive-action service mocks. |
src/vs/sessions/contrib/sessions/test/browser/sessionsActions.test.ts |
Tests window-aware New Session routing. |
src/vs/sessions/contrib/sessions/browser/sessionsActions.ts |
Routes picker creation and hides inapplicable close actions. |
src/vs/sessions/contrib/providers/agentHost/test/browser/agentHostAgentPicker.test.ts |
Tests user versus automatic agent selection. |
src/vs/sessions/contrib/onboardingTours/test/browser/parallelTasksTour.test.ts |
Tests chat-window tour suppression. |
src/vs/sessions/contrib/onboardingTours/browser/parallelTasksTourContribution.ts |
Limits tour eligibility to the main window. |
src/vs/sessions/contrib/chatWindow/test/browser/chatWindowContribution.test.ts |
Tests command availability and keyboard routing. |
src/vs/sessions/contrib/chatWindow/common/chatWindows.ts |
Defines unsent-composer context and move explanation. |
src/vs/sessions/contrib/chatWindow/browser/openChatInWindow.ts |
Disables main-window moves with unsent composers. |
src/vs/sessions/contrib/chatWindow/browser/chatWindowActions.ts |
Adds the chat-window New Session command. |
src/vs/sessions/contrib/chatEditor/test/browser/chatEditor.test.ts |
Tests composer transitions, focus, and move restrictions. |
src/vs/sessions/contrib/chatEditor/browser/chatEditorContent.ts |
Hosts composers and transitions to session chats. |
src/vs/sessions/contrib/chatEditor/browser/chatEditor.ts |
Connects composer content and editor move restrictions. |
src/vs/sessions/contrib/chat/test/browser/sessionWorkspacePicker.test.ts |
Tests hosted workspace-selection isolation. |
src/vs/sessions/contrib/chat/test/browser/sessionsChatAccessibilityHelp.test.ts |
Tests feature-gated composer guidance. |
src/vs/sessions/contrib/chat/browser/sessionsChatAccessibilityHelp.ts |
Explains chat-window creation, sending, and recovery. |
Review effort: Balanced
Sandeep Somavarapu (sandy081)
force-pushed
the
agents/chat-window-new-session
branch
2 times, most recently
from
November 6, 2026 23:38
d73ab08 to
c747a67
Compare
Dmitriy Vasyura (dmitrivMS)
previously approved these changes
Nov 6, 2026
Contributor
|
Base:
|
Sandeep Somavarapu (sandy081)
force-pushed
the
agents/chat-window-new-session
branch
from
November 6, 2026 23:56
c747a67 to
65d948d
Compare
Dmitriy Vasyura (dmitrivMS)
previously approved these changes
Nov 7, 2026
Sandeep Somavarapu (sandy081)
force-pushed
the
agents/chat-window-new-session
branch
from
November 7, 2026 00:13
65d948d to
f6654e4
Compare
A composer outside the main window needs a draft of its own that sending,
replacing or discarding never takes from the main composer, and that it can
get back when its send fails.
- ISessionsManagementService.createNewSessionSlot creates an independent
slot; defaultNewSessionSlot is the slot of newSession, with the existing
createNewSession, createQuickChat and discardNewSession.
- getNewSessionOwner names the slot that owns a draft or an accepted
request, following the session's replacements, also while
onDidDiscardNewSession fires for it.
- onDidAcceptNewSessionRequest fires when sendNewChatRequest accepts a
slot's draft, before the slot lets go of it: in the background at
dispatch, in the foreground after preparation, with the prepared session.
onDidEndNewSessionRequest fires once per accepted request with the final
session, whether it started, failed or was cancelled.
- A send clears only its owner slot's draft; the main composer still drops
its draft for any send, as before.
- A failed foreground send of a live slot that holds no other draft becomes
its draft again when the slot's readoptOnFailure accepts it; otherwise an
independent slot's uncreated session is deleted. A session its provider
removed is neither re-adopted nor deleted. Failures of an independent
slot's background sends are reported on the end event, not as a
notification. The main composer keeps its behavior.
- ISessionsService.openNewSession({ draftSlot }) creates the draft in that
slot behind the same trust and Dev Container checks, without changing the
grid or navigation.
- The grid's send-follow neither starts nor ends for sends of independent
slots. A disposed slot creates no drafts.
Co-authored-by: Copilot <[email protected]>
- ISessionGroupsService.setDraftSlotGroup records the group every send of a new-session draft slot joins, until it is disposed or the group is deleted. - A send of an independent slot takes that group when the request is accepted, keeps it while the session is not listed, follows its replacements, joins the group when the session starts and drops it when the request ends without starting, so a retried send joins it once. - The main composer's pending group is captured and reset only for sessions no independent slot owns, so a send or discard of another composer never consumes or clears it. Co-authored-by: Copilot <[email protected]>
…de the main window IChatViewOptions.newSessionDraft hosts a composer outside the main window's grid, such as in a chat window. Its drafts are held in the host's draft slot: creating, replacing, reseeding and discarding them never changes the main composer's draft, the grid or navigation. The Inbox's detached composer keeps the main composer's slot. - Accepted feedback belongs to the main composer: a hosted composer neither sends nor clears it. Compare Agents is not offered; a stale comparison send is refused with its reason. - Alt+Enter shows the composer's "Message sent" status, and its Open Session opens the session through the host, in the host's window. - Before a background send, the composer hands it to the host (trackBackgroundSend), which follows the request until it ends, also after the composer is gone: the management service does not notify failures of an independent slot. trackNewSessionRequestEnd follows a request through its replacements. The composer keeps only its own status listener, and the host reads whether the send is still the composer's latest through a weak reference, which its status cleanup does not end. Co-authored-by: Copilot <[email protected]>
A composer outside the main window keeps its input in an IComposerInputSnapshot of its host instead of the main composer's saved draft, so each composer restores its own input. - The composer restores the snapshot once the context queued before rendering is merged, and only then writes it, synchronously, on every change of its text, attachments, inline references or attachment pills. It never writes it when it is disposed, nor from a widget it no longer shows, and never writes the main composer's saved draft. - Each send is bracketed with an attempt that holds the input from before the composer cleared it, so a reload during the send restores what was sent. A send that does not go out gives its input back to the snapshot when its view is gone, unless the next view has input of its own. An attempt is ended only by the completion of its own send (ComposerInputSnapshot). Co-authored-by: Copilot <[email protected]> # Conflicts: # src/vs/workbench/contrib/sessions/browser/chat/newChatComposerInput.ts # src/vs/workbench/contrib/sessions/browser/chat/newChatWidget.ts # src/vs/workbench/contrib/sessions/test/browser/chat/sharedChatInputComposer.test.ts
A host can request what its composer creates drafts for: a folder or none, and the agent, model and mode, such as another chat's defaults. - The composer starts from the requested target rather than from the main composer's last workspace, which it does not persist over. The agent is the pick the composer aims for when it becomes available only later. - The requested model applies when the agent offers it, otherwise the agent's default model; the mode applies to the requested agent. - The user's workspace, agent, model and mode picks replace the requested target, and an Alt+Enter send's selection becomes the target of the next draft. Co-authored-by: Copilot <[email protected]>
The quick input tracks which modifier keys are pressed, for example so that Alt+Enter accepts a pick to the side, with listeners on every window: the main window and each window registered after it was created. It is created as it is first used, so a window registered earlier, such as an auxiliary window opened before the first quick input, never had its modifier keys tracked, and accepting there always saw none. It now also tracks the windows registered before it. Co-authored-by: Copilot <[email protected]>
A chat window can open a new-session composer as a tab in the group of its active chat. The composer starts from the active chat: its session's folder (or No Workspace for a quick chat), agent, model and custom agent, and the sessions it sends join the custom group of that session in the sessions list. - The composer keeps its drafts in a draft slot of its own and never touches the main window's composer or grid. - A foreground send keeps the composer's tab: once the request starts the session, the tab becomes the session's main chat, which the window then holds out of the grid like its other chats. A failed send gets its draft back while the composer still aims for what it sent. - A background (Alt+Enter) send leaves the composer with a new draft; a failure is reported also after the composer is gone. - Opening a composer while the active chat is an unsent composer focuses it. - While it is a composer, its tab shows, with its close button, also alone in its group, as it has no title of its own until its session's chat shows. - Its session's chat takes over the chat model the composer was bound to, as in the main window, instead of loading the chat again. It holds that model only until the chat's view has bound to it, so that the view can still let go of it, such as to load it again once its provider is replaced. - The new-session target the main window's New Session action inherits is shared with the chat window. Co-authored-by: Copilot <[email protected]> # Conflicts: # src/vs/sessions/contrib/chatEditor/browser/chatEditor.ts # src/vs/sessions/contrib/chatEditor/browser/chatEditorContent.ts # src/vs/sessions/contrib/chatEditor/test/browser/chatEditor.test.ts # src/vs/sessions/contrib/chatWindow/browser/sessionsChatWindowProvider.ts # src/vs/sessions/contrib/chatWindow/test/browser/sessionsChatWindowProvider.test.ts # src/vs/workbench/contrib/sessions/browser/chat/newSessionAction.ts
The composers of chat windows are stored when the window's state is saved, never as their input changes. Each entry holds what the composer aims for, its custom group, its input with attachments and references, and a send that has not ended. - A stored composer restores in its window as a composer with its input. If a send had not ended, it restores with what was sent, or as the main chat of the session that send started. - Once the chat windows have restored, the stored composers they did not restore are forgotten. A chat window that failed to open stays stored, and its composers count as restored, so they are tried again next time. - Malformed entries are dropped on their own. Co-authored-by: Copilot <[email protected]>
…kground send When a composer's background (Alt+Enter) send fails to start its session, the prompt goes back into the composer, with its attachments and references, as long as nothing changed there: the send was the composer's latest, its input is still empty and idle, and the user hasn't changed what it aims for since. The restore is announced. Otherwise the notification names the workspace and agent the prompt was sent to and offers Restore Prompt, which leaves what the composer aims for unchanged, and Copy Prompt. Once the composer is gone, only Copy Prompt is offered. Co-authored-by: Copilot <[email protected]>
A new-session composer that hasn't sent its session stays in its chat window until it's sent: - Its editor refuses moves to another window or to a new window, with the reason "A new session can't leave its window until it's sent. Send it, or close it to discard it." Moves within its window are allowed, and a copy of it is a move. - Move to Main Window is disabled while the window holds an unsent composer, active or not. Run anyway, the chat window service asks the provider first and shows the reason, leaving the window and its chats as they are. Closing the window is not affected. Once the composer's send starts its session, it moves like any chat. Co-authored-by: Copilot <[email protected]>
…on it inherits from A new-session composer opened from a session that runs in a Dev Container now aims for that container too, as the main window's New Session does: its drafts of that folder are created in a Dev Container, or not at all. - The requested target carries whether the folder's drafts require a Dev Container. It's inherited from the active chat's session, stored and restored with the composer, kept for the next draft after a background send, and applied again when the composer is shown again. - The user's folder or environment pick decides it from then on: a pick in another environment no longer requires the container. After a declined trust prompt, the composer goes back to what its kept draft runs in. Co-authored-by: Copilot <[email protected]>
New Session in a chat window (the Command Palette, and Cmd/Ctrl+N while the window's chat, a new session there or its title bar has focus) opens a new-session composer as a tab of the window's active chat. The Sessions picker of a chat window opens it there too, beside the active chat when opened to the side and without focus in the background. The key does not apply in the window's other editors, nor in the search picker of an empty file editor, nor with AI features disabled or chat windows turned off; the main window's New Session is unchanged. The window's title bar has no New Session button. A chat window opens a new chat through its provider (IChatWindowService.openNewChat), which for the Agents window is a new-session composer. The accessibility help documents New Session in chat windows. Co-authored-by: Copilot <[email protected]>
…omposer actions or tours A new-session composer of a host of its own, such as a chat window's, keeps its drafts tracked but never becomes the active composer of the composer service, nor the target of Voice Mode as it mounts or gains focus: the global composer actions (tours, the folder and picker tryouts, onboarding targets, the workspace handoff), the workspace selection and Voice Mode keep applying to the main window's composer, so opening one does not disconnect a running Voice Mode. The Parallel Tasks tour, which points at the main window's sessions list, triggers only for a session focused in the main window, not for one in a chat window. Co-authored-by: Copilot <[email protected]>
Describe draft slots and their request lifecycle, the chat window's new-session composer as a session host, and how a slot keeps its sessions-list custom group. Co-authored-by: Copilot <[email protected]>
roblourens
previously approved these changes
Nov 7, 2026
Sandeep Somavarapu (sandy081)
dismissed
roblourens’s stale review
via
November 7, 2026 01:13
2ebb658
Sandeep Somavarapu (sandy081)
force-pushed
the
agents/chat-window-new-session
branch
from
November 7, 2026 01:13
f6654e4 to
2ebb658
Compare
…out of the list A send from a chat window's draft slot takes the slot's custom group when it is accepted and keeps it until its request ends. A session dropping out of the sessions list while the request runs, such as while its provider is replaced, cleared that group and the send's slot marker, so the started session ended up outside its source session's group. A session that drops out of the list now keeps a slot send's group; the request's end still drops it when the session does not start. Co-authored-by: Copilot <[email protected]>
…atform and test runner - The Cmd/Ctrl+N keybinding test resolves the default keybindings of macOS, Linux and Windows instead of assuming the macOS chord: Cmd+N on macOS, Ctrl+N elsewhere. - The new-session widget tests of a composer with a draft host give their harness the agent host filter, which the web reads when it checks which agents create drafts, and expect no No Workspace option on the web, which does not offer one. - The sessions list fixtures' management service provides the request events the sessions groups service now listens to, so the fixtures render again. Co-authored-by: Copilot <[email protected]>
Ladislau Szomoru (lszomoru)
approved these changes
Nov 7, 2026
Sandeep Somavarapu (sandy081)
deleted the
agents/chat-window-new-session
branch
November 7, 2026 08:55
3 tasks done
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.

What
In the Agents window, a chat window (
sessions.chatWindows.enabled) can now start a new session in place. New Session in a chat window opens an empty new-session composer as a chat tab next to the window's active chat:Entry points:
There is no title bar button. When the active chat is an unsent composer, New Session focuses it.
Defaults: the composer starts from the active chat's session: its folder (or No Workspace), agent and provider, model, mode, and Dev Container environment. The new session joins that session's custom group in the sessions list. All of these can be changed before sending.
Send: a foreground send turns the tab into the new session's main chat, in the same tab and with focus kept. The chat stays in this window, held out of the main window's grid like the window's other chats. The main window's composer and grid are untouched.
Background send (Send in Background, Alt+Enter by default): the session starts in the background and shows in the sessions list, in its group. The composer stays as is, reseeded with the same target, and shows "Message sent" with Open Session. If the background send fails, the prompt goes back into the composer when nothing changed there; otherwise a notification offers Restore Prompt and Copy Prompt.
Restore: unsent composers, with their input, come back with their window after a reload.
Moves: until its session is sent, a composer can't leave its window. Move to Main Window is disabled while the window holds an unsent composer, and moving or copying the composer to another or a new window is refused, with the reason. Once sent, the chat moves like any other.
Closing: while unsent, the composer's tab shows with its close button, also when it is alone in its group; closing it discards the draft.
Main window stays in charge of global composer features: a chat window's composer never takes the main window's tours, tryouts, onboarding targets, workspace selection or Voice Mode, so opening one doesn't disconnect a running Voice Mode.
Also included, as a separate commit: Quick input: track modifier keys in windows registered before it. The quick input tracked Alt/Cmd only in the main window and in windows registered after it was created. It is created on first use, so in a window that already existed, such as a chat window restored after a reload, Alt+Enter or Cmd+Enter in a picker acted as plain Enter. It now also tracks the windows registered before it.
Specs updated:
src/vs/sessions/SESSIONS.md(draft slots; new sessions in chat windows) andsrc/vs/sessions/SESSIONS_LIST.md(a draft slot's custom group).Commits
Commits 15 and 16 address review and CI feedback:
How to test
With
sessions.chatWindows.enabledon, in the Agents window:Validation
At the final tip, rebased on current
main(counts below were taken before commits 15 and 16; those commits were validated on their own as listed at the end):pnpm run typecheck-clientat each of the 14 commits: passed../scripts/test.sh --run <test files changed by the commit>at each commit: passed../scripts/test.sh --run <file>at the tip, all passing:voiceBridge(25) andnewChatVoiceTarget(3) also pass../scripts/test.sh --runList <affected folders>: 6402 passing, 22 pending, 0 failing.Each new test was checked to fail with its fix reverted: 101 of 102 mutations fail. The one that survives removes the line that passes the voice eligibility into the composer's options in the
NewChatWidgetconstructor; no unit test constructs a fullNewChatWidget, so that line is verified by reading the source, while the method it calls is tested.pnpm run eslint <changed files>,pnpm run valid-layers-check,pnpm run check-cyclic-dependencies: passed.git diff --check: clean.Performance, measured locally against
main: no regression. Startup and the main window's New Session are within noise, opening a chat window composer creates no extra chat widgets, 20 composer open and close cycles leak nothing, and typing in a composer writes no storage per keystroke.Commits 15 and 16:
pnpm run typecheck-clientat both; ElectronnewChatWidget246,chatWindowContribution14,sessionGroupsService75 passing; Chromium (pnpm run test-browser-no-install -- --browser chromium) the same files and all ofvs/sessions(7893 passing, 0 failing); thesessionsListTwistiePlaywright fixture tests, 34 passing; ESLint and layers check passed.Manually verified in a Code - OSS dev build:
Known issues (not addressed here)
chatWindowChangesetActions.test.tsfails when loaded together withagentMergeActions.test.tsin one test run (a pre-existing upstream issue on main).