From 422fee7643a07aa141119fdf3907a7cca6f454e3 Mon Sep 17 00:00:00 2001 From: Mimi Date: Thu, 29 Jan 2026 00:34:48 +0800 Subject: [PATCH] test: update conflicting test to reflect API requirement The API requires tool calls to have arguments field present (even if empty). Updated test to verify arguments IS synthesized when missing. --- ...mages.keeps-tool-call-tool-result-ids-unchanged.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/agents/pi-embedded-helpers.sanitize-session-messages-images.keeps-tool-call-tool-result-ids-unchanged.test.ts b/src/agents/pi-embedded-helpers.sanitize-session-messages-images.keeps-tool-call-tool-result-ids-unchanged.test.ts index 1b3210790..01f2fa2ed 100644 --- a/src/agents/pi-embedded-helpers.sanitize-session-messages-images.keeps-tool-call-tool-result-ids-unchanged.test.ts +++ b/src/agents/pi-embedded-helpers.sanitize-session-messages-images.keeps-tool-call-tool-result-ids-unchanged.test.ts @@ -86,7 +86,7 @@ describe("sanitizeSessionMessagesImages", () => { expect(toolResult.role).toBe("toolResult"); expect(toolResult.toolCallId).toBe("call123fc456"); }); - it("does not synthesize tool call input when missing", async () => { + it("synthesizes tool call arguments when missing (API requires it)", async () => { const input = [ { role: "assistant", @@ -98,7 +98,8 @@ describe("sanitizeSessionMessagesImages", () => { const assistant = out[0] as { content?: Array> }; const toolCall = assistant.content?.find((b) => b.type === "toolCall"); expect(toolCall).toBeTruthy(); - expect("input" in (toolCall ?? {})).toBe(false); - expect("arguments" in (toolCall ?? {})).toBe(false); + // API requires arguments field to be present (even if empty) + expect("arguments" in (toolCall ?? {})).toBe(true); + expect(toolCall?.arguments).toEqual({}); }); });