Skip to content

sessions: feat: support nested session drag-and-drop - #336448

Draft
Ulugbek Abdullaev (ulugbekna) wants to merge 1 commit into
ulugbekna/nested-session-hierarchyfrom
ulugbekna/nested-agent-sessions
Draft

Ulugbek Abdullaev (ulugbekna) wants to merge 1 commit into
ulugbekna/nested-session-hierarchyfrom
ulugbekna/nested-agent-sessions

Conversation

@ulugbekna

@ulugbekna Ulugbek Abdullaev (ulugbekna) commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Allow meaningful drag-and-drop ordering within the new independent-session hierarchy, including siblings working in different repositories and sessions moving into or out of custom groups.

This draft is part 4 of 4 and is based on #336447. It contains only the drag-and-drop increment; the preceding draft introduces the tree with conservative root-only reorder guards.

Reorder siblings without changing their creator

Require dragged sessions to share the target's displayed parent. Preserve the existing pin and group restrictions, and retain workspace scoping for ungrouped roots. Nested siblings can be reordered even when their own repositories differ.

Apply ordering through the existing list-owned sort-key service. This does not rewrite provider timestamps or creator references, move files, change repositories, or permit arbitrary reparenting.

Make group-drop feedback describe the resulting tree

Joining or leaving a custom group can change whether a session appears beneath its creator. Build a hypothetical hierarchy for that membership change before deciding whether a before/after position is valid. Joining a group also models the unpinning performed by the real operation.

If the dragged sessions and target will be siblings, permit positional insertion. Otherwise, retain the valid group-membership operation but omit the positional cue rather than promising an impossible placement. Drag feedback and the drop use the same target-resolution rules.

Reuse the hypothetical hierarchy while the current hierarchy, dragged session objects/order, and destination group remain unchanged. Normal list updates invalidate this short-lived preview cache; it is not persisted parent state.

Preserve requested positions through presentation limits

A newly grouped, older session may initially sort behind Show More before its new position is assigned. Include the explicitly dragged sessions alongside visible candidates, then restrict them to the applicable sibling/pin/group/workspace scope. Preserve the dragged block's relative order when assigning sort keys, rather than silently skipping an incoming session hidden by the cap.

Coverage

Regressions cover cross-repository sibling reorder, rejected cross-branch reorder, prospective sibling versus parent/unrelated group-drop outcomes, and an incoming root whose old sort key places it beyond the destination cap. After the review fix and restack, the complete stack's 228 focused tests and client typecheck pass on Electron 43.6.0.

For manual review, reorder two children of the same parent, try a cross-branch reorder, move creator-linked sessions between groups, and move an older session before a visible row in a capped group. The drop cue should agree with the resulting position; unsupported positions must remain membership-only.

Stack

Part 4 of 4. Base: #336447. All PRs are drafts; review and merge bottom-up. Original commit labels are retained below; PR 1 also contains its test-only review follow-up.

Order PR Original commits Scope
1 #336444 1 + regression-test follow-up Repository action boundaries
2 #336446 2-4 Session state, Find, and reveal
3 #336447 5 Independent-session hierarchy
4 #336448 6 Nested session drag-and-drop

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.

Copilot review overview

🟡 Changes recommended

Keyboard-accessible reordering and positive creator-linked ungrouping coverage are missing.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds hierarchy-aware drag-and-drop ordering for nested sessions.

Changes:

  • Reorders sessions only among displayed siblings.
  • Models group changes before showing positional feedback.
  • Preserves positioning for dragged sessions hidden by presentation caps.
File Description
src/​vs/​sessions/​SESSIONS_LIST.md Documents sibling reordering.
src/​vs/​sessions/​contrib/​sessions/​browser/​views/​sessionsList.ts Implements hierarchy-aware drop validation and ordering.
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​sessionsList.test.ts Adds group-drop, cap, and sibling-reorder regressions.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +4004 to +4005
const targetParent = parentByChildSessionId.get(target.sessionId);
if (dragged.some(session => parentByChildSessionId.get(session.sessionId) !== targetParent)) {
Comment on lines 2151 to +2152
for (const relationship of ['unrelated', 'siblings', 'parent'] as const) {
test(`keeps ${relationship} creator-linked group moves non-positional`, () => {
test(`uses prospective ${relationship} relationships for group-drop positioning`, () => {
@ulugbekna
Ulugbek Abdullaev (ulugbekna) force-pushed the ulugbekna/nested-session-hierarchy branch from f08f0e2 to 203821a Compare September 16, 2026 18:22
Reorder siblings across repositories, evaluate prospective hierarchy when changing groups, and preserve positional insertion for incoming sessions beyond presentation caps. Keep unsupported group moves membership-only.

Co-authored-by: Copilot App <[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