From 27ea7d54a2ae81331c44efe27f605d0d2ca52c36 Mon Sep 17 00:00:00 2001 From: Shakker Date: Thu, 5 Mar 2026 05:28:44 +0000 Subject: [PATCH] test(agents): add required message fields in malformed-content regression openclaw#35143 thanks @Sid-Qin --- src/agents/pi-embedded-utils.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/agents/pi-embedded-utils.test.ts b/src/agents/pi-embedded-utils.test.ts index ca919a39631..6a5ce710c85 100644 --- a/src/agents/pi-embedded-utils.test.ts +++ b/src/agents/pi-embedded-utils.test.ts @@ -553,7 +553,9 @@ describe("stripDowngradedToolCallText", () => { describe("promoteThinkingTagsToBlocks", () => { it("does not crash on malformed null content entries", () => { const msg = makeAssistantMessage({ + role: "assistant", content: [null as never, { type: "text", text: "hellook" }], + timestamp: Date.now(), }); expect(() => promoteThinkingTagsToBlocks(msg)).not.toThrow(); const types = msg.content.map((b: { type?: string }) => b?.type); @@ -563,14 +565,18 @@ describe("promoteThinkingTagsToBlocks", () => { it("does not crash on undefined content entries", () => { const msg = makeAssistantMessage({ + role: "assistant", content: [undefined as never, { type: "text", text: "no tags here" }], + timestamp: Date.now(), }); expect(() => promoteThinkingTagsToBlocks(msg)).not.toThrow(); }); it("passes through well-formed content unchanged when no thinking tags", () => { const msg = makeAssistantMessage({ + role: "assistant", content: [{ type: "text", text: "hello world" }], + timestamp: Date.now(), }); promoteThinkingTagsToBlocks(msg); expect(msg.content).toEqual([{ type: "text", text: "hello world" }]);