Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit ace2500

Browse files
committed
fix: add missing didCompleteReadingStream check and test assertion
1 parent cfb544c commit ace2500

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/core/assistant-message/__tests__/presentAssistantMessage-parallel-tools.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ describe("presentAssistantMessage - Parallel Tool Execution Timing", () => {
237237
// Even if the tool executed, userMessageContentReady should NOT be true
238238
// because the stream hasn't completed yet (more content may arrive)
239239
// Note: The fix specifically checks both conditions
240+
expect(mockTask.userMessageContentReady).toBe(false)
240241
})
241242

242243
it("should handle mcp_tool_use blocks the same as tool_use blocks", async () => {

src/core/assistant-message/presentAssistantMessage.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,8 @@ export async function presentAssistantMessage(cline: Task) {
10291029
// CRITICAL: For parallel tool execution, we must verify all tool results
10301030
// are collected before signaling ready. Without this check, the message
10311031
// queue could proceed before all tool_result blocks are in userMessageContent.
1032-
if (areAllToolResultsCollected(cline)) {
1032+
// Also verify the stream is complete - more content may still arrive.
1033+
if (cline.didCompleteReadingStream && areAllToolResultsCollected(cline)) {
10331034
cline.userMessageContentReady = true // Will allow `pWaitFor` to continue.
10341035
}
10351036
}

0 commit comments

Comments
 (0)