Skip to content

fix(agents): render subagent dispatch rows regardless of SDK tool name#38

Merged
aletc1 merged 1 commit into
devfrom
claude/elegant-mendeleev-3a5e52
Apr 24, 2026
Merged

fix(agents): render subagent dispatch rows regardless of SDK tool name#38
aletc1 merged 1 commit into
devfrom
claude/elegant-mendeleev-3a5e52

Conversation

@aletc1

@aletc1 aletc1 commented Apr 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Top-level Agent/Task rows in the chat were rendering as a bare "Agent" label with no description, while the Tasks sidebar showed the correct summary. Root cause: the inline renderer hard-coded part.type === "tool-Task", but the CLI-parity built-in subagents shipped in feat(agents): ship CLI-parity built-in subagents to embedded SDK #36 can emit the dispatch tool as tool-Agent — so those runs fell through to a catch-all that shows only the bare tool name.
  • Dispatch is now matched by shape (isSubagentDispatchType() covers both tool-Task and tool-Agent) at all three call sites in assistant-message-item.tsx, so AgentTaskTool consistently produces "Running Subagent — <description>" with nested child tools.
  • Hardened the generic fallback to render <ToolName> <summary> via a shared summarizeToolInput() helper — extracted from tasks-widget.tsx so the two surfaces stay in sync forever.
  • Bumped @anthropic-ai/claude-agent-sdk 0.2.118 → 0.2.119 and the bundled CLI binary 2.1.118 → 2.1.119 (released in lockstep).

Test plan

  • bun install && bun run claude:download — pulls SDK 0.2.119 and binary 2.1.119.
  • bun run dev — launch the Electron app.
  • Send a prompt that triggers a subagent (e.g. "Design fix plan for …"). Confirm the inline chat row reads "Running Subagent — <description>" both while running and after completion, not just "Agent".
  • Confirm the Tasks sidebar shows the same row with the same description (regression check on the shared helper).
  • Run 3 subagent-triggering prompts back-to-back — label should be stable across all of them (regression test for the "sometimes works, sometimes doesn't" symptom).
  • Invoke a tool not in the registry (e.g. an MCP tool) — fallback should now render <ToolName> <summary> instead of a bare name.

🤖 Generated with Claude Code

The Agent SDK's CLI-parity built-in subagents (shipped in #36) can emit
the dispatch tool as either `Task` or `Agent`. The inline chat renderer
hard-coded `tool-Task`, so `tool-Agent` dispatches fell through to the
generic fallback that shows only the bare tool name with no description,
while the Tasks sidebar rendered correctly because it reads input by
shape. Result: the top row looked empty ("Agent" with no subtitle) even
though the subagent was running and nested child tools rendered fine.

- Add `isSubagentDispatchType()` helper; use it at the primary and
  orphan-group dispatch sites so `AgentTaskTool` handles both names.
- Harden the catch-all fallback to show `<ToolName> <summary>` via a
  shared `summarizeToolInput()` (extracted from tasks-widget so the two
  surfaces stay in sync).
- Bump `@anthropic-ai/claude-agent-sdk` 0.2.118 → 0.2.119 and the
  bundled CLI binary 2.1.118 → 2.1.119 (released in lockstep).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aletc1 aletc1 merged commit ba96e7d into dev Apr 24, 2026
@aletc1 aletc1 deleted the claude/elegant-mendeleev-3a5e52 branch April 24, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant