t3code icon indicating copy to clipboard operation
t3code copied to clipboard

Cite does not appear for text an agent sends with send_to_user

Open deondejongh opened this issue 2 weeks ago • 2 comments

What happened

When I select text in a message that the agent sent with send_to_user, the "Cite" button does not appear. Agents often send this text just before a question tool, so I cannot quote the context a question refers to. Selecting normal reply text in the same thread shows "Cite" as expected.

Diagnosis

SentMessageTimelineRow (apps/web/src/components/chat/TimelineAssistantRows.tsx) renders ChatMarkdown directly. It does not wrap it in AssistantCitationSource, the way AssistantTimelineRow does. captureAssistantTextSelection needs a [data-assistant-citation-source] ancestor, so it returns null and AssistantSelectionToolbar shows nothing.

A fix also needs an id for the citation: sent-message rows come from a dynamic_tool turn item, not an assistant message, and AssistantCitation.messageId is a MessageId. main is unchanged here.

Steps to reproduce

  1. In a Claude thread in T3 Code, ask the agent to show you some text with send_to_user, then ask you a question with AskUserQuestion.
  2. Select words in the send_to_user text. No "Cite" button appears.
  3. Answer the question. Select words in the reply text that comes after it. "Cite" appears.

Version

0.1.10-nightly.20261114.4682 (desktop app and local server, same build)

Environment

macOS (darwin arm64, 27.2.0), T3 Code Desktop against its local server, Claude Agent provider.

Evidence

The selected text is in turn item type `dynamic_tool`, `toolName: mcp__t3-code__send_to_user`, ordinal directly before the `AskUserQuestion` item. Screenshots attached.

Related issues

#35977 (mid-turn text visibility), PR #36384 (Claude can show mid-turn text in full), #31782 (Cite target).

Fix applied or workaround

None. Workaround: copy the text by hand into the composer.

Filed by

Claude Opus 5.5 in Claude Code, via T3 Code triage.

deondejongh avatar Nov 14 '26 17:11 deondejongh

No cite possible before AskUserQuestion tool / in send_to_user text:

SCR-20261114-qxfk

Cite possible only in text after the above:

SCR-20261114-qxhh

deondejongh avatar Nov 14 '26 17:11 deondejongh

🤖 Claude Opus 5.5, for Deon

Two open PRs use the same pattern that a fix here would need:

  • #33106 makes Cite work on HTML renders. Those are also dynamic_tool items, like send_to_user text. It wraps the row in AssistantCitationSource keyed by the item id, and citationProcedure.ts accepts a dynamic_tool item only when it is an HTML render. Extending that check to send_to_user items, and wrapping SentMessageTimelineRow the same way, would likely fix this issue.
  • #26616 makes proposed plans citable in the same way, keyed by the plan row id.

Neither PR touches send_to_user text today.

deondejongh avatar Nov 14 '26 17:11 deondejongh