feat(chat): clickable clarifying questions in the host chat - #393
Merged
Conversation
The host Claude chat can now ask the user a quick multiple-choice question that renders as one-click option chips; clicking one sends that choice as the next turn. Why a convention, not the AskUserQuestion tool: AskUserQuestion is auto-dismissed in headless `claude -p` mode (verified — the CLI resolves it to an errored/empty result before any stdin answer lands), so it can't be answered over the stream. Instead we teach the chat a tiny fenced `corral-question` convention (first-turn guidance in chat.go), parse it client-side (lib/chatQuestion.ts), and render the options as chips. Plain prose still works; the block is stripped so nothing leaks. - chat.go: chatQuestionGuidance prepended on the first turn (page-independent; later turns inherit via --resume). Reaches every host chat (global/project/PR). - ChatPanel: parse the latest assistant message for the block when idle; render question + option chips; a click sends the option (reuses sendPrompt). - Updated TestWithContextHint for the new first-turn prefix. Verified with a mocked chat WS: chips render, the raw block is stripped, and clicking sends the option as the next turn. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The host Claude chat can now ask the user a quick multiple-choice question that renders as one-click option chips; clicking one sends that choice as the next turn.
Why a convention, not the AskUserQuestion tool
I verified empirically that AskUserQuestion is auto-dismissed in headless
claude -pmode — the CLI resolves it to an errored/empty result before any stdin answer can land, so it cannot be answered over the stream. Instead this uses a tiny fencedcorral-questionconvention the chat is taught to emit, parsed client-side and rendered as chips. Plain prose still works; the block is stripped so nothing leaks.Changes
chat.go:chatQuestionGuidanceprepended on the first turn (page-independent; later turns inherit via--resume). Reaches every host chat — global dock, project, PR review.ChatPanel+lib/chatQuestion.ts: parse the latest assistant message for the block when idle; render the question + option chips; a click sends the option (reuses the queue-awaresendPrompt).TestWithContextHintfor the new first-turn prefix.Verified
Mocked chat WS: the assistant's prose renders, the fenced block becomes clickable Staging / Production chips (raw block stripped), and clicking sends the option as the next turn (
prompts_sent=["deploy the app","Production"]). Go tests + typecheck + build pass. Screenshot-confirmed.🤖 Generated with Claude Code