Skip to content

TUI: background-agent visibility (+ optional depth nesting) #3103

@aheritier

Description

@aheritier

Part of #3104

run_background_agent work is essentially invisible in the UI: no live progress, no count, generic tool cards, and a single-agent sidebar. This is the strongest "multiple agents" case.

Proposed changes

  1. Dedicated renderers for the background-agent tools. Add pkg/tui/components/tool/backgroundagent/ renderers for run/list/view/stop_background_agent, registered in pkg/tui/components/tool/factory.go, rendering compact cards (agent badge + status chip + elapsed) instead of raw text. Pure presentation; no runtime change.
  2. (Optional) Background-agent status surface. A compact "N background agents running" indicator with per-task status. This needs a runtime seam because runCollecting deliberately drops child events — prefer emitting coarse lifecycle events (started/finished with task id + agent name + final status) without forwarding the full stream. ⚠️ Concurrency-sensitive (up to 20 goroutines); gate on maintainer approval.
  3. (Stretch) Depth-based indentation of forwarded sub-agent messages using streamDepth. High blast radius in pkg/tui/components/messages/ (width/wrap/selection/scroll math); only pursue if Phases 1–2 prove insufficient.

Acceptance criteria

  • Background-agent tool calls render as compact, readable cards (agent, task id, status, elapsed).
  • (If approved) a live count/status of running background agents is visible.

Validation

  • task build && task test && task lint green.
  • Renderer tests (ANSI-stripped: agent, task id, status, elapsed).

Metadata

Metadata

Assignees

Labels

area/agentFor work that has to do with the general agent loop/agentic features of the apparea/toolsFor features/issues/fixes related to the usage of built-in and MCP toolsarea/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