Repository navigation
sessions: move chats and sessions by drag and drop in the sessions list - #342624
Merged
Sandeep Somavarapu (sandy081) merged 17 commits intoOct 19, 2026
Merged
Sandeep Somavarapu (sandy081) merged 17 commits into
Sandeep Somavarapu (sandy081) merged 17 commits into
Conversation
Move Chats Block 5, part 1 (backend wiring for the sessions list). - IAgentConnection.moveChat: a typed client for the AHP moveChat command. - ISessionsProvider.canMoveChat/moveChat/canMoveSessionUnder/moveSessionUnder, required: the agent-host provider moves its movable chats and single-chat sessions; other providers say they can't. - ISessionsManagementService routes moves to the owning provider, by the provider's own session and chat objects (never derived from a URI). - Host refusals (AgentChatMoveRefusal) map to localized messages. - A subscribed session's catalog reorder notifies session lists, so the list shows the new order. - A session that ends by moving its shown chat under another session gives its slot to that session instead of opening another pane. Co-authored-by: Copilot <[email protected]>
Move Chats Block 5, part 1. Gated on chat.agentHost.moveChats.enabled and AI features being enabled. The sessions list is the only drag and drop surface for moves; chat tabs don't move chats. Dragging a chat row of the list: - between or beside the chat rows of its own session reorders it there (anchored in the session's chat order; a drop that leaves that order as it is does nothing); - between or beside the chat rows of another session moves it there; - onto another session's row appends it to that session; - onto empty space, a header, or between top-level session rows moves it into a new session. Dragging a single-chat session onto another session's row moves it into that session; other session drags keep their pinning and grouping behaviour. Only another started, unarchived, multi-chat session of the same provider accepts a move, and only movable chats can be dragged. A failed or refused move shows why; a successful one shows nothing beyond the list's new order and is announced to screen readers. Co-authored-by: Copilot <[email protected]>
Like the Explorer's explorer.confirmDragAndDrop, moving a chat into another session, into a new session, or a session into another session asks first, with a Move button and "Do not ask me again". Reordering chats within a session is never confirmed. The new chat.agentHost.moveChats.confirmDragAndDrop setting (default true, a workbench preference with no policy) controls it; the checkbox turns it off. Co-authored-by: Copilot <[email protected]>
- Check drop targets in the same order on drag over and on drop, so the feedback matches the result. - A move confirmed with "Do not ask me again" happens even when the setting can't be saved (the failure is logged). - Show the stronger move feedback (insertion line, outlined row or list) only while a chat or session move is the drop; pin, group and reorder drags look as before. - Resolve the dragged chat once when its drag starts, and check the enabled gate before the destination. - Remove the duplicate canMoveSessionUnder/moveSessionUnder declarations on IAgentHostSessionsProvider, now on ISessionsProvider. Co-authored-by: Copilot <[email protected]>
After hands-on testing, dropping onto a session needed too much precision. The sessions list now behaves like the Files Explorer: - A nested session dropped anywhere on a session's row moves to the end of that session. The row and its shown nested rows highlight as one block, and a collapsed session expands after a moment, so the drop can go between its nested rows. - On a nested session's row, the top half places it before that row and the bottom half after it, with an insertion line, within its own session or in another. - Only empty space and headers move it into a new session; a session row's edges no longer do. - A single-chat session dropped anywhere on a normal session row nests in it. On pinned and grouped rows the edges keep reordering, pinning and grouping sessions, and only the middle nests. Co-authored-by: Copilot <[email protected]>
The context menu of a nested session offers Promote to Session, which moves it into a new session like dropping it on the list's empty space: it asks first (unless chat.agentHost.moveChats.confirmDragAndDrop is off) and explains a refusal. It shows only while moving chats is on, AI features are enabled and the provider can move the chat; never for a session's main chat. Co-authored-by: Copilot <[email protected]>
Dragging a single-chat session over a pinned or grouped session row flickered between nesting and reordering at the row's quarter boundaries, and could drop as a reorder unexpectedly. Like the Explorer everywhere, the whole row now nests the session whenever it can move under that session, with the block highlight and auto-expand. Reordering, pinning and grouping apply where it can't, and on the Pinned, group and section headers as before. Tests: the auto-expand test runs on virtual time, a test covers the nested session context menu's sessionChatItem.canMove key, and sessions get distinct creation times so the list's order is stable. Co-authored-by: Copilot <[email protected]>
With every session row nesting a dropped session, sessions in Pinned and custom groups, which the user orders by hand, couldn't be placed between expanded trees. Dragging a session that can nest there now: - on the top quarter of a session's row places it before that session, and on the bottom quarter of the section's last row (a collapsed session's row, or the last tree's last nested row) after the section's last session, as the list reorders, pins and groups sessions; with a clear insertion line; - elsewhere on a session's row still moves it into that session; - on another session's nested row moves it into that session before or after that row (top or bottom half), like a chat, after confirming. Elsewhere session rows only nest, and a session that can't nest keeps the list's own behaviour. Insertion lines among nested rows start at their indent, so they differ from lines placing a session between sessions. The sessions list now reads the pointer's quarter of a row from its position in the row: the list's own sector is relative to the element under the pointer (e.g. a row's title), which made a pointer low on a row read as its top. Co-authored-by: Copilot <[email protected]>
Review r3 and live test follow-ups for dragging chats and sessions in the sessions list: - The last row of a section, below which a session is placed after the section's last session, is the last row the list shows: rows a find filter hides don't count. - Positions among a session's nested rows are anchored in the order of the session's chats, not the order the list shows them in (e.g. by update time), for chats and sessions alike. - The top quarter of a session row in Pinned or a custom group places a session before it only where the list accepts that placement; elsewhere it nests the session. - What a drop needs from the list (whether the section is ordered by hand, whether a row is its last one, whether a placement is accepted) is asked only when needed, not on every drag over, and the chat rows aren't collected at all. - A session of another agent of the same provider (e.g. Claude for a Copilot chat) no longer accepts a drop: the client rejects it before the host would, with no feedback and no dialog. Co-authored-by: Copilot <[email protected]>
A move announced "Chat moved to X" when the view followed the moved chat, and the move itself then announced what moved where. The view no longer announces: the move is announced once, by what made it. Co-authored-by: Copilot <[email protected]>
Promote to Session moves the nested session out of its session, unlike the chat's other actions (Rename, Open to the Side), so it gets its own group between them and Delete, with separators on both sides. Co-authored-by: Copilot <[email protected]>
The host now refuses moving a chat or session between sessions that use different accounts' credentials (differentCredentialOwner); the sessions list explains it like its other move refusals. Co-authored-by: Copilot <[email protected]>
Under "Sort by Updated" the sessions list orders nested sessions by their last activity, so a chat moved into a session can land below the view, far from where it was dropped. After a move started from the list (a chat into another session, a reorder, a whole session into another, a chat into a new session by drop or by Promote to Session), the list now scrolls to the moved chat's row, or the new session's row, and selects it, without moving focus. It follows where the provider reports the chat went, and gives up when the row doesn't show within a few updates or a few seconds, or when a later move is watched. Co-authored-by: Copilot <[email protected]>
A move that failed unexpectedly showed "Could not move '{0}'. {message}",
where the message can be a host's stack trace with file paths. Refusals the
providers can explain now reject with SessionMoveRefusedError and keep their
localized reason; anything else shows "Could not move '{0}'." and logs the
details.
Co-authored-by: Copilot <[email protected]>
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Ladislau Szomoru (@lszomoru)Matched files:
Anthony Kim (@anthonykim1)Matched files:
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Valid-looking drops can fail on hidden anchors, and filtered move results can remain invisible despite reported reveal success.
2 open issues
What changed in this PR
Adds opt-in drag-and-drop moves to the Agents window’s sessions list, building on existing host-side move operations.
Changes:
- Supports chat reordering, cross-session moves, nesting, and promotion.
- Adds confirmations, localized refusal messages, accessible announcements, and post-move selection.
- Extends provider contracts and tests for routing and list interactions.
| File | Description |
|---|---|
| src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.ts | Forwards chat moves. |
| src/vs/workbench/contrib/terminal/test/browser/agentHostPty.test.ts | Updates connection mock. |
| src/vs/sessions/services/sessions/test/browser/sessionsManagementService.test.ts | Tests routing and pane continuity. |
| src/vs/sessions/services/sessions/test/browser/sessionNavigation.test.ts | Updates management mock. |
| src/vs/sessions/services/sessions/common/sessionsProvider.ts | Defines provider move contracts. |
| src/vs/sessions/services/sessions/common/sessionsManagement.ts | Exposes management move APIs. |
| src/vs/sessions/services/sessions/browser/sessionsService.ts | Preserves moved-chat pane placement. |
| src/vs/sessions/services/sessions/browser/sessionsManagementService.ts | Routes moves through owning providers. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsListTestUtils.ts | Updates list test helpers. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsListContextMenu.test.ts | Tests promotion menu behavior. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsListChatMoveDnd.test.ts | Tests drops, feedback, confirmations, and reveal. |
| src/vs/sessions/contrib/sessions/browser/views/sessionsListChatMove.ts | Implements drop decisions and move feedback. |
| src/vs/sessions/contrib/sessions/browser/views/sessionsList.ts | Integrates dragging and post-move reveal. |
| src/vs/sessions/contrib/sessions/browser/sessionsActions.ts | Adds Promote to Session. |
| src/vs/sessions/contrib/sessions/browser/media/sessionsList.css | Styles move drop indicators. |
| src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsProvider.ts | Explicitly refuses unsupported moves. |
| src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts | Tests move routing and reorder notifications. |
| src/vs/sessions/contrib/providers/agentHost/test/browser/agentHostChatMoveErrors.test.ts | Tests localized refusal mapping. |
| src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts | Implements chat moves and catalog notifications. |
| src/vs/sessions/contrib/providers/agentHost/browser/agentHostChatMoveErrors.ts | Maps host refusals to user messages. |
| src/vs/sessions/contrib/providers/agentHost/AGENT_HOST_SESSIONS_PROVIDER.md | Documents chat move routing. |
| src/vs/sessions/contrib/chat/test/browser/sessionWorkspacePicker.test.ts | Updates provider mock. |
| src/vs/sessions/common/agentHostSessionsProvider.ts | Inherits shared session-move contracts. |
| src/vs/platform/agentHost/electron-browser/localAgentHostService.ts | Forwards local chat moves. |
| src/vs/platform/agentHost/common/agentService.ts | Adds typed connection move API. |
| src/vs/platform/agentHost/common/agentHostStarter.config.contribution.ts | Registers confirmation preference. |
| src/vs/platform/agentHost/common/agentHostChatMove.ts | Defines confirmation setting identifier. |
| src/vs/platform/agentHost/browser/nullAgentHostService.ts | Adds unsupported move implementation. |
| src/vs/platform/agentHost/browser/agentHostProtocolClient.ts | Sends protocol chat-move requests. |
Review effort: Balanced
Contributor
|
Base:
|
…nd anchors - After a move, the list clears a find filter that hides the moved row, so it can reveal and select it, keeping focus where it was. - A chat appended to a session is placed after its last chat that is neither a subagent nor a hidden chat; the host refuses a hidden anchor. - The drop tests' sessions are updated when created, so "Sort by Updated" shows them in a stable order (it tied in WebKit). Co-authored-by: Copilot <[email protected]>
SessionsList now injects IChatEntitlementService for the move DnD gate, so the component fixtures failed to render (UNKNOWN service chatEntitlementService). Co-authored-by: Copilot <[email protected]>
Bhavya U (bhavyaus)
previously approved these changes
Oct 19, 2026
The nested chat context menu now evaluates canMoveChat, which the fixture's mock management service didn't implement, so SessionsList_ArchivedNestedChatMenu failed to open its menu. Co-authored-by: Copilot <[email protected]>
Dmitriy Vasyura (dmitrivMS)
approved these changes
Oct 19, 2026
Sandeep Somavarapu (sandy081)
deleted the
agents/move-chats-drag-and-drop-implementation
branch
October 19, 2026 19:39
Benjamin Christopher Simmonds (benibenj)
added a commit
that referenced
this pull request
Oct 19, 2026
…drop-session-grouping-improvements Combine the placement-based session drops with moving chats and sessions by drag and drop (#342624): provider moves take precedence for chats and single sessions the provider can move, and the list's own placement handles everything else. The provider owns the order of chats it can move, so a provider move clears the list-owned chat order of the sessions involved, and Move Up/Move Down reorder movable chats through the provider like dragging does. Co-authored-by: Copilot <[email protected]>
This was referenced Oct 22, 2026
Sandeep Somavarapu (sandy081)
added a commit
that referenced
this pull request
Oct 29, 2026
…and environment sections (#344939) * Sessions: reorder sessions by drag and drop in workspace, repository and environment sections With Move Chats drag and drop on, dropping a session on another session's top edge (or the bottom edge of a section's last row) only placed it in Pinned and custom groups; in workspace, repository and environment sections every edge nested it into the target session. Treat those sections as manually ordered too, as the list's reorder scope already does. Date sections keep nesting on every edge. Regressed in #342624. Co-authored-by: Copilot <[email protected]> * sessions: cover edge placement in repository and environment sections 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.

Move Chats, Block 5: move chats and sessions by drag and drop in the Agents window's sessions list. Builds on Block 4 (#341788) and its follow-ups (#342047, #342144, #342546, #342548), which added the host-side
moveChatcommand andvscode/moveSession.Everything is behind
chat.agentHost.moveChats.enabled(default off) and AI features being enabled.What it does
The sessions list is the only drag-and-drop surface for moves, and drops work like folders in the Files Explorer.
explorer.confirmDragAndDrop. It asks before a move into another session, a promote, or a whole-session move, never for a reorder, with Move and "Do not ask me again". The new settingchat.agentHost.moveChats.confirmDragAndDrop(defaulttrue) is a workbench UX preference with no policy.differentCredentialOwner). An unexpected failure shows only "Could not move '…'." and logs the details, so host stack traces never reach the UI.IAgentConnection.moveChat;ISessionsProvider.canMoveChat/moveChat/canMoveSessionUnder/moveSessionUnder, with explicit refusals from non-supporting providers;SessionMoveRefusedErrorfor user-facing refusals;UX decisions (from the user)
chat.agentHost.moveChats.confirmDragAndDrop. No dialog for a reorder.1_move).How to test
"chat.agentHost.moveChats.enabled": trueand open the Agents window with local agent-host (Copilot) sessions.false.Validation
All commands ran in the PR worktree with
COPILOT_*unset.npm run typecheck-clientnpm run eslint -- <the branch's changed .ts files>node build/hygiene.ts <the branch's changed files>npm run transpile-client./scripts/test.sh --reporter dotwith--runfor everysrc/vs/sessions/contrib/sessions/test/browser/*.test.ts,localAgentHostSessionsProvider.test.ts,agentHostChatMoveErrors.test.ts,sessionsManagementService.test.ts,sessionNavigation.test.ts,agentHostProtocolClient.test.tsThe tests are mostly DOM-level against the real
SessionsList. They cover:Reviews: four independent review rounds (initial, final, r2, r3). The first was FIX-FIRST (small); all its items are fixed. The final, r2 and r3 were SHIP. r3's MED (the find filter vs. the section's last row) and its LOWs (lazy per-dragover work, catalog-order anchors, the placement fallback, test gaps) are fixed in this PR.
Perf: NO REGRESSION. All added work is scoped to a user action (a drag or a drop) or to a real catalog reorder of a subscribed session. There's no per-row, per-render, startup or listener cost. Per-dragover work is O(chats in one session) and computed lazily. Host timings: reorder ~9 ms, move ~30 ms, promote ~57 ms, whole-session move ~17 ms.
Live test (isolated profiles, real Copilot, plus Claude and Codex sanity):
differentCredentialOwner: they need other agents enabled or two accounts. Both are covered by unit tests.chat.disableAIFeatures: the Agents window doesn't run with AI features disabled (it shows its "Enable AI Features" dialog). The existing gates are unchanged.Real data: PASS with findings, on a read-only sandboxed snapshot of real Agents data: 767 sessions and 1,298 chats; 623 sessions are listed.
sessionArchived,notSingleChat) changed nothing.Known follow-ups (not in this PR)
copilotSessionSandbox._updateConfigwhile reattaching a moved chat's SDK session; no visible effect.is_readNULL row for the moved default chat (read as "read").jsonRpcErrorFromsendserr.stackto clients.