fix(ag-ui): attributed TOOL_CALL_START links the child message's toolCallIds so cards draw the call - #965
Merged
Merged
Conversation
…CallIds so cards draw the call Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
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
routeSubagentContentEvent(attribution routing forsubagentRunId-tagged events,libs/ag-ui/src/lib/reducer.ts) appended attributedTOOL_CALL_STARTentries to the child entry'scontent.toolCalls, but never added thetoolCallIdto the child MESSAGE'stoolCallIds. The projection (libs/ag-ui/src/lib/to-agent.ts~:362-374) maps childmessages[]includingtoolCallIds, andchat-subagent-carddraws tool-call cards frommessage.toolCallIds— so attributed tool calls existed insubagents().get(id).toolCalls()but were never drawn inside the card.Found while investigating the examples/ag-ui migration (PR #964), which emits
parent_message_idon the wire (mirroring the parentTOOL_CALL_STARThandler's existingparentMessageIdlinking behavior at reducer.ts ~:255-283).Fix mirrors the parent handler:
parentMessageIdpresent and message exists → appendtoolCallIdto that message'stoolCallIdsparentMessageIdpresent but message not yet seen → create a{id, role:'assistant', content:'', toolCallIds:[id]}slotparentMessageId→ attach to the most recently opened child message if one exists, else no message mutation (toolCalls entry only, same as before)Test plan
libs/ag-ui/src/lib/reducer.subagent.spec.tscovering all threeparentMessageIdcaseslibs/ag-ui/src/lib/to-agent.spec.ts(SUBAGENT lifecycle block) confirmingagent.subagents().get('sa-1').messages()[0].toolCallIdsreflects the link end-to-endnpx vitest runinlibs/ag-ui: 247 passed (was 243), 13 filesnpx nx lint ag-ui: 0 errors (pre-existing warnings only)🤖 Generated with Claude Code