Skip to content

Commit be37495

Browse files
CodeKingKilo
andcommitted
test: update textToolCallRecovery for malformed-markup stripping behavior
The 'does not apply when only unknown tool names are present' test expected applied:false, but the malformed-markup fix now strips raw XML even when no valid tools are recovered. Updated to assert the correct new behavior: recoveredCount=0, applied=true, empty message. Co-authored-by: Kilo <kilo@kilocode.com>
1 parent 3defacd commit be37495

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/core/assistant-message/__tests__/textToolCallRecovery.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ describe("textToolCallRecovery", () => {
251251
expect(result.recoveredCount).toBe(0)
252252
})
253253

254-
it("does not apply when only unknown tool names are present", () => {
254+
it("strips markup when only unknown tool names are present (no recovery, but no raw XML leak)", () => {
255255
const text = `<tool_call>
256256
<function=definitely_not_a_real_tool>
257257
<parameter=x>1</parameter>
@@ -262,8 +262,11 @@ describe("textToolCallRecovery", () => {
262262
assistantMessageContent: [{ type: "text", content: text, partial: true }],
263263
currentStreamingContentIndex: 0,
264264
})
265-
expect(result.applied).toBe(false)
265+
// No valid tools recovered, but markup IS stripped from display
266266
expect(result.recoveredCount).toBe(0)
267+
expect(result.applied).toBe(true) // applied=true because message changed
268+
expect(result.assistantMessage).toBe("")
269+
expect(result.assistantMessage).not.toContain("<tool_call>")
267270
})
268271
})
269272
})

0 commit comments

Comments
 (0)