Repository navigation
feat(frontend): render task output turns as a tree, nest subagent events - #167
Merged
xmiksay merged 1 commit intoJul 13, 2026
Merged
Conversation
What: split the flat stream-json event list on `parent_tool_use_id` and render subagent (Task-tool child) events nested under the tool_use that spawned them, recursively, instead of flattening them into the main timeline. Why: subagent events were shown inline at the top level, so a task that spawned Task-tool subagents rendered a confusing flat interleave of main and subagent work; a replayed subagent user prompt could also open a phantom turn since groupIntoTurns didn't check parent_tool_use_id. How: `splitEventTree` (useTurns.ts) does a single forward pass bucketing events into `top` and a `children: Map<parentId, events>`, tracking seen tool_use ids so grandchildren resolve via lookup; `useTaskDetail` feeds `tree.top` to `groupIntoTurns` (fixing the phantom-turn bug for free) and exposes `childEvents`; `TurnTimeline`/`ClaudeStream` forward the map down, with `ClaudeStream` recursing on itself (self-referencing `<script setup>` SFC) to render nested `<details>` blocks per subagent, without passing `pending` to nested instances so the approval widget stays on the spawning row.
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
tool_useblock that spawned them, recursively, instead of rendering flat.useTurns.tsgainssplitEventTree(events)— a single forward pass over the seq-ordered stream that harvests everytool_useid and buckets events intotop(main timeline) vschildren.get(parentToolUseId), with an orphan fallback totopwhen the parent is out of view.topbeforegroupIntoTurnsfixes a side-effect bug for free: a replayed subagent plain-textuserevent could previously open a phantom turn.useTaskDetailwireseventTree/turns/childEvents;TaskDetail.vue→TurnTimeline.vue→ClaudeStream.vueforward thechildEventsmap down.ClaudeStream.vuerecurses on itself (self-referencing<script setup>SFC) to render nestedsubagent · N eventsblocks;pendingapprovals are not forwarded to nested instances so the approval widget stays on the (unresolved) spawning Task row.TurnTimeline.vue's "N events" summary now adds the turn's transitive subagent descendant count so the number doesn't appear to shrink once children are pulled out.docs/architecture.mdfor the newsplitEventTreebehavior and theClaudeStream.vuenesting.Frontend-only — the backend already persists and delivers
parent_tool_use_idverbatim; nothing else changed.Test plan
npm run typecheck(frontend)npm test(frontend, vitest) — newsplitEventTreeunit tests (top/orphan/nested/grandchild/phantom-turn-fix) inuseTurns.test.ts, plus aClaudeStream.test.tsmount test for the nested subagent blockmake verify(Rust lint+test on both DB backends, frontend typecheck+test) — all greenCloses #164