Skip to content

fix(frontend): render all parallel tool calls instead of last only#2686

Open
EthanGuo-coder wants to merge 1 commit intobytedance:mainfrom
EthanGuo-coder:fix/issue-266
Open

fix(frontend): render all parallel tool calls instead of last only#2686
EthanGuo-coder wants to merge 1 commit intobytedance:mainfrom
EthanGuo-coder:fix/issue-266

Conversation

@EthanGuo-coder
Copy link
Copy Markdown

Summary

MessageGroup previously 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 convertToToolCallSteps from the component into core/tools/utils.ts and adds a partitionStepsForDisplay helper. 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 by tool_call_id (already correct via findToolCallResult), so out-of-order completion is handled. isLast=true is 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 (added parallel-tool-calls.test.ts covering: 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 typecheck clean
  • pnpm lint clean
  • pnpm format clean
  • CI green on this branch

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 2, 2026

CLA assistant check
All committers have signed the CLA.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants