From 782caa67485da1a304008a01ad81ea9f6ccbb0b0 Mon Sep 17 00:00:00 2001 From: ScDor <18174994+ScDor@users.noreply.github.com> Date: Tue, 10 Feb 2026 00:27:26 +0200 Subject: [PATCH] fix: address PR feedback and fix unit test failures --- src/core/assistant-message/NativeToolCallParser.ts | 2 +- .../__tests__/presentAssistantMessage-images.spec.ts | 10 ++++++---- src/core/tools/AskFollowupQuestionTool.ts | 2 +- src/core/webview/ClineProvider.ts | 2 ++ src/shared/tools.ts | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/core/assistant-message/NativeToolCallParser.ts b/src/core/assistant-message/NativeToolCallParser.ts index 1eb4e433b9..6b5310b745 100644 --- a/src/core/assistant-message/NativeToolCallParser.ts +++ b/src/core/assistant-message/NativeToolCallParser.ts @@ -816,7 +816,7 @@ export class NativeToolCallParser { break case "ask_followup_question": - if (args.questions !== undefined && args.follow_up !== undefined) { + if (args.questions !== undefined || args.follow_up !== undefined) { nativeArgs = { questions: Array.isArray(args.questions) ? args.questions : undefined, follow_up: args.follow_up, diff --git a/src/core/assistant-message/__tests__/presentAssistantMessage-images.spec.ts b/src/core/assistant-message/__tests__/presentAssistantMessage-images.spec.ts index 7316884984..a2fffde121 100644 --- a/src/core/assistant-message/__tests__/presentAssistantMessage-images.spec.ts +++ b/src/core/assistant-message/__tests__/presentAssistantMessage-images.spec.ts @@ -49,6 +49,8 @@ describe("presentAssistantMessage - Image Handling in Native Tool Calling", () = closeBrowser: vi.fn().mockResolvedValue(undefined), }, recordToolUsage: vi.fn(), + recordToolError: vi.fn(), + sayAndCreateMissingParamError: vi.fn().mockResolvedValue("mock error message"), toolRepetitionDetector: { check: vi.fn().mockReturnValue({ allowExecution: true }), }, @@ -85,8 +87,8 @@ describe("presentAssistantMessage - Image Handling in Native Tool Calling", () = type: "tool_use", id: toolCallId, // ID indicates native tool calling name: "ask_followup_question", - params: { question: "What do you see?" }, - nativeArgs: { question: "What do you see?", follow_up: [] }, + params: { questions: ["What do you see?"] }, + nativeArgs: { questions: ["What do you see?"], follow_up: [] }, }, ] @@ -138,8 +140,8 @@ describe("presentAssistantMessage - Image Handling in Native Tool Calling", () = type: "tool_use", id: toolCallId, name: "ask_followup_question", - params: { question: "What is your name?" }, - nativeArgs: { question: "What is your name?", follow_up: [] }, + params: { questions: ["What is your name?"] }, + nativeArgs: { questions: ["What is your name?"], follow_up: [] }, }, ] diff --git a/src/core/tools/AskFollowupQuestionTool.ts b/src/core/tools/AskFollowupQuestionTool.ts index 08ae0499e5..8533e9c7b3 100644 --- a/src/core/tools/AskFollowupQuestionTool.ts +++ b/src/core/tools/AskFollowupQuestionTool.ts @@ -38,7 +38,7 @@ export class AskFollowupQuestionTool extends BaseTool<"ask_followup_question"> { // Transform follow_up suggestions to the format expected by task.ask const followup_json = { questions, - suggest: follow_up.map((s) => ({ answer: s.text, mode: s.mode })), + suggest: follow_up?.map((s) => ({ answer: s.text, mode: s.mode })) || [], } task.consecutiveMistakeCount = 0 diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 94b3122eed..f6af3d5c76 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -2107,6 +2107,7 @@ export class ClineProvider featureRoomoteControlEnabled, isBrowserSessionActive, lockApiConfigAcrossModes, + showQuestionsOneByOne, } = await this.getState() let cloudOrganizations: CloudOrganizationMembership[] = [] @@ -2468,6 +2469,7 @@ export class ClineProvider reasoningBlockCollapsed: stateValues.reasoningBlockCollapsed ?? true, enterBehavior: stateValues.enterBehavior ?? "send", taskHeaderHighlightEnabled: stateValues.taskHeaderHighlightEnabled ?? false, + showQuestionsOneByOne: stateValues.showQuestionsOneByOne ?? false, cloudUserInfo, cloudIsAuthenticated, sharingEnabled, diff --git a/src/shared/tools.ts b/src/shared/tools.ts index e9c94e72bf..931b9c3e19 100644 --- a/src/shared/tools.ts +++ b/src/shared/tools.ts @@ -112,7 +112,7 @@ export type NativeToolArgs = { new_task: { mode: string; message: string; todos?: string } ask_followup_question: { questions: FollowUpQuestion[] - follow_up: Array<{ text: string; mode?: string }> + follow_up?: Array<{ text: string; mode?: string }> } browser_action: BrowserActionParams codebase_search: { query: string; path?: string }