feat(desktop): open chat subagents in stacked right panes

Closed
HA
3mo ago
+843-1

What & why

When a Mastra chat agent spawns subagents, their activity was only visible inline in the parent chat (or after navigating into nested tool UI). This adds automatic side panes so you can watch the parent and each subagent at once — first subagent opens to the right of the parent chat; later ones stack underneath that column.

  • New subagent pane kind bound to { parentSessionId, toolCallId }
  • Auto-open on new activeSubagents entries (idempotent per toolCallId)
  • Live activity from harness state, with message-history fallback after completion

Addresses the “display subagent activity in a new pane” request (#5077).

How I tested it

  • image:

    Screenshot From 2026-07-21 20-22-13
  • Unit tests:

    • openSubagentPane (open right / stack / focus existing)
    • resolveSubagentEntries (live map vs message history vs fallback)
  • Manual (v2 workspace Chat pane, not terminal agents):

    1. Open + → Chat
    2. Prompt: “Use 2–3 explore subagents in parallel to investigate X, Y, and Z.”
    3. Confirm stacked right panes open and update while subagents run

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (CI fails on lint warnings too)
  • "Allow edits from maintainers" is checked on fork PRs

Summary by cubic

Chat subagents now open in stacked right panes so you can watch the parent chat and each subagent at the same time. First opens to the right; later ones stack in the same column, and we don’t refocus if the pane already exists. Addresses #5077.

  • New Features
    • Added a subagent pane keyed by { parentSessionId, toolCallId } with live updates and message-history fallback.
    • Auto-open from activeSubagents; idempotent per toolCallId; skips existing panes (no focus steal).
    • Layout: opens to the right of the parent chat; subsequent subagents stack underneath.
    • Introduced useAutoOpenSubagentPanes, openSubagentPane, and SubagentPane/SubagentPaneTitle with tests for open/stack/no-refocus and entry/title resolution.

Summary by CodeRabbit

  • New Features
    • Added dedicated subagent panes to the workspace dashboard.
    • Automatically opens subagent panes as activity begins, avoiding duplicates.
    • Displays subagent status, task details, results, errors, and execution information.
    • Organizes multiple subagent panes beside the related chat and focuses existing panes when applicable.
    • Added descriptive subagent titles and a Bot icon for easier identification.