Skip to content

[Bug] Session graph view assigns all nested Claude Code subagents to the top-level session as parent (#72) - #86

Open
jan21deepak wants to merge 1 commit into
mainfrom
cursor/fix-nested-subagent-graph-parent-bead
Open

[Bug] Session graph view assigns all nested Claude Code subagents to the top-level session as parent (#72)#86
jan21deepak wants to merge 1 commit into
mainfrom
cursor/fix-nested-subagent-graph-parent-bead

Conversation

@jan21deepak

@jan21deepak jan21deepak commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Opened automatically by Cursor Forge as a same-repo PR on jan21deepak/omnigent
after the Cloud Agent pushed cursor/fix-nested-subagent-graph-parent-bead (not against an upstream parent).

Fixes #72.

Cursor agent: bc-7e125cff-51c9-48b2-a141-a1d91985bead


Note

Medium Risk
Changes sub-agent registration, parent resolution, and durable forwarder state in the Claude bridge path; mistakes could mis-parent sessions or skip nested agents, but behavior is covered by new integration tests and preserves legacy jsonl fallbacks.

Overview
Fixes the session graph showing every nested Claude Code sub-agent under the top-level session by teaching the native forwarder to walk the on-disk sub-agent tree and attach each external_subagent_start to the session that actually issued the spawn.

Registration no longer only scans the root subagents/ folder with a single parent id. New helpers discover …/agent-<parent>/subagents/ directories, map each meta file’s toolUseId to the owning conversation via Agent/Task tool_use ids in the root and sub-agent transcripts, and retry registration in passes when a sibling must register first. SubagentEntry now persists jsonl_path so tailing and cost aggregation use the right agent-<id>.jsonl after restart (legacy rows still fall back to the root subagents/ layout).

Tests cover spawn parent mapping for nested agents and assert nested starts POST to the parent child session’s events path, not the root.

Reviewed by Cursor Bugbot for commit e021d41. Bugbot is set up for automated code reviews on this repo. Configure here.

The Claude native forwarder always registered Task-tool subagents
against the top-level session and only scanned the root subagents/
directory. Nested subagents therefore appeared as direct children of
the main session in the web graph (and Agents list), flattening the
true spawn chain.

Walk nested subagents/ directories, resolve each spawn's toolUseId
against the owning transcript, and persist each row's jsonl path so
tail/cost forwarding follow nested files after restart.

Co-authored-by: jan21deepak <jan21deepak@users.noreply.github.com>
@jan21deepak

Copy link
Copy Markdown
Owner Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit e021d41. Configure here.

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.

[Bug] Session graph view assigns all nested Claude Code subagents to the top-level session as parent

2 participants