Skip to content

sessions: fix: persist and reveal session tree state - #336446

Draft
Ulugbek Abdullaev (ulugbekna) wants to merge 3 commits into
ulugbekna/nested-session-repository-actionsfrom
ulugbekna/nested-session-tree-state
Draft

Ulugbek Abdullaev (ulugbekna) wants to merge 3 commits into
ulugbekna/nested-session-repository-actionsfrom
ulugbekna/nested-session-tree-state

Conversation

@ulugbekna

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

Copy link
Copy Markdown
Contributor

Summary

Complete existing collapse, Find, and reveal behavior in the Agents Window before adding recursive independent-session nesting. Expand/collapse, stored section/group state, and Find already exist; this PR addresses individual session branches and targets hidden by collapse or presentation limits.

This draft is part 2 of 4 and is based on #336444, not directly on main. It contains three focused commits and does not create parent/child relationships between independent sessions.

1. Remember individual session branches

Persist each session's collapsed or expanded choice across list recreation and grouping changes. Retain it when a provider temporarily removes the session from its catalog, and remove it only on definitive deletion. Validate stored values and read one snapshot per update. Collapse All includes section, group, and session branches while preserving stored choices for temporarily absent sessions.

2. Expose matches behind collapsed branches

Wait for native tree refiltering to populate match scores, then expand only collapsed ancestors of actual matching descendants. A matching parent alone does not open nonmatching children. Reconcile result focus and visibility without stealing DOM focus from the find input. Generalize the existing Collapse All write suppression into reusable batching, so opening many matching branches saves their state once rather than once per ancestor.

Search expansion uses the normal persisted branch state; this does not add a separate temporary find-expansion state. Opening an empty Find widget does not open unrelated branches.

3. Reveal sessions omitted by Show More

Distinguish sessions excluded by filters from sessions omitted only by sidebar limits. Include the active session, an explicitly requested session, and the archive-onboarding target simultaneously beyond session/workspace caps, without rewriting saved filters. Clear temporary explicit reveal state when its context changes. Preserve existing conditional scrolling for explicit reveal and add offscreen reveal to main-session selection without recentering an already-visible row.

Coverage

The shared state suite uses existing peer-chat branches, independently of the later nested-session feature. Regressions cover storage read/write counts, invalid saved state, grouping/recreation, true and false deletion entries, hidden matches in both Find modes, typing focus, viewport stability, and simultaneous cap exceptions. After the review fix and restack, the complete stack's 228 focused tests and client typecheck pass on Electron 43.6.0.

Stack

Part 2 of 4. Base: #336444. 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

Remember each session branch across list recreation and grouping changes. Retain state during transient catalog removal and remove it only on definitive deletion.

Read one validated storage snapshot per update and make Collapse All preserve section, group, and session choices without discarding absent sessions. Keep the existing bulk-write suppression; generalized search batching follows separately.

Co-authored-by: Copilot App <[email protected]>
Wait for tree refiltering, expand only collapsed ancestors of actual matches, and reconcile result focus and visibility without taking focus from the find input.

Generalize Collapse All write suppression into reusable batching so revealing many matching branches persists their expansion once rather than writing for every ancestor.

Co-authored-by: Copilot App <[email protected]>
Include active, explicitly revealed, and archive-onboarding sessions beyond session and workspace presentation limits without changing saved filters. Preserve simultaneous reveal targets and clear temporary reveal state when its context changes.

Use URI identity for explicit navigation and reveal an offscreen active session without recentering one already visible.

Co-authored-by: Copilot App <[email protected]>
@ulugbekna
Ulugbek Abdullaev (ulugbekna) force-pushed the ulugbekna/nested-session-tree-state branch from 2c183c2 to 3765663 Compare September 16, 2026 18:13
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.

1 participant