diff --git a/src/core/tools/ExecuteCommandTool.ts b/src/core/tools/ExecuteCommandTool.ts index d3e2bbce8df..836280c101d 100644 --- a/src/core/tools/ExecuteCommandTool.ts +++ b/src/core/tools/ExecuteCommandTool.ts @@ -128,6 +128,9 @@ export class ExecuteCommandTool extends BaseTool<"execute_command"> { } } + // Process any queued messages after command execution completes + task.processQueuedMessages() + return } catch (error) { await handleError("executing command", error as Error) diff --git a/src/core/tools/__tests__/executeCommandTool.spec.ts b/src/core/tools/__tests__/executeCommandTool.spec.ts index 89b2575288b..8b61386dfc3 100644 --- a/src/core/tools/__tests__/executeCommandTool.spec.ts +++ b/src/core/tools/__tests__/executeCommandTool.spec.ts @@ -68,6 +68,7 @@ describe("executeCommandTool", () => { }, recordToolUsage: vitest.fn().mockReturnValue({} as ToolUsage), recordToolError: vitest.fn(), + processQueuedMessages: vitest.fn(), providerRef: { deref: vitest.fn().mockResolvedValue({ getState: vitest.fn().mockResolvedValue({ @@ -158,6 +159,22 @@ describe("executeCommandTool", () => { expect(result).toContain("Command") }) + it("should process queued messages after command execution", async () => { + // Setup + mockToolUse.params.command = "echo test" + mockToolUse.nativeArgs = { command: "echo test" } + + // Execute + await executeCommandTool.handle(mockCline as unknown as Task, mockToolUse, { + askApproval: mockAskApproval as unknown as AskApproval, + handleError: mockHandleError as unknown as HandleError, + pushToolResult: mockPushToolResult as unknown as PushToolResult, + }) + + // Verify that processQueuedMessages was called after command execution + expect(mockCline.processQueuedMessages).toHaveBeenCalled() + }) + it("should pass along custom working directory if provided", async () => { // Setup mockToolUse.params.command = "echo test"