fix(server): thread search shows quoted text instead of the citation link#22391
Problem
Thread-search results show the stored t3-citation link instead of readable text when a matching message quotes an assistant reply (#22304). This affects sidebar search and the command palette.
Change
Build snippets from assistantCitationsToPlainText(row.matchText) before truncating them. Quotes become their text followed by any Comment: …, using the same helper as other previews and the merged mobile queue fix #19007. Web, desktop, mobile, and MCP t3_thread_search receive the same service result.
SQL matching and stored messages stay unchanged. Encoded phrase matching remains unresolved; a query found only in citation metadata can still return a result, whose readable snippet starts at the beginning of the message when the query is absent there.
Scope and approval
Refs #22304; it remains open for phrase matching. The issue is untriaged. This uses the focused obvious-bug exception: a user-facing snippet exposes internal link serialization instead of the quoted text. It reuses the existing preview helper without changing search matching or storage, and does not rely on the reporter's proposed fix as maintainer approval.
Verification
vp test run apps/server/src/orchestration-v2/ThreadSearch.test.ts: 4 passed. The new case stores a serialized quote with a comment and searchestalking; it fails on the base with link markup and passes with readable quote and comment text.- Targeted
vp lintandvp fmt --checkon both files pass.vp run --filter t3 typecheckpasses with existing Effect suggestions. - Real dev desktop app, isolated
.t3, throwawaydemoproject: selected an assistant sentence, used Cite selection in composer, added “what are you talking about”, sent it, then searchedtalkingin both entry points. Before images use the same data after restarting on the base'sThreadSearch.ts.
Command palette — before (base):
After (this branch):
Sidebar — before (base):
After (this branch):
The hidden dev window paused requestAnimationFrame. During citation creation only, a temporary DevTools runtime override used a timer to show the selection toolbar. No source file was patched for this; the override is outside the diff, and search ran without it.
Mobile was not manually checked; desktop was the manual client. The service test covers the shared snippet result.
Claude Opus 5.5 and GPT-6.1-Sol via T3 Code
Checks
Added 1 commit
- fix(server): thread search shows quoted text instead of the citation link9184a52
Approvability
Verdict: Approved at 9184a52
Macroscope's review found this PR approvable — This is a small, well-scoped bug fix that converts internal assistant-citation markup into readable text only when building existing thread-search snippets. Search matching, persistence, and other runtime paths remain unchanged, and the regression test covers the new behavior.
You can add or adjust custom eligibility rules. Learn more.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
daed8014-f859-460e-8dca-f1654440bb62
📥 Commits
Reviewing files that changed from the base of the PR and between 9184a524fd96c8cc46739e3f75009ef91209d7b8 and 18b51b518e815c2858dc4a8566180c6cf41a86ab.
📒 Files selected for processing: 1
apps/server/src/orchestration-v2/ThreadSearch.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
📝 Walkthrough
Thread search now converts assistant citations to plain text when it builds result snippets. An integration test checks that a search result includes the quoted assistant text and its associated comment.
Changes: Thread Search Citation Snippets
Layer / File(s) Summary Convert citations in search snippets
apps/server/src/orchestration-v2/ThreadSearch.ts,apps/server/src/orchestration-v2/ThreadSearch.test.tsThread search builds snippets from citation-converted text instead of raw matched message text. The integration test verifies that the result includes the quoted assistant text and its comment. Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Suggested reviewers:
juliusmarminge
Merge Risk: ⚪ Minimal · up to 18b51
Thread-search snippets show readable citation text for the tested case. No issue requiring a fix before merge is established.
Architecture risk: 🔵 Low · up to 18b51
The change affects 1 system.
Changed systems:
apps/serverArchitecture concerns No architecture-level concerns identified.
Review details
Systems and components
- observed — apps/server (service) was modified; 2 changed files map to changed impact.
Before / after behavior
- observed — Modified behavior in apps/server/src/orchestration-v2/ThreadSearch.ts: Adds the assistant-citation text conversion dependency used by thread search results.
- observed — Modified behavior in apps/server/src/orchestration-v2/ThreadSearch.ts: Search result snippets are now built from citation-converted plain text rather than the raw matched message text.
- observed — Modified behavior in apps/server/src/orchestration-v2/ThreadSearch.test.ts: Added the
EnvironmentIdcontract import for constructing citation test data. - observed — Modified behavior in apps/server/src/orchestration-v2/ThreadSearch.test.ts: Added the
serializeAssistantCitationhelper import.
Pre-merge checks: Passed 4
Check name Status Explanation Title check Passed The title clearly identifies the server-side thread-search fix and the user-visible change from citation links to quoted text. Description check Passed The description includes the required Problem, Change, Scope and approval, and Verification sections. It explains the behavior, implementation, scope, tests, manual checks, screenshots, and limitation… Linked Issues check Passed Issue #19007is closed and supplies historical context only. It creates no active coding requirement for this pull request. The reviewed change converts assistant citations to readable text in thread-…Out of Scope Changes check Passed The change is limited to ThreadSearch.tsand its test. Citation conversion supports the thread-search snippet objective. The regression test supports that implementation. No unrelated change is show…Full details: Description check
Explanation
The description includes the required Problem, Change, Scope and approval, and Verification sections. It explains the behavior, implementation, scope, tests, manual checks, screenshots, and limitations.
Full details: Linked Issues check
Explanation
Issue
#19007is closed and supplies historical context only. It creates no active coding requirement for this pull request. The reviewed change converts assistant citations to readable text in thread-search snippets and adds regression coverage for quoted text and comment text, consistent with the pull request objective.
Full details: Out of Scope Changes check
Explanation
The change is limited to
ThreadSearch.tsand its test. Citation conversion supports the thread-search snippet objective. The regression test supports that implementation. No unrelated change is shown.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Added 1 commit
- Merge remote-tracking branch 'upstream/main' into fix/22304-search-snippet-citations18b51b5