mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-09 22:31:08 +00:00
fix: prevent duplicated tool call rendering in parallel execution
Explicitly marks all tool_use blocks as non-partial after finalization to prevent race conditions where tools might still have partial=true. Fixes EXT-634
This commit is contained in:
parent
6e08ae4bfd
commit
6eafee94b7
1 changed files with 11 additions and 0 deletions
|
|
@ -3283,6 +3283,17 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
|
|||
}
|
||||
}
|
||||
|
||||
// CRITICAL FIX: Explicitly mark ALL tool_use blocks as non-partial after finalization.
|
||||
// This prevents race conditions where tools might still have partial=true if:
|
||||
// - toolUseIndex was undefined during finalization (tool already removed from tracking)
|
||||
// - finalizeStreamingToolCall returned null but tool exists in assistantMessageContent
|
||||
// Without this, the first tool in a parallel batch could be presented twice.
|
||||
for (const block of this.assistantMessageContent) {
|
||||
if ((block.type === "tool_use" || block.type === "mcp_tool_use") && block.partial) {
|
||||
block.partial = false
|
||||
}
|
||||
}
|
||||
|
||||
// IMPORTANT: Capture partialBlocks AFTER finalizeRawChunks() to avoid double-presentation.
|
||||
// Tools finalized above are already presented, so we only want blocks still partial after finalization.
|
||||
const partialBlocks = this.assistantMessageContent.filter((block) => block.partial)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue