From 3953e9ef497024d13c6f4aa646d0adda2e37b0f8 Mon Sep 17 00:00:00 2001 From: yzchen Date: Thu, 13 Aug 2026 12:17:37 +0800 Subject: [PATCH] fix(examples): todo renderResult returns undefined on validation errors When a todo call fails schema validation, createErrorToolResult produces details: {} (a truthy empty object), so renderResult skips both the !details and details.error branches, then switch (details.action) has no default and returns undefined. ToolExecutionComponent.updateDisplay() then calls addChild(undefined), and the next Box.render pass crashes the whole interactive TUI. Add a default case that renders the validation error text. --- packages/coding-agent/examples/extensions/todo.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/coding-agent/examples/extensions/todo.ts b/packages/coding-agent/examples/extensions/todo.ts index 67cba7424..71b7aae87 100644 --- a/packages/coding-agent/examples/extensions/todo.ts +++ b/packages/coding-agent/examples/extensions/todo.ts @@ -276,6 +276,13 @@ export default function (pi: ExtensionAPI) { case "clear": return new Text(theme.fg("success", "✓ ") + theme.fg("muted", "Cleared all todos"), 0, 0); + + default: + return new Text( + result.content[0]?.type === "text" ? theme.fg("error", result.content[0].text) : "", + 0, + 0, + ); } }, });