Skip to content

TUI: make sequential / multiple delegations legible #3102

@aheritier

Description

@aheritier

Part of #3104

When several transfer_task calls happen in one turn (they run sequentially), the transcript is one undifferentiated stream and the sidebar shows only a single working agent, so the delegation structure is lost.

Proposed changes

  1. Transcript delegation brackets. On child stream start/stop, render theme-styled delimiter lines, e.g. ── root → librarian ───── on entry and a matching completion marker on exit. Drive these from AgentSwitchingEvent (carries FromAgent/ToAgent) and by handling SubSessionCompletedEvent in pkg/tui/page/chat/runtime_events.go (currently unhandled). Reconcile with messages.needsSeparator (which already special-cases transfer_task).
  2. Sidebar delegation breadcrumb + background count. In pkg/tui/components/sidebar/sidebar.go, extend the single workingAgent notion to show a short chain (e.g. root ⏵ librarian) when streamDepth > 1, plus a count badge when ≥1 background agents are active. Reuse AgentAccentStyleFor for per-agent color.

Acceptance criteria

  • Sequential delegations render as distinct, labeled sections.
  • Returning control to the parent is visually marked.
  • The sidebar shows the active delegation chain, not just the deepest single agent.

Validation

  • task build && task test && task lint green.
  • Test that SubSessionCompletedEvent produces the completion delimiter and keeps streamDepth balanced.
  • Integrate new transcript lines with existing separator/scroll/selection logic (extend pkg/tui/components/messages tests).

Metadata

Metadata

Assignees

Labels

area/tuiFor features/issues/fixes related to the TUIkind/featPR adds a new feature (maps to feat: commit prefix)
No fields configured for Enhancement.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions