From 63d0034fd717b6e4bface487fdd0b0137df5ff10 Mon Sep 17 00:00:00 2001 From: Charles Packer Date: Fri, 31 Oct 2025 15:46:19 -0700 Subject: [PATCH] fix: patch TODO (#47) Co-authored-by: Letta --- src/cli/components/ToolCallMessageRich.tsx | 8 +++++--- src/cli/helpers/accumulator.ts | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/cli/components/ToolCallMessageRich.tsx b/src/cli/components/ToolCallMessageRich.tsx index 683d1da..34eccb6 100644 --- a/src/cli/components/ToolCallMessageRich.tsx +++ b/src/cli/components/ToolCallMessageRich.tsx @@ -58,7 +58,8 @@ export const ToolCallMessage = memo(({ line }: { line: ToolCallLine }) => { else if (displayName === "grep") displayName = "Grep"; else if (displayName === "glob") displayName = "Glob"; else if (displayName === "ls") displayName = "LS"; - else if (displayName === "todo_write") displayName = "Update Todos"; + else if (displayName === "todo_write") displayName = "TODO"; + else if (displayName === "TodoWrite") displayName = "TODO"; else if (displayName === "ExitPlanMode") displayName = "Planning"; // Format arguments for display using the old formatting logic @@ -128,11 +129,12 @@ export const ToolCallMessage = memo(({ line }: { line: ToolCallLine }) => { const displayResultText = clipToolReturn(line.resultText); // Check if this is a todo_write tool with successful result - // Check both the raw name and the display name since it might be "TodoWrite" + // Check both the raw name and the display name const isTodoTool = rawName === "todo_write" || rawName === "TodoWrite" || - displayName === "Update Todos"; + displayName === "TODO"; + if (isTodoTool && line.resultOk !== false && line.argsText) { try { const parsedArgs = JSON.parse(line.argsText); diff --git a/src/cli/helpers/accumulator.ts b/src/cli/helpers/accumulator.ts index c055326..ffc22f6 100644 --- a/src/cli/helpers/accumulator.ts +++ b/src/cli/helpers/accumulator.ts @@ -367,10 +367,11 @@ export function onChunk(b: Buffers, chunk: LettaStreamingResponse) { } // if argsText is not empty, add it to the line (immutable update) - if (argsText !== undefined) { + // Skip if argsText is undefined or null (backend sometimes sends null) + if (argsText !== undefined && argsText !== null) { const updatedLine = { ...line, - argsText: (line.argsText ?? "") + argsText, + argsText: (line.argsText || "") + argsText, }; b.byId.set(id, updatedLine); }