Agent Zero AI framework
fix(sidebar): reveal children of selected subagents
Alessandro815b71778423
diff --git a/tests/test_webui_chat_deletion.py b/tests/test_webui_chat_deletion.pyindex 96ee00aed..713786e58 100644--- a/tests/test_webui_chat_deletion.py+++ b/tests/test_webui_chat_deletion.py@@ -109,6 +109,25 @@ assert(model.expandedParents.parent === true,"selection synchronization must still run for unchanged contexts",);+for (const selected of ["parent", "child", "grandchild"]) {{+ model.expandedParents = {{}};+ reset(tree.slice(0, tree.findIndex(context => context.id === selected) + 1), selected);+ assert(!model.isExpanded(selected), "a chat without children remains collapsed");+ model.applyContexts(tree);+ assert(+ model.isExpanded(selected),+ "a selected agent must reveal its children at every depth",+ );+ const expanded = model.expandedParents;+ model.applyContexts(tree);+ assert(model.expandedParents === expanded, "unchanged expansion preserves identity");+ model.toggleChildren(selected);+ model.applyContexts(tree);+ assert(+ !model.isExpanded(selected),+ "snapshot refresh must preserve manually collapsed children",+ );+}}model.expandedParents = {{}};model.setSelected("greatgrandchild");assert(diff --git a/webui/components/sidebar/AGENTS.md b/webui/components/sidebar/AGENTS.mdindex 18e48e915..79b39f3ac 100644--- a/webui/components/sidebar/AGENTS.md+++ b/webui/components/sidebar/AGENTS.md@@ -8,7 +8,7 @@- `left-sidebar.html` and `sidebar-store.js` own sidebar shell and shared state.- `top-section/` owns header and quick actions.-- `chats/` owns chat list UI and state; `chat-tree.html` is the shared parent/parallel-child row.+- `chats/` owns chat list UI and state; `chat-tree.html` is the shared parent/subagent row for direct and parallel delegation.- `tasks/` owns task list UI and state; `task-row.html` is the shared scheduler row.- `bottom/` owns lower sidebar controls and preferences panel.@@ -20,7 +20,7 @@- The shared chat tree recurses through every subordinate level, mounting children only while expanded. Selecting or restoring a descendant expands all ancestors in both list views.- Child indentation uses `--spacing-md` + `--spacing-xs` for the first two child levels, tapers at the third, and stops increasing after it, preserving room for titles and actions in narrow sidebars.- Chat tree expand/collapse controls use a parent-only leading slot, with right/down chevrons for collapsed/expanded state. Use spacing tokens for compact rows and the additional child indentation without consuming normal chat row text margin.-- A restored selected parent chat with children auto-expands once during context hydration unless the user has already toggled it.+- A selected chat with children auto-expands once during context hydration at every depth, including a selected subagent that delegates again, unless the user has already toggled it.- The Tasks list is reserved for scheduler-backed task contexts and must not be used for chat-bound parallel children.- Running parent and child chats share the chat-list working-bubble animation; keep it scoped away from task and connection-status indicators.- Chat and task lists reclaim the same part of the sidebar's left content inset so their project bubbles align, while their section headers retain the standard sidebar inset.diff --git a/webui/components/sidebar/chats/chats-store.js b/webui/components/sidebar/chats/chats-store.jsindex 0cb685b44..a8b572692 100644--- a/webui/components/sidebar/chats/chats-store.js+++ b/webui/components/sidebar/chats/chats-store.js@@ -90,9 +90,8 @@ const model = {const updated = this.contexts.find((ctx) => ctx.id === selectedId);if (updated) {if (this.selectedContext !== updated) this.selectedContext = updated;- if (updated.parent_context_id) {- this.expandAncestors(updated);- } else if (+ this.expandAncestors(updated);+ if (this.hasChildren(selectedId) &&this.expandedParents[selectedId] === undefined) {