Skip to content

Commit 304f089

Browse files
test(tools): add comprehensive unit tests for AskFollowupQuestionTool
- Add 36 unit tests covering execute(), handlePartial(), and error paths - Fix undefined text handling: use safeText = text ?? "" to prevent literal 'undefined' in user_message output - Add NativeToolCallParser integration tests for streaming ask_followup_question tool calls - Address review feedback: fix undefined assertion and improve empty string comment clarity
1 parent 79ed8b5 commit 304f089

2 files changed

Lines changed: 454 additions & 248 deletions

File tree

src/core/tools/AskFollowupQuestionTool.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ export class AskFollowupQuestionTool extends BaseTool<"ask_followup_question"> {
4747

4848
task.consecutiveMistakeCount = 0
4949
const { text, images } = await task.ask("followup", JSON.stringify(follow_up_json), false)
50-
await task.say("user_feedback", text ?? "", images)
51-
pushToolResult(formatResponse.toolResult(`<user_message>\n${text}\n</user_message>`, images))
50+
const safeText = text ?? ""
51+
await task.say("user_feedback", safeText, images)
52+
pushToolResult(formatResponse.toolResult(`<user_message>\n${safeText}\n</user_message>`, images))
5253
} catch (error) {
5354
await handleError("asking question", error as Error)
5455
}

0 commit comments

Comments
 (0)