feat(kiro): group subagent activity into Work-log entries#2
Merged
Conversation
Kiro multiplexes `session/update` for the main session and every
spawned subagent crew over one ACP channel, each tagged with its
originating sessionId. Previously every subagent tool call, assistant
message, and content delta landed on the main chat as flat inline
rows — the "chaotic" UX relative to Claude Code's native Work-log
grouping.
Match Claude Code's behavior: subagent work appears as a collapsible
Work-log group with live per-tool activity inside, and the main
thread stays clean.
- Thread `sessionId` through every `AcpParsedSessionEvent` variant and
through `AcpAssistantSegmentState` in `AcpSessionRuntime`, so
KiroAdapter can tell main-session events apart from subagent events.
- Track in-flight subagents in `KiroSessionContext.subagentTasks`,
keyed by ACP sessionId, and translate `_kiro.dev/subagent/list_update`
roster transitions into `task.started` / `task.completed` envelopes.
On session teardown, flush dangling tasks as `status: "stopped"` so
the Work-log spinner doesn't hang.
- Emit one `task.progress` per distinct subagent `toolCallId` (tracked
per-subagent in `seenToolCallIds`) so the Work-log shows live
activity inside the group while the crew is running, instead of
sitting silent between start and end markers.
- Format each progress row as `"{title}: {detail}"` via a new exported
`formatSubagentToolLabel` helper so rows read "Read file: src/foo.ts"
or "Ran command: bun test" instead of the bare category.
- Drop subagent ContentDelta / AssistantItem / PlanUpdated / ModeChanged
events from the main thread — they're subagent internals the user
shouldn't see.
The UI needs no changes — `deriveWorkLogEntries` already groups
task.progress/task.completed under a collapsible Work-log widget.
PATCH.md updated: new integration-points row for AcpRuntimeModel,
bumped AcpSessionRuntime row, added a user-facing feature bullet, new
row in the conflict-zones table, and a session-reflection entry.
Tests: 18 new cases — 10 around roster parsing + diff semantics
(missing sessionId, unknown status, started/completed emission,
idempotence on re-sends, implicit termination on disappearance) and
8 on `formatSubagentToolLabel` (title+detail combining, command
fallback, title-only, detail-only, identical dedup, kind fallback,
empty "Working" fallback, whitespace trimming).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_kiro.dev/subagent/list_updateroster transitions intotask.started/task.completedenvelopes, so subagent crews render as collapsible Work-log groups instead of flooding the main chat.task.progressper distinct subagenttoolCallIdwith"{title}: {detail}"labels (e.g.Read file: src/foo.ts,Ran command: bun test) so the group shows live per-tool activity while the crew is running.sessionIdthroughAcpParsedSessionEvent/AcpSessionRuntimeso subagent session/update events can be dropped from the main thread — matching Claude Code's native SDK behavior of hiding subagent internals behind task notifications.PATCH.mdupdated: new row forAcpRuntimeModel.tsin the integration-points and conflict-zones tables, bumpedAcpSessionRuntimerow, user-facing feature bullet, and a round-3 session reflection.Test plan
bun run typecheck— cleanbun run vitest runonKiroAdapter.parsing.test.ts+AcpRuntimeModel.test.ts— 40 tests pass (18 new: 10 roster parsing + diff semantics, 8formatSubagentToolLabel)/slash menu shows built-ins.Title: detail