Repository navigation
Add subagent tree visualization for agent feed (#3932) - #3964
austinywang wants to merge 54 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughBuilds an agent-tree feature: captures/sanitizes hook metadata, computes WorkstreamAgentGraphSnapshot from items, enriches CLI events with agent-graph fields, renders a collapsible Feed agent-tree, and wires async, cancellable graph builds with tests and localization. ChangesAgent Tree Visualization
Sequence Diagram(s)sequenceDiagram
participant Store as WorkstreamStore
participant ViewModel as FeedPanelViewModel
participant Worker as FeedAgentGraphBuildWorker
participant Builder as WorkstreamAgentGraphBuilder
participant View as FeedAgentTreeView
Store->>ViewModel: notify items updated
ViewModel->>ViewModel: scheduleAgentGraphRebuild
ViewModel->>Worker: snapshot(from: items)
Worker->>Builder: compute snapshot(from: items)
Builder->>Worker: return WorkstreamAgentGraphSnapshot
Worker->>ViewModel: return snapshot
ViewModel->>View: publish agentGraphSnapshot
View->>View: flatten roots respecting collapsedNodeIds
View->>View: render rows with status icons and chips
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR adds a Tree feed mode that derives a subagent hierarchy from existing workstream items, plumbs workspace and sanitized extra metadata through the stack, and introduces a graph builder that reconciles explicit parent/child links with
Confidence Score: 4/5Safe to merge; all previously-flagged spawn-pruning, debounce, and allowlist issues are addressed, and no new auth or data-loss paths are introduced. The metadata pipeline, background graph builder, and keyboard bridge are correctly structured. One structural issue remains: Sources/Feed/FeedPanelView.swift — Important Files Changed
Sequence DiagramsequenceDiagram
participant Store as WorkstreamStore
participant VM as FeedPanelViewModel
participant Worker as FeedAgentGraphBuildWorker (actor)
participant Builder as WorkstreamAgentGraphBuilder
participant View as FeedListView (body)
participant Controller as FeedAgentTreeController
participant Bridge as FeedKeyboardFocusBridge (NSView)
Store->>VM: onChange (arm/observation)
VM->>VM: applyStoreObservationSnapshot()
note over VM: items changed?
VM->>VM: scheduleAgentGraphRebuildIfNeeded()
note over VM: isAgentTreeActive? set pendingRequest
VM->>Worker: await snapshot(from: items)
Worker->>Builder: snapshot(from:) [cooperative thread]
Builder-->>Worker: WorkstreamAgentGraphSnapshot
Worker-->>VM: snapshot (main actor hop)
VM->>VM: completeAgentGraphBuild()
VM-->>View: agentGraphSnapshot updated (observed)
View->>View: body re-render
View->>Controller: visibleSnapshot(from: agentGraphSnapshot)
Controller-->>View: FeedAgentTreeVisibleSnapshot (rows + focusTargets)
View->>Bridge: updateNSView (closures with visibleAgentTree)
Bridge->>View: onMoveSelection(delta) [keyboard event]
View->>Controller: move(in: visibleAgentTree.focusTargets, delta:)
Controller-->>View: FeedAgentTreeSelectionEffect
View->>View: applyAgentTreeSelectionEffect()
Reviews (32): Last reviewed commit: "fix: retry feed focus registration when ..." | Re-trigger Greptile |
…ree-viz # Conflicts: # Sources/Feed/FeedPanelView.swift
|
You're iterating quickly on this pull request. To help protect your rate limits, cubic has paused automatic reviews on new pushes for now—when you're ready for another review, comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ab8f6a6. Configure here.
| else { return } | ||
| for key in graphKeys + genericKeys + ["prompt", "message"] { | ||
| copyValue(toolInput[key], key: key) | ||
| } |
There was a problem hiding this comment.
CLI copies child model to parent extra fields
Medium Severity
When a spawn tool's raw hook payload lacks a top-level model but the tool input contains one, copyAgentGraphMetadata copies the child's model from tool input into the event dict's top-level model key (since event["model"] is still nil after the first rawObject loop). On the receiver, this becomes part of extraFieldsJSON. The graph builder's sessionModel for spawn tools reads extra["model"], so it incorrectly assigns the child's model to the parent session. The tool input model is already available separately via WorkstreamPayload.toolUse's toolInputJSON, making this copy both redundant and harmful.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit ab8f6a6. Configure here.


Closes #3932
Proposal
This issue leaves the source of truth and surface open, so this PR takes a first-pass slice through the existing Feed workstream path rather than adding a second live agent store. Agent hook events already carry session, workspace, status, tool-use, and focus metadata; the Feed now derives a tree snapshot from those immutable workstream items.
First-pass change
WorkstreamItemso explicit parent/child IDs can flow through from agents that emit them.WorkstreamAgentGraphBuilderthat links explicit parent metadata and represents Task/Agent tool-use events as spawn-request child nodes when no child session ID is known yet.FeedJumpResolver.Notes
This intentionally does not introduce a dedicated cross-workspace graph store yet. A later SDK/harness event can feed the same metadata keys (
parent_workstream_id,child_workstream_id,subagent_type,model) and the UI will upgrade from spawn requests to concrete child session nodes.Note
Medium Risk
Medium risk because it introduces a new agent-graph derivation pipeline and persists additional sanitized metadata (
workspaceId/extraFieldsJSON) that influences UI linking and spawn pruning logic.Overview
Adds a new Feed “Tree” mode that renders an expandable agent/subagent hierarchy with status/model/type chips, keyboard navigation, scroll-to-selection, and click-to-jump into the associated workstream.
Plumbs additional metadata through the pipeline: the CLI now copies parent/child/model/subagent fields into feed events,
WorkstreamItempersistsworkspaceIdplus a sanitizedextraFieldsJSON, andFeedCoordinatorincludesworkspace_id/extra_fieldswhen serializing items.Introduces
WorkstreamAgentGraphBuilder(plus spawn-tool detection) to derive aWorkstreamAgentGraphSnapshotby linking explicit parent/child metadata and representingTask/Agenttool uses as pending spawn nodes, with pruning rules to avoid duplicating resolved children; adds focused unit tests and new EN/JA localization strings for the tree UI.Reviewed by Cursor Bugbot for commit ab8f6a6. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Adds a Tree view to the Feed to visualize parent/child agent sessions and pending spawns, with keyboard navigation, scroll-to, and click-to-focus. Plumbs workspace and sanitized extra metadata to build a reliable agent graph, adds paging, and includes performance/stability fixes; syncs
ghosttyand addresses #3932.New Features
CMUXWorkstreamagent graph builder links sessions via workstream/session IDs; shows spawn-request nodes forTask/Agent; shared spawn-tool detection; EN/JA strings.WorkstreamItem.workspaceIdand sanitizedextraFieldsJSON; CLI forwards parent/child/model/subagent fields; feed socket emitsworkspace_idand parsedextra_fields.Bug Fixes
Written for commit ab8f6a6. Summary will update on new commits. Review in cubic
Summary by CodeRabbit
New Features
Improvements
Tests
Localization