fix(strands): scope TOOL_CALL_START suppression to matching pending tool IDs#1371
Closed
giulio-leone wants to merge 3 commits intoag-ui-protocol:mainfrom
Closed
fix(strands): scope TOOL_CALL_START suppression to matching pending tool IDs#1371giulio-leone wants to merge 3 commits intoag-ui-protocol:mainfrom
giulio-leone wants to merge 3 commits intoag-ui-protocol:mainfrom
Conversation
…ool IDs Previously, has_pending_tool_result was a boolean flag set when the last message in conversation history had role='tool'. This caused ALL subsequent tool calls in the same turn to have their TOOL_CALL_START events suppressed, breaking progress indicators for multi-tool HITL workflows. Replace the boolean with a set of specific tool_call_ids from trailing tool-role messages (pending_tool_result_ids). Only tool calls whose IDs match a pending result are suppressed; new tool calls in the same turn correctly emit TOOL_CALL_START events. Fixes ag-ui-protocol#1275
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@giulio-leone is attempting to deploy a commit to the CopilotKit Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
Hey @giulio-leone First and foremost, thanks for the contribution. This is a fix for an active issue brought up several times, so very valuable! Thanks against for the contribution that has also set the path to the other PR |
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
Fixes #1275
TOOL_CALL_STARTevents were incorrectly suppressed for all tool calls in a turn when the conversation history ended with atool-role message. This broke progress indicators and real-time UI updates for multi-tool HITL workflows.Root Cause
has_pending_tool_resultwas a single boolean — once set toTrue, it suppressed START events for every subsequent tool call in the turn, not just the one whose result was already in history.Fix
Replace the boolean with
pending_tool_result_ids: set[str]— a set of specifictool_call_ids collected from the trailing tool-role messages. Only tool calls whose ID matches a pending result are suppressed; new tool calls correctly emitTOOL_CALL_START.Algorithm:
input_data.messagesfrom the end, collectingtool_call_ids whilerole == 'tool'is_pending = tool_use_id in pending_tool_result_idsTests