feat(tui): add Subagents section to session sidebar#15738
feat(tui): add Subagents section to session sidebar#15738tttturtle-russ wants to merge 1 commit intoanomalyco:devfrom
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found several related PRs that address similar functionality: Potential Related PRs:
These PRs appear to address related subagent display and navigation features, though some may be older implementations or for different platforms (desktop/web vs TUI). You may want to review them to ensure there's no overlapping functionality or to see if your changes complement or supersede any of these. |
Show live status of child sessions spawned by the parent agent in the sidebar, including title, and working/idle state. Section is collapsible when more than 2 subagents are present.
0e37c4a to
3faeaec
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a "Subagents" section to the session sidebar in the TUI, enabling users to monitor the live status and titles of all child sessions spawned by the current parent agent. This addresses the difficulty of tracking subagent progress when context is long.
Changes:
- Added
subagentskey to theexpandedstore (defaulting totrue) - Added a
subagentscomputed memo that filterssync.data.sessionfor sessions whoseparentIDmatches the current session - Added a new collapsible UI section rendering each subagent's title and idle/working status using existing conventions
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {title()} | ||
| </text> | ||
| <text fg={theme.textMuted}> | ||
| {status() === "idle" ? "idle" : "working"} |
There was a problem hiding this comment.
The status() check only handles "idle" vs. everything else, but sync.session.status() can return three distinct values: "idle", "working", and "compacting" (when session.time.compacting is set). When a subagent's session is compacting, it will display "working" with a warning color, which is misleading because compacting is a distinct background housekeeping operation. The displayed label should reflect the compacting state, and the indicator color could differentiate it (e.g., use a different color or a different label like "compacting").
| {status() === "idle" ? "idle" : "working"} | |
| {status() === "idle" ? "idle" : status() === "compacting" ? "compacting" : "working"} |
| <text fg={theme.text}> | ||
| <b>Subagents</b> | ||
| <Show when={!expanded.subagents}> | ||
| <span style={{ fg: theme.textMuted }}> ({subagents().length})</span> |
There was a problem hiding this comment.
When the Subagents section is collapsed (more than 2 subagents), the header shows only the total count, e.g., (4). The MCP section (an established pattern in this file) shows a more informative summary in its collapsed header, e.g., (3 active, 1 error). Since the primary reason for this feature is to track working vs. idle subagent status, the collapsed header would be more useful if it showed a count breakdown, such as (3 working, 1 idle), consistent with the MCP section pattern.
| <span style={{ fg: theme.textMuted }}> ({subagents().length})</span> | |
| {(() => { | |
| const counts = subagents().reduce( | |
| (acc, id) => { | |
| const status = sync.session.status(id) | |
| if (status === "idle") { | |
| acc.idle += 1 | |
| } else { | |
| acc.working += 1 | |
| } | |
| return acc | |
| }, | |
| { working: 0, idle: 0 }, | |
| ) | |
| return ( | |
| <span style={{ fg: theme.textMuted }}> | |
| {" "} | |
| ({counts.working} working, {counts.idle} idle) | |
| </span> | |
| ) | |
| })()} |
Show live status of child sessions spawned by the parent agent in the sidebar, including title, and working/idle state. Section is collapsible when more than 2 subagents are present.
Issue for this PR
Closes #
Type of change
What does this PR do?
When context is too long, it's becomes hard to keep track of each subagent's status, then I add a component in the sidebar to keep track of each subagent and corresponding task.
How did you verify your code works?
I build the binary locally and test it by calling some subagents.
Screenshots / recordings
Checklist
If you do not follow this template your PR will be automatically rejected.