fix: add missing didCompleteReadingStream check and test assertion

This commit is contained in:
Roo Code 2026-01-30 19:37:41 +00:00
parent cfb544c0e9
commit ace2500418
2 changed files with 3 additions and 1 deletions

View file

@ -237,6 +237,7 @@ describe("presentAssistantMessage - Parallel Tool Execution Timing", () => {
// Even if the tool executed, userMessageContentReady should NOT be true
// because the stream hasn't completed yet (more content may arrive)
// Note: The fix specifically checks both conditions
expect(mockTask.userMessageContentReady).toBe(false)
})
it("should handle mcp_tool_use blocks the same as tool_use blocks", async () => {

View file

@ -1029,7 +1029,8 @@ export async function presentAssistantMessage(cline: Task) {
// CRITICAL: For parallel tool execution, we must verify all tool results
// are collected before signaling ready. Without this check, the message
// queue could proceed before all tool_result blocks are in userMessageContent.
if (areAllToolResultsCollected(cline)) {
// Also verify the stream is complete - more content may still arrive.
if (cline.didCompleteReadingStream && areAllToolResultsCollected(cline)) {
cline.userMessageContentReady = true // Will allow `pWaitFor` to continue.
}
}