[Bug]: Assistant citations render as raw t3-citation markup in queued messages #12331
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/web
Steps to reproduce#
- Cite an assistant response so the composer contains
[Assistant quote](t3-citation://v1/...)(introduced in #9146). - While the agent turn is still running, send it so it lands as a queued follow-up message.
- Look at the queued bubble (dashed border, ClockIcon + Queued footer).
Expected behavior#
The queued bubble renders the citation the same way a sent user message does — via ChatMarkdown + AssistantCitationChip — or at least a readable quote label, not the raw link destination.
Actual behavior#
The queued bubble shows the raw markdown literally:
[Assistant quote](t3-citation://v1/...?text=Yes+...&start=0&end=276&prefix=&suffix=...&comment=...)
with the percent-encoded quote text spilling across lines. Once the turn ends and the message sends normally, it renders correctly. Screenshot: queued bubble shows the full raw t3-citation://v1/8baf8577-.../assistant%3A...?text=Yes+...%E2%80%9E...%29%2C+and+as+spot+rallies+... link followed by the typed reply ("guessing i'd already get most of the delta/ars from atm positions").
Likely cause: QueuedMessageTimelineRow in apps/web/src/components/chat/MessagesTimeline.tsx renders queuedMessage.prompt as plain whitespace-pre-wrap text, while UserTimelineRow -> CollapsibleUserMessageBody -> UserMessageBody -> ChatMarkdown (which allowlists t3-citation and returns AssistantCitationChip per ChatMarkdown.tsx:483,2858-2859, parsed via packages/shared/src/assistantCitations.ts).
Related but distinct: #11341 (raw :codex-followup), #11810 (malformed markdown links as raw text), #5813 (raw codex-file-citation), #9605 (Codex source citations, different scheme).
Impact#
Minor bug or occasional failure
Version or commit#
upstream main as of 2026-09-17 (citation feature from #9146, merged 2026-09-02)
Environment#
web
Workaround#
Wait until the turn ends so the message sends normally instead of queueing.
Triage#
Decision: Accept Classification: Bug Severity: Minor (P3) Confidence: High Repro: Source-confirmed. Reporter steps and screenshot are sufficient; no extra environment details are required. Area:
apps/web(chat timeline queued bubble). Desktop shares this row. Mobile is a different renderer.Already fixed on
main? No (6deac7a92). Also present on v0.0.42. Duplicate of: none.Summary#
Confirmed. Citing an assistant response serializes as
[Assistant quote](t3-citation://v1/...)in the composer. A sent user bubble runs that string throughChatMarkdown, which allowlistst3-citationand returnsAssistantCitationChip. A follow-up queued while the turn is still running does not:QueuedMessageTimelineRowprintsqueuedMessage.promptas plainwhitespace-pre-wraptext, so the percent-encoded href spills across the dashed bubble until the turn ends and the message sends normally.This is leftover from #11673 (queued follow-ups, merged 2026-09-15), not a break in #9146 (citations, merged 2026-09-02). The queue path stored the raw citation markdown and never reused the sent-message renderer.
The screenshot matches: raw
t3-citation://v1/8baf8577-…link, then the typed reply, then Clock + Queued / send / cancel.Diagnosis#
Composer citations are self-contained Markdown links. That is intentional and unchanged:
export function serializeAssistantCitation(citation: AssistantCitation): string { return `[Assistant quote](${formatAssistantCitationHref(citation)})`; }While a turn is running and follow-up behavior is queue,
ChatViewenqueues that raw prompt. The queued bubble then renders the string literally:const text = queuedMessage.prompt.trim(); // ... {text.length > 0 ? ( <div className="whitespace-pre-wrap break-words text-sm">{text}</div> ) : null}A sent user row goes through
UserTimelineRow→CollapsibleUserMessageBody→UserMessageBody→ChatMarkdown, which already allowlistst3-citationand returnsAssistantCitationChip.Same class of leak: a queued
t3-context://file/terminal chip would also show as a raw link. Out of scope for this report, but the sameChatMarkdownpass would cover it. No new citation protocol or store change is needed.Mobile is not this bug. Pending outbox rows are fake user messages and run
renderAssistantCitationsAsTextbefore markdown, so they become readable> Assistant quote:blocks instead of a raw href.Related issues#
Not a duplicate. Same class (raw markup in chat) as the Codex issues, different scheme and surface:
Issue Why different #9146 Shipped citations. Sent user messages and the composer already chip them. This gap is the later queued row. #11341 Raw :codex-followupin assistant completions.#11810 Malformed Codex markdown links in assistant output. #5813 Closed. Raw :codex-file-citationartifacts.#9605 Codex source citations ( :codex-citation), different scheme.Recommended next step#
Accept and fix in
apps/webonly:- Render
queuedMessage.promptwithChatMarkdown(reuseUserMessageBodyif the queued bubble can takeskills/markdownCwdfromTimelineRowCtx). Do not add a second citation parser. - Keep the dashed chrome, Clock + Queued footer, and send/edit/remove actions.
- Add a focused test that a queued prompt containing
serializeAssistantCitation(...)does not dump the rawt3-citation://href and does renderAssistantCitationChip. - Optional: the same pass will chip
t3-contextlabels ifrenderContextReferenceis wired; not required to close this.
Do not change
serializeAssistantCitation, the enqueue payload, or provider expansion (expandAssistantCitationsForProvider). Those paths are fine; only the queued preview is wrong.Workaround#
Wait until the turn ends so the follow-up sends as a normal user message, which already renders the chip. No settings workaround.
- Render
juliusmarminge added labelsbug
juliusmarminge added labelsaccepted
juliusmarminge added labelsvia-triage
maria-rcks closed this
Sign in to join this conversation.
Screenshot from the report (hosted on my fork since I can't attach files here directly):