Question card: inline Markdown in questions, options and descriptions draws as marks
Leo's ask, in his words: "ask user question tool and its various states need looking at allegedly there's some sort of vibe-coded thing that agents can do to have prettier ask question situations...? idk but we could look into that/research that then support it..."
Leo-ask: ask-427cc7d8f5
What was wrong
Agents write inline Markdown in AskUserQuestion text all the time:
codefor names and paths, as in "Which library shouldformatDateuse?"- bold for the important word
- "(Recommended)" labels next to italic asides
The question card drew the prompt, the option labels and the descriptions as plain text, so the backticks and asterisks showed. This is part 2 of 4 of the ask. Part 1 is #24348 (HTML previews); this branch is up to date with #24325, which has landed. The full research is in leo-workspace scratch/transcript-parity/askquestion-research.md.
The fix
question/inlineText.tsx draws the inline marks in a question's prompt, its option labels and their descriptions:
code- bold, which may hold italic and an escaped
\* - italic or italic
- struck
- a link, drawn as its label; its address may hold one level of parentheses
- a backslash escape, including
\$and\|
It reads the same shapes as the transcript's renderInline, with a few deliberate differences for short question text:
- Emphasis never starts or ends against a letter in any script, a digit,
/or\, and it needs text on both sides. Sosnake_case_name,src/_generated_/x.ts, URLs and*.ts or *.jsstay text. - A link label can't contain
[. - Every mark's body is a run of disjoint alternatives, so matching takes linear time. 50,000 unclosed
[take under a millisecond.
It draws marks only:
- An option row is a button, so a link draws as its label. A link or chip inside the row would take the click that answers it.
- Nothing loads, runs or opens.
- Plain text comes back as the same string.
- Markup stays text.
Anything that stores or compares answers still uses the raw strings: the answers keyed by prompt, the "Other" text, and the Swift side.
The answered summary draws the same marks. The preview caption reads the label without its markers (plainText). Inline code in the card sits on a faint tint in the mono face, at the line's own size.
Do not touch: the layout, hover and previews (#24325), plus other row kinds and every default.
Gallery
agent-pane.question-card-marks shows three looks of inline code, each in a single-select and a multi-select card:
- tint (shipped, my pick): it matches the transcript's inline code, so an agent's text reads the same in the card and in the chat.
- mono: the face only, no tint.
- ring: a hairline ring.
The alternatives are gallery CSS only.
Before/after (synthetic fixtures only), built at 2461c6f44d93: https://cmux-lawrences-mac-mini.tail137216.ts.net:18796/compare/tp-askquestion-markdown/?entry=question-card (tailnet). The gallery advisory run attaches the stills.
No capture: webview-only change.
Test
question/inlineText.test.tsx covers:
- Plain text is unchanged. Paths, URLs, globs,
2 * 3 * 4,café_bar_andsnake_case_nameare not read as marks. - Code, bold, italic and struck text draw as marks, as do bold with italic inside and bold with an escaped star.
- A link draws as its label, never as an anchor, including one whose address has parentheses.
- Escapes,
\$and\|included, draw their character. <img onerror>inside bold stays text.- Many marks around a link keep distinct React keys.
- 50,000 unclosed
[render as text in under 200 ms. plainTextreads a marked label without its markers.- The QuestionCard itself draws the marks in the prompt, label and description, and in the answered summary, with no backtick or
**left.
Observed / Not run
- huge-blue, at 2461c6f44d93f2cb87ef967395463913f0fe554c:
bun test src/agent-session/acpmux/question: 32 pass, 0 fail.bun run check: one failure, a format issue insrc/pages/settings/components/HostSections.tsx. This PR doesn't touch that file, it fails the same way at the base tip 0cb8ff22e8f, and #24440 (another lane) fixes it.
- Not run: the native Mac card (
CmuxNextAgentQuestion) still draws these strings as plain text. It is not the agent pane's card.
Changelog
Changed: An agent's question draws inline code, bold and italic text in its question, options and descriptions instead of showing backticks and asterisks.
Agent session: cosmic-gray
🤖 Generated with Claude Code