Repository navigation
fix(vscode): match chat search against message text only - #14210
Conversation
Chat transcript search indexed every rendered chunk, so a single query matched hundreds of strings inside bash output, tool inputs, reasoning blocks, file names, and error cards. Search now scans only user and assistant message text through a shared rowSearchText helper. The tool-rendering mirror code and the force-open plumbing it required are removed, including the now unreachable apply_patch forceOpenFile path in kilo-ui.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Both previous suggestions were resolved in Files Reviewed (2 unchanged-scope files re-verified)
Previous Review Summary (commit b7ebdc5)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit b7ebdc5)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
No functional defects found. The refactor cleanly narrows search to user/assistant Files Reviewed (11 files)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
…sertion Review follow-up: the question dock id local lost its last reader when the chat-search active-tab tracking was removed, and the markdown-stripping search test now asserts the character range so the stripped-length contract is covered.
What Problem This Solves
In-chat search (Ctrl/Cmd+F in the transcript) matched every rendered chunk of a turn: bash commands and stdout, every other tool's input and output, reasoning blocks, edit and apply_patch file names, diagnostics, question options, and error cards. A common word in a long session returned hundreds of matches, almost none of them in the conversation text, so the counter, next/previous navigation, and highlights stopped being useful.
Why This Change Was Made
The search index is now built by one small pure helper that walks only
userandassistanttextparts, skips synthetic parts, and strips markdown link URLs for assistant text so counts still mirror the visible characters. The user text path is unchanged, since user messages render literally and never parse markdown.Everything that existed only to mirror tool renderers into searchable text is deleted: roughly 370 lines of per-tool extraction (bash, read/glob/grep/list, edit/write with diagnostics, apply_patch, todowrite, task, question, MCP output, generic string collection), the error-card classification, and the character-range file attribution that only apply_patch needed. The "force the collapsed part containing the active match open" plumbing is gone with it, including its
forceOpenPartID/forceOpenFileprops and the now unreachableforceOpenFilepath inkilo-ui's apply_patch accordion. Nothing collapsible is searched anymore, so that path had no caller left.Question-dock active-tab tracking existed solely to tell search which page of a multi-question prompt was mounted, so that signal and its two call sites are removed as well.
User Impact
Searching a session now finds message text only. Reasoning, tool calls, tool output, attachment names, and error cards no longer produce matches, and the count is small enough to be meaningful.
Aa, whole word, and regex matching, next/previous navigation, "No results", and highlight behavior are unchanged for message text. A match can no longer live in a collapsed block, so nothing needs to be forced open to see the current match.Evidence
Checks on the merged tree:
bun run typecheck(host and webview),bunx eslinton every touched file,bun run knip, and thekilo-vscodeunit suite. The newpackages/kilo-vscode/tests/unit/transcript-search-text.test.tslocks the scope contract: message text only, synthetic parts skipped, markdown link URLs stripped for assistant text, user brackets kept, and diff and error rows empty.Manual verification in an isolated VS Code instance, on a session with four bash tool calls (a directory listing, two
rgruns, and awc -l) and reasoning effort set to High:zebra(user prompt and assistant reply)first command listed 60 files(assistant reply)SessionDock.tsx,abort-state.ts(bash output only)kilo-transcript-search-match(bash output only, three lines)MATCH_NAME,ls -1 packages,rg -n(user prompt once, tool input once)packages/kilo-vscode/webview-ui/src/context(prompt and bash command)Limitation: the tested model and configuration never emitted a mounted reasoning part, so reasoning exclusion is covered by the unit test rather than by a live match.