Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Assistant citations render as raw t3-citation markup in queued messages #12331

Closedrepparw(GitHub profile, opens in a new tab) opened this issue 2 comments

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

  1. Cite an assistant response so the composer contains [Assistant quote](t3-citation://v1/...) (introduced in #9146).
  2. While the agent turn is still running, send it so it lands as a queued follow-up message.
  3. 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.

  1. Screenshot from the report (hosted on my fork since I can't attach files here directly):

    Queued message showing raw Assistant quote t3-citation markup

  2. 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 through ChatMarkdown, which allowlists t3-citation and returns AssistantCitationChip. A follow-up queued while the turn is still running does not: QueuedMessageTimelineRow prints queuedMessage.prompt as plain whitespace-pre-wrap text, 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, ChatView enqueues 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 allowlists t3-citation and returns AssistantCitationChip.

    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 same ChatMarkdown pass 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 renderAssistantCitationsAsText before markdown, so they become readable > Assistant quote: blocks instead of a raw href.

    Not a duplicate. Same class (raw markup in chat) as the Codex issues, different scheme and surface:

    IssueWhy different
    #9146Shipped citations. Sent user messages and the composer already chip them. This gap is the later queued row.
    #11341Raw :codex-followup in assistant completions.
    #11810Malformed Codex markdown links in assistant output.
    #5813Closed. Raw :codex-file-citation artifacts.
    #9605Codex source citations (:codex-citation), different scheme.

    Accept and fix in apps/web only:

    1. Render queuedMessage.prompt with ChatMarkdown (reuse UserMessageBody if the queued bubble can take skills / markdownCwd from TimelineRowCtx). Do not add a second citation parser.
    2. Keep the dashed chrome, Clock + Queued footer, and send/edit/remove actions.
    3. Add a focused test that a queued prompt containing serializeAssistantCitation(...) does not dump the raw t3-citation:// href and does render AssistantCitationChip.
    4. Optional: the same pass will chip t3-context labels if renderContextReference is 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.

  3. juliusmarminge added labelsbug

  4. juliusmarminge added labelsaccepted

  5. juliusmarminge added labelsvia-triage

  6. maria-rcks closed this

Sign in to join this conversation.