From eebc3c518baa90fafffdc43f1f3e3872e7c1e40c Mon Sep 17 00:00:00 2001 From: Jeffrey Leon Date: Fri, 2 Oct 2026 22:01:53 -0400 Subject: [PATCH] fix(ask): show the custom response text in the ask_user_choice transcript MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The result row rendered only "✓ Custom response", so after submitting a free-text answer the user could no longer read what they typed. The model-facing content already carried the text; only renderResult hid it. Closes #1692 --- extensions/ask-user-choice.ts | 4 +++- tests/ask-user-choice.test.ts | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/extensions/ask-user-choice.ts b/extensions/ask-user-choice.ts index 4f078eb4e..f436ebb09 100644 --- a/extensions/ask-user-choice.ts +++ b/extensions/ask-user-choice.ts @@ -322,7 +322,9 @@ export default function askUserChoice(pi: ExtensionAPI): void { if (details?.selection) { return new Text(theme.fg("success", `✓ ${details.selection.index}. ${details.selection.label}`), 0, 0); } - if (details?.customResponse !== undefined) return new Text(theme.fg("success", "✓ Custom response"), 0, 0); + if (details?.customResponse !== undefined) { + return new Text(theme.fg("success", `✓ Custom response — ${details.customResponse}`), 0, 0); + } return new Text(theme.fg("warning", "Cancelled"), 0, 0); }, }); diff --git a/tests/ask-user-choice.test.ts b/tests/ask-user-choice.test.ts index ae93cd1a1..f509e5af5 100644 --- a/tests/ask-user-choice.test.ts +++ b/tests/ask-user-choice.test.ts @@ -711,3 +711,17 @@ test("ask_user_choice is offered on an interactive rpc host and withdrawn once t for (const hook of registration.hooks) await hook({}, { mode: "rpc" }); assert.deepEqual(registration.activeTools(), ["read"]); }); + +test("ask_user_choice transcript shows the custom response text the user typed", () => { + const { tool } = registerChoiceTool(); + const renderResult = (tool as unknown as { + renderResult: (result: unknown, options: unknown, theme: ChoiceTheme) => { render(width: number): string[] }; + }).renderResult; + const theme: ChoiceTheme = { fg: (_color, text) => text, bg: (_color, text) => text, bold: (text) => text }; + const rendered = renderResult( + { content: [], details: { question: "Explain?", options, customResponse: "use the staging bucket" } }, + {}, + theme, + ).render(100).join("\n"); + assert.equal(stripTerminalSequences(rendered).trimEnd(), "✓ Custom response — use the staging bucket"); +});