Skip to content

feat(tui): add Subagents section to session sidebar#15738

Open
tttturtle-russ wants to merge 1 commit intoanomalyco:devfrom
tttturtle-russ:feat/subagent-sidebar
Open

feat(tui): add Subagents section to session sidebar#15738
tttturtle-russ wants to merge 1 commit intoanomalyco:devfrom
tttturtle-russ:feat/subagent-sidebar

Conversation

@tttturtle-russ
Copy link

@tttturtle-russ tttturtle-russ commented Mar 2, 2026

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

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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

Snipaste_2026-03-02_23-36-57

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

Copilot AI review requested due to automatic review settings March 2, 2026 16:27
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

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:

  1. PR feat: add subagents sidebar with clickable navigation and parent keybind #4865 - "feat: add subagents sidebar with clickable navigation and parent keybind"

    • Directly related to adding subagents to the sidebar with navigation capabilities
  2. PR Desktop: Sidebar subsessions support #6368 - "Desktop: Sidebar subsessions support"

    • Addresses sidebar subsessions/child sessions display
  3. PR feat(web): Show subagents under parent session, allow intuitive navigation between. #14043 - "feat(web): Show subagents under parent session, allow intuitive navigation between"

    • Web version of similar functionality for showing subagents under parent session
  4. PR feat(tui): fire-and-forget async subagent tasks #7206 - "feat(tui): fire-and-forget async subagent tasks"

    • Related to TUI subagent functionality

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.
@tttturtle-russ tttturtle-russ force-pushed the feat/subagent-sidebar branch from 0e37c4a to 3faeaec Compare March 2, 2026 16:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 subagents key to the expanded store (defaulting to true)
  • Added a subagents computed memo that filters sync.data.session for sessions whose parentID matches 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"}
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

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").

Suggested change
{status() === "idle" ? "idle" : "working"}
{status() === "idle" ? "idle" : status() === "compacting" ? "compacting" : "working"}

Copilot uses AI. Check for mistakes.
<text fg={theme.text}>
<b>Subagents</b>
<Show when={!expanded.subagents}>
<span style={{ fg: theme.textMuted }}> ({subagents().length})</span>
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
<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>
)
})()}

Copilot uses AI. Check for mistakes.
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.

2 participants