From 42cd35aa1d1879f4d6bbbb0228a18b5d29f7f736 Mon Sep 17 00:00:00 2001 From: cpacker Date: Tue, 4 Nov 2025 15:50:16 -0800 Subject: [PATCH] fix: patch issue with state tool approval state --- src/cli/helpers/stream.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/cli/helpers/stream.ts b/src/cli/helpers/stream.ts index 70d2e90..ab2e546 100644 --- a/src/cli/helpers/stream.ts +++ b/src/cli/helpers/stream.ts @@ -85,15 +85,16 @@ export async function drainStream( : null); if (toolCall?.tool_call_id) { + // If this is a NEW tool call (different ID), reset accumulated state + if (toolCallId && toolCall.tool_call_id !== toolCallId) { + toolName = null; + toolArgs = null; + } toolCallId = toolCall.tool_call_id; } if (toolCall?.name) { - if (toolName) { - // TODO would expect that we should allow stacking? I guess not? - // toolName = toolName + toolCall.name; - } else { - toolName = toolCall.name; - } + // Set the tool name (either first time or new tool call after reset) + toolName = toolCall.name; } if (toolCall?.arguments) { if (toolArgs) {