Skip to content

fix(ag-ui): attributed TOOL_CALL_START links the child message's toolCallIds so cards draw the call - #965

Merged
blove merged 1 commit into
mainfrom
blove/agui-child-toolcallids
Sep 2, 2026
Merged

fix(ag-ui): attributed TOOL_CALL_START links the child message's toolCallIds so cards draw the call#965
blove merged 1 commit into
mainfrom
blove/agui-child-toolcallids

Conversation

@blove

@blove blove commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

routeSubagentContentEvent (attribution routing for subagentRunId-tagged events, libs/ag-ui/src/lib/reducer.ts) appended attributed TOOL_CALL_START entries to the child entry's content.toolCalls, but never added the toolCallId to the child MESSAGE's toolCallIds. The projection (libs/ag-ui/src/lib/to-agent.ts ~:362-374) maps child messages[] including toolCallIds, and chat-subagent-card draws tool-call cards from message.toolCallIds — so attributed tool calls existed in subagents().get(id).toolCalls() but were never drawn inside the card.

Found while investigating the examples/ag-ui migration (PR #964), which emits parent_message_id on the wire (mirroring the parent TOOL_CALL_START handler's existing parentMessageId linking behavior at reducer.ts ~:255-283).

Fix mirrors the parent handler:

  • parentMessageId present and message exists → append toolCallId to that message's toolCallIds
  • parentMessageId present but message not yet seen → create a {id, role:'assistant', content:'', toolCallIds:[id]} slot
  • no parentMessageId → attach to the most recently opened child message if one exists, else no message mutation (toolCalls entry only, same as before)

Test plan

  • Added 4 failing-then-passing unit tests in libs/ag-ui/src/lib/reducer.subagent.spec.ts covering all three parentMessageId cases
  • Added 1 projection assertion in libs/ag-ui/src/lib/to-agent.spec.ts (SUBAGENT lifecycle block) confirming agent.subagents().get('sa-1').messages()[0].toolCallIds reflects the link end-to-end
  • npx vitest run in libs/ag-ui: 247 passed (was 243), 13 files
  • npx nx lint ag-ui: 0 errors (pre-existing warnings only)

🤖 Generated with Claude Code

…CallIds so cards draw the call

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
threadplane Ready Ready Preview Sep 2, 2026 9:04pm UTC

Request Review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 0s —— View job


I'll analyze this and get back to you.

@blove
blove enabled auto-merge (squash) September 2, 2026 21:00
@blove
blove merged commit 16fcc4c into main Sep 2, 2026
46 checks passed
@blove
blove deleted the blove/agui-child-toolcallids branch September 2, 2026 21:10
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