fix(frontend): render all parallel tool calls instead of last only#2686
Open
EthanGuo-coder wants to merge 1 commit intobytedance:mainfrom
Open
fix(frontend): render all parallel tool calls instead of last only#2686EthanGuo-coder wants to merge 1 commit intobytedance:mainfrom
EthanGuo-coder wants to merge 1 commit intobytedance:mainfrom
Conversation
Fixes bytedance#266 MessageGroup previously rendered only the array-last tool-call step from the most recent AI message, masking in-flight siblings when tools fired in parallel and finished out of order. Extracted convertToToolCallSteps and a new partitionStepsForDisplay helper into core/tools/utils.ts so all tool-call steps sharing the most-recent AI tool-call message id render as siblings, each with its own pending/result state. isLast=true is reserved for the final sibling so artifact auto-open still fires once. Tool results pair by tool_call_id, handling out-of-order completion. Co-Authored-By: Claude <noreply@anthropic.com>
7478536 to
03bf9a2
Compare
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
MessageGrouppreviously rendered only the array-last tool-call step from the most recent AI message. When the model emitted multiple tool calls in parallel and they finished out of order, every sibling except the last one was hidden in the collapsed "above" section, indistinguishable from completed history.This change extracts
convertToToolCallStepsfrom the component intocore/tools/utils.tsand adds apartitionStepsForDisplayhelper. All tool-call steps that share the most-recent AI message id render as siblings inside the active fold, each with its own in-flight / completed state. Tool results pair bytool_call_id(already correct viafindToolCallResult), so out-of-order completion is handled.isLast=trueis reserved for the final sibling so the artifact auto-open still fires once. Reasoning steps emitted alongside a parallel batch stay visible in the "above" fold (positional partition rather than message-id filtering).Fixes #266
Test plan
pnpm test— 27 unit tests pass (addedparallel-tool-calls.test.tscovering: serial flow, parallel batch with out-of-order completion, per-id result pairing, reasoning-with-parallel-batch, prior-serial-call followed by parallel batch)pnpm typecheckcleanpnpm lintcleanpnpm formatclean