Chat sidebar: nest sessions into a parent→children tree (drag-and-drop) - #305
Open
arsenmuk wants to merge 2 commits into
Open
Chat sidebar: nest sessions into a parent→children tree (drag-and-drop)#305arsenmuk wants to merge 2 commits into
arsenmuk wants to merge 2 commits into
Conversation
Reuse the existing sessions.parent_session_id column (v003) as a display
hierarchy: drag one session row onto another to nest it as a child. A parent
shows an expand/collapse chevron in place of its icon and its children render
indented — unbounded depth, the client draws exactly the hierarchy the server
returns. Children nest wherever the parent renders, including the pinned
Starred group. Archived/System stay in their own groups, untouched.
Un-parent via the row menu "Remove from parent" or by dropping a nested row
onto the "remove from parent" strip that appears while dragging one. Expand
state persists in localStorage; the active session's ancestors auto-expand so
it is never hidden inside a collapsed parent.
Backend: PATCH /api/sessions/{id} now accepts parent_session_id (null clears
it), guarded against self-parent, unknown parent, cycles, and the 'created'
fork window so a display drag never turns a not-yet-started session into a
fork. parent_session_id already rides in the feed payload (SELECT *), so an
unlimited page size shows the full tree.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mirror the GroupHeader counter — a collapsed parent row badges its direct-child count (faint, right of the title), hidden again once expanded. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Adds a parent→children hierarchy to the chat session sidebar, built on the existing
sessions.parent_session_idcolumn (no schema change).What you can do
localStorage; the active session's ancestors auto-expand so it's never hidden. Existing forks (which already setparent_session_id) nest automatically.Server
PATCH /api/sessions/{id}now acceptsparent_session_id(nullclears it → top-level), guarded against self-parent, unknown parent, cycles, and thecreatedfork window so a display drag can never turn a not-yet-started session into a fork.Drag-and-drop uses native HTML5 DnD (no new dependency). Tests:
tests/test_session_parent_patch.py(set / clear / self / unknown / cycle / fork-window / deep-chain); frontendtsc -b+ build clean.Stacked on #269 (its branch is this PR's base until it merges).
🤖 Generated with Claude Code