claude: give each spawned subagent its own collapsing card (T-342)

A fan-out of N agents (Task/Agent) merged into one shared "Activity / N
steps" cluster — groupConversation folded an Agent spawn like any Bash/
Read call. Now an Agent spawn is a cluster boundary, rendering as its own
first-class collapsing card (reusing the existing sticky-agent path: folded
prompt T-263 + nested run T-264), while adjacent non-agent foldables keep
clustering into the normal Activity card.

Two changes:
- activity_cluster: a shared isAgentTool() predicate; _isFoldable returns
  false for agent spawns at every level (incl. L3), so parallel agents
  never merge. Only the grouping boundary changes; fold mechanics are
  unchanged.
- conversation_view: harden resolveOwner. Its nearest-preceding-agent
  fallback is safe with one agent but mis-routes under a parallel fan-out
  (an unattributable item lands in whichever agent was emitted last —
  a sibling's card). With >1 agent, drop the fallback so the item orphans
  (rendered inline) instead of cross-attributed. The T-338 direct route
  (parent_tool_use_id) still attributes interleaved items correctly.

Tests: two consecutive agents → two cards (not one cluster); agent breaks
a sibling cluster; agents first-class at L3; regression — consecutive
Bash still one cluster; interleaved parallel-agent runs route to their own
card; an unattributable item orphans instead of being swept into the last
agent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-11 14:57:21 +02:00
co-authored by Claude Opus 4.8
parent ce200765cc
commit 4c33a85bf0
7 changed files with 135 additions and 4 deletions
+10
View File
@@ -16,6 +16,16 @@ heading, and (b) bumping `pubspec.yaml` `version:` in the same commit.
## [Unreleased]
### Changed
- **Each spawned subagent gets its own collapsing activity card.** A fan-out of
N agents (Task/Agent tool) used to merge into one shared "Activity / N steps"
cluster; now every agent spawn is its own first-class collapsing card with its
folded prompt and nested run, labelled by its task. Surrounding non-agent tool
calls (Bash/Read/Grep) still group into the normal Activity card. Under a
parallel fan-out, an item that can't be attributed to a specific agent now
renders inline rather than being mis-filed into a sibling agent's card. (T-342)
### Fixed
- **Accepting ExitPlanMode now leaves plan mode in the conversation panel.**