feat: detect sub-agents and show them as a tree under the parent session#12
Merged
Conversation
Navi was blind to sub-agents (the Agent/Task tool). Sub-agents share the parent session's sessionId and pid, so they are not separate sessions; the authoritative record lives on disk beside the transcript at <project>/<sessionId>/subagents/agent-<id>.meta.json. Add a filesystem enrichment that scans that directory and renders running and recently-finished sub-agents nested under the parent session, gated behind an experimental toggle (default off, per the existing Show* badge convention). No new hooks and no Claude session restart required. - SubagentInfo model (NaviCore) - EnrichmentService: subagentsBySid + scan and completion detection (2 MB parent-transcript tail for the tool_result, plus a 60s mtime backstop so a finished agent can never get stuck showing "running") - showSubagentsEnabled toggle + experimental settings row - SessionSection: nested tree view, driven by a 1s TimelineView for live relative time and the recently-finished drop-off - unit tests for SubagentInfo equality (guards the publish-on-change diff) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bumps both version sources that must stay in sync: plugin.json (read by build.sh to fetch the matching release) and naviCurrentVersion (the compiled marker / upgrade-banner check). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Member
Author
Contributor
|
Nice |
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
Navi was blind to sub-agents (the
Agent/Tasktool —Explore,general-purpose, custom agents). When a session fanned out, you saw only the parent "Working" with no insight into what was running underneath. This adds sub-agent detection and renders them as a tree nested under the parent session that spawned them.Verified on disk: sub-agents are not separate sessions — they share the parent's
sessionIdandpidand get no~/.claude/sessionsentry. The authoritative record lives beside the transcript at<project>/<sessionId>/subagents/agent-<id>.meta.json(carriesagentType,description, and the parenttoolUseId). So this is implemented as a new filesystem enrichment, structurally identical to the existing transcript/git enrichments — no new hooks and no Claude session restart required.Changes
SubagentInfomodel (NaviCore).EnrichmentService: newsubagentsBySidpublished dict +scheduleSubagentsRefresh/runSubagentsRefresh. Scans thesubagents/dir, parses each.meta.json, takes timestamps from the.jsonlfile attributes (falling back to the meta file so values stay stable), and derives running vs. finished from the parent transcript'stool_resultblocks (2 MB tail) plus a 60s mtime backstop so a finished agent can never get stuck showing "running".showSubagentsEnabledtoggle (default off, per the existingShow*badge convention) + an Experimental settings row.SessionSection: nested tree view (├─/└─connectors, agent type + description, green-gear "running" / dimmed-checkmark "finished", relative time), driven by a 1sTimelineViewfor live time and the recently-finished drop-off.SubagentInfoequality (guards the publish-on-change diff).plugin.jsonandnaviCurrentVersion).Display behavior
Shows running + recently-finished sub-agents; finished ones linger briefly (dimmed) then age out after ~30s. Multiple concurrent sub-agents appear as siblings under the same parent.
Testing
swift buildclean;swift test99/99 pass (incl. the newSubagentInfosuite).scripts/build-from-source.shproduces a signedNavi.app.Exploresub-agent — the detection logic classified itrunningwhile active and correctly hid an hours-old finished agent (this surfaced and fixed a real bug: a 64 KB transcript tail was too small to find a buriedtool_result, hence the 2 MB tail + mtime backstop).🤖 Generated with Claude Code