From efa002dd5de43b5a36630b7f0adfce9c74dc0fb7 Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Wed, 22 Jul 2026 21:39:27 -0500 Subject: [PATCH] refactor(desktop): share the clarify choice row and fix skip copy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds on the skipped-clarify card so it holds up beyond the timeout case: - Extract a shared `ChoiceButton` (letter badge + label + row chrome) used by both the live pending card and the settled skip card. The two blocks had drifted into duplicated markup; now they can't diverge. - Fix the hint copy. An empty `user_response` is emitted for BOTH a server-side timeout AND a manual Skip (tools/clarify_tool.py) — there is no field on the result that tells them apart — so asserting "This question timed out" was wrong half the time. Neutral wording ("This prompt is no longer waiting…") is correct for either, and the recover-your-answer path now also helps someone who mis-clicked Skip. Updated en/ja/zh/zh-hant. No behavior change to the live prompt or the follow-up-message flow. Co-authored-by: SHL0MS --- .../components/assistant-ui/clarify-tool.tsx | 69 ++++++++++++------- apps/desktop/src/i18n/en.ts | 2 +- apps/desktop/src/i18n/ja.ts | 2 +- apps/desktop/src/i18n/zh-hant.ts | 2 +- apps/desktop/src/i18n/zh.ts | 2 +- 5 files changed, 50 insertions(+), 27 deletions(-) diff --git a/apps/desktop/src/components/assistant-ui/clarify-tool.tsx b/apps/desktop/src/components/assistant-ui/clarify-tool.tsx index d06ed1ef16ea..db33eab308ce 100644 --- a/apps/desktop/src/components/assistant-ui/clarify-tool.tsx +++ b/apps/desktop/src/components/assistant-ui/clarify-tool.tsx @@ -126,6 +126,43 @@ function KeyBadge({ char, preview, selected }: { char: string; preview?: boolean ) } +/** A letter-badged option row. Shared by the live pending card (where a click + * selects an answer) and the settled skip card (where a click drafts a + * follow-up), so both stay visually identical. */ +function ChoiceButton({ + char, + choice, + disabled, + onClick, + selected = false, + title +}: { + char: string + choice: string + disabled?: boolean + onClick: () => void + selected?: boolean + title?: string +}) { + return ( + + ) +} + export const ClarifyTool = (props: ToolCallMessagePartProps) => { // Answered → settled Q&A (ToolFallback collapsed the answer away). if (props.result !== undefined) { @@ -198,20 +235,13 @@ function ClarifyToolSettled({ args, result }: ToolCallMessagePartProps) { {skipped && choices.length > 0 ? (
{choices.map((choice, index) => ( - + /> ))}

{copy.lateAnswerHint}

@@ -423,21 +453,14 @@ function ClarifyToolPending({ args }: ToolCallMessagePartProps) { {hasChoices ? (
{choices.map((choice, index) => ( - + selected={selectedChoice === choice} + /> ))}