fix: address PR feedback and fix unit test failures

This commit is contained in:
ScDor 2026-02-10 00:27:26 +02:00
parent c9b6ffd022
commit 782caa6748
5 changed files with 11 additions and 7 deletions

View file

@ -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,

View file

@ -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: [] },
},
]

View file

@ -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

View file

@ -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,

View file

@ -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 }