Skip to content

sessions: let the provider own nested session order; stop saving it in the list - #342849

Merged
Sandeep Somavarapu (sandy081) merged 1 commit into
mainfrom
agents/investigate-drag-and-drop-reset-issue
Oct 20, 2026
Merged

Sandeep Somavarapu (sandy081) merged 1 commit into
mainfrom
agents/investigate-drag-and-drop-reset-issue

Conversation

@sandy081

Copy link
Copy Markdown
Member

What

The sessions provider is now the only owner of the order of a session's nested sessions (peer chats). This removes the list-owned nested chat order added in #342591 and keeps the rest of #342591 as it is: placement drops, archive and unarchive, pin and unpin, and date headers.

  • ISessionsListModelService drops getChatOrder, setChatOrder and clearChatOrder, the ChatOrder change kind, and the sessionsListControl.chatOrder persistence.
  • On startup the service removes the retired sessionsListControl.chatOrder key (PROFILE scope). The removal is idempotent and works like the other retired list keys, so stale orders, including ones Settings Sync synced, are dropped.
  • Nested rows render in the provider's session.chats order. Sort by Updated still sorts them by update time, as before.
  • Nested-chat drops go through the provider only. A chat the provider can't move, or several chats dragged together, gets no drop feedback and isn't accepted, as before sessions: extend sessions list drag and drop across placements #342591.
  • Move Up and Move Down use only the provider path. The context menu items and the keybindings are available only when the provider can move the chat one row in that direction. The keybinding now requires sessionChatItem.canMoveUp / canMoveDown, which are bound for the focused nested chat.
  • Block 5's provider-order anchors are unchanged. With no list-owned order, the rows show the provider's order under Sort by Created, so the drop line and the anchor agree.
  • SESSIONS_LIST.md and the Agents window accessibility help are updated.

Why: the reorder "reset"

Dragging a nested session to reorder it within its session sometimes snapped back to the old order, even with Sort by Created. The order had two owners:

  1. sessions: extend sessions list drag and drop across placements #342591's list-owned order. Drops of chats the client didn't consider provider-movable stored a full snapshot of the rendered rows per session, and the list applied it on top of the provider order. That covers chats the host doesn't report as movable, multi-row drags, and chats of sessions whose state isn't subscribed, whose summaries carry no movable.
  2. The provider's order. Every provider move (runMove) cleared the list-owned order first, so all earlier list-owned placements snapped back to the provider's order. Block 5 also anchors provider moves in the provider's order, so while a list-owned order was shown, the moved chat landed somewhere other than the drop line.

Evidence from an Insiders log investigation (no private data):

  • The host applied and persisted every reorder.
  • The client received each session/chatsReordered, and its chat set matched the action (same count, no chats added or removed in between), so the protocol reducer applied it.
  • Settings Sync logged the sessionsListControl.chatOrder key being added by list-owned drops and removed by each provider drag, in the same session.
  • A DOM repro showed the reset. In a session a fixed c d e where fixed can't be moved by the provider, dragging fixed below d (list-owned) and then e above c (provider) rendered a fixed e c d: fixed snapped back.

Follow-ups (out of scope)

  • Let the provider reorder chats within their own session when they are structurally movable but refused for cross-session moves (shared worktree, Agent Merge owner). The host's same-session reorder only checks structural movability.
  • Carry movable in root session summaries, so nested sessions of unsubscribed sessions can be reordered.

How to test

  1. In the Agents window, turn on moving chats by drag and drop and use a session with several nested sessions, with Sort by Created.
  2. Drag a nested session between others repeatedly. Each drop stays where it was dropped and never snaps back.
  3. Drag a nested session the provider can't move. There is no drop line and nothing changes.
  4. Use Move Up and Move Down (keyboard or context menu) on a movable nested session. They move it through the provider. They aren't offered for one that can't move.

Validation

Command Result
./scripts/test.sh --run src/vs/sessions/contrib/sessions/test/browser/sessionsListChatMoveDnd.test.ts --run src/vs/sessions/services/sessions/test/browser/sessionsListModelService.test.ts Passed: 74 passing
./scripts/test.sh --reporter dot --runGlob "vs/sessions/**/test/browser/**/*.test.js" (all sessions browser tests, including sessionsList.test.ts and the DnD suite) Passed: 7042 passing, 22 pending
npm run typecheck-client Passed
npm run eslint -- <changed .ts files> Passed: 8 files, no problems
npm run precommit (hygiene on the staged files; also ran in the commit hook) Passed: 8 files
npm run transpile-client Passed

New or changed tests:

  • Regression: provider reorders after earlier moves render where they were dropped.
  • Regression: in a mixed session, a non-movable chat isn't dropped, so a movable sibling's reorder keeps the arrangement.
  • No chatOrder storage is written on any drag, checked against the real list model service and storage.
  • The startup cleanup removes an existing key, idempotently.
  • Move Up and Move Down are available only for provider-movable chats, including the keybinding when-clause.
  • Removed sessions: extend sessions list drag and drop across placements #342591's list-owned order tests.

Not run: smoke and integration tests, and a manual pass in a dev build.

…n the list

The sessions list kept its own order of a session's nested chats (#342591) next to the order the sessions provider owns. Chats the provider could not move were reordered in the list-owned order, and every provider move then cleared it, so earlier arrangements snapped back. Provider moves were also anchored in the provider's order while the rows showed the list-owned one.

Nested chats now render in the provider's order only. A nested chat its provider can't move is not accepted as a drop, Move Up and Move Down are available only for chats the provider can move, and the persisted sessionsListControl.chatOrder key is removed on startup.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 20, 2026 10:45
@sandy081 Sandeep Somavarapu (sandy081) added this to the 1.144.0 milestone Oct 20, 2026
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Ladislau Szomoru (@lszomoru)

Matched files:

  • src/vs/sessions/services/sessions/browser/sessionsListModelService.ts
  • src/vs/sessions/services/sessions/test/browser/sessionsListModelService.test.ts

@github-actions

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: c1586334 Current: 3ba72359

Changed (1)

sessions/sessionsList/SessionsList_ArchivedNestedChatMenu/Light
Before After
before after

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.

🟢 Approval recommended

No actionable defects remain, and focused regression coverage supports the ownership change; reported validation was not independently rerun.

No open issues 🎉

What changed in this PR

Makes providers the sole owner of nested-chat ordering in the Agents window, removing the competing list-owned state that caused reorder resets.

Changes:

  • Removes nested-chat order persistence and cleans up the retired storage key.
  • Routes reordering exclusively through providers and gates move actions accordingly.
  • Adds regression coverage and updates documentation and accessibility help.
File Description
src/​vs/​sessions/​SESSIONS_LIST.md Documents provider-owned nested-chat ordering.
src/​vs/​sessions/​services/​sessions/​test/​browser/​sessionsListModelService.test.ts Tests idempotent storage cleanup.
src/​vs/​sessions/​services/​sessions/​browser/​sessionsListModelService.ts Removes chat-order APIs and persistence.
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​sessionsListTestUtils.ts Removes obsolete chat-order mocks.
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​sessionsListChatMoveDnd.test.ts Covers provider reordering, storage writes, and move availability.
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​sessionsList.test.ts Removes list-owned ordering tests.
src/​vs/​sessions/​contrib/​sessions/​browser/​views/​sessionsViewActions.ts Gates keybindings on directional move availability.
src/​vs/​sessions/​contrib/​sessions/​browser/​views/​sessionsList.ts Uses provider ordering and provider-only moves.
src/​vs/​sessions/​contrib/​chat/​browser/​sessionsChatAccessibilityHelp.ts Clarifies when move actions are available.

Review effort: Balanced

@sandy081
Sandeep Somavarapu (sandy081) merged commit 2fa03eb into main Oct 20, 2026
68 of 93 checks passed
@sandy081
Sandeep Somavarapu (sandy081) deleted the agents/investigate-drag-and-drop-reset-issue branch October 20, 2026 11:16
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.

4 participants