feat: display subagent sessions as collapsible tree with cost roll-up#360
Merged
Conversation
Persist parent-child session relationships (migration v26) and render subagent sessions as collapsible tree rows in all dashboard session tables. Parent rows show combined cost (own + children) and a toggle to expand/collapse child rows. - Add parent_session_id and is_subagent columns to session_state - Resolve x-parent-session-id header to Lore internal ID via headerSessionIndex - Persist isSubagent and parentSessionId immediately on detection - Restore parent-child relationships across gateway restarts - Build tree structure in buildLiveSessionRows() with cost roll-up - Render collapsible rows with toggle, indentation, and child count - Apply to all session tables: costs, warming, project detail pages
- Search full headerSessionIndex for parent resolution (not just Tier 1) - Re-attempt resolution on subsequent requests when parent is pending - Log warning when parent resolution fails (Tier 3 limitation) - Sort preserves parent-child row adjacency (treats tree as unit) - Filter respects tree structure (matching child shows parent) - Recursive cost roll-up and rendering for multi-level nesting - Deduplicate loadParentChildMap() calls (compute once per page) - Warming page stats include subagent children in counts - Replace unsafe 'as' cast with proper SessionState type import
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.
Summary
parent_session_id+is_subagentcolumns onsession_state)x-parent-session-idheader value to Lore internal session ID viaheaderSessionIndexlookup at detection time(+N subagents)indicator↳prefix and indentation on toggle clickFiles Changed
packages/core/src/db.tsloadParentChildMap()querypackages/core/src/index.tsloadParentChildMappackages/gateway/src/translate/types.tsparentSessionIdtoSessionStatepackages/gateway/src/pipeline.tspackages/gateway/src/ui.tspackages/core/test/db.test.tsHow to Test
/ui/costs— subagent sessions should appear nested under their parent with a ▶ toggle↳prefix/ui/warmingand/ui/projects/:idpages