From a7eb6c58ab1d6a65607f57a870c44c601b24953c Mon Sep 17 00:00:00 2001 From: ChroniCat Date: Wed, 18 Mar 2026 14:51:57 +0800 Subject: [PATCH] fix(control-ui): treat null tool args as absent --- ui/src/ui/chat/tool-helpers.test.ts | 4 ++++ ui/src/ui/chat/tool-helpers.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/src/ui/chat/tool-helpers.test.ts b/ui/src/ui/chat/tool-helpers.test.ts index 7965a7df93e..18fdc0d72a4 100644 --- a/ui/src/ui/chat/tool-helpers.test.ts +++ b/ui/src/ui/chat/tool-helpers.test.ts @@ -159,6 +159,10 @@ describe("tool-helpers", () => { it("returns null for undefined arguments", () => { expect(formatToolPayloadForSidebar(undefined)).toBeNull(); }); + + it("returns null for null arguments", () => { + expect(formatToolPayloadForSidebar(null)).toBeNull(); + }); }); describe("buildToolSidebarContent", () => { diff --git a/ui/src/ui/chat/tool-helpers.ts b/ui/src/ui/chat/tool-helpers.ts index d95a695b2a9..0ceb6351c6b 100644 --- a/ui/src/ui/chat/tool-helpers.ts +++ b/ui/src/ui/chat/tool-helpers.ts @@ -27,7 +27,7 @@ export function formatToolOutputForSidebar(text: string): string { * Uses JSON code blocks for structured values and preserves plain text input. */ export function formatToolPayloadForSidebar(value: unknown): string | null { - if (value === undefined) { + if (value === undefined || value === null) { return null; } if (typeof value === "string") {