Skip to content

fix(vscode): match chat search against message text only - #14210

Merged
marius-kilocode merged 3 commits into
mainfrom
refactor-search-scope-to-messages
Sep 16, 2026
Merged

marius-kilocode merged 3 commits into
mainfrom
refactor-search-scope-to-messages

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

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 user and assistant text parts, 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/forceOpenFile props and the now unreachable forceOpenFile path in kilo-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 eslint on every touched file, bun run knip, and the kilo-vscode unit suite. The new packages/kilo-vscode/tests/unit/transcript-search-text.test.ts locks 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 rg runs, and a wc -l) and reasoning effort set to High:

Query Result
zebra (user prompt and assistant reply) 1 / 2
first command listed 60 files (assistant reply) 1 / 1
SessionDock.tsx, abort-state.ts (bash output only) No results
kilo-transcript-search-match (bash output only, three lines) No results
MATCH_NAME, ls -1 packages, rg -n (user prompt once, tool input once) 1 / 1, tool input not counted
packages/kilo-vscode/webview-ui/src/context (prompt and bash command) 1 / 1, command not counted

Chat search matching message text only, with bash output in the same session left unhighlighted

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.

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.
Comment thread packages/kilo-vscode/tests/unit/transcript-search-text.test.ts
@kilo-code-bot

kilo-code-bot Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Both previous suggestions were resolved in a955c15e69: the now-unused const id was removed from QuestionDock.tsx, and the markdown-stripping test now asserts ranges against the stripped length ({ start: 0, end: 18, partId: "text-1" }), which matches the helper's stripped-text range computation. No new issues found on the incremental changes.

Files Reviewed (2 unchanged-scope files re-verified)
  • packages/kilo-vscode/tests/unit/transcript-search-text.test.ts - resolved
  • packages/kilo-vscode/webview-ui/src/components/chat/QuestionDock.tsx - resolved
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

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/kilo-vscode/webview-ui/src/components/chat/QuestionDock.tsx 60 const id at line 28 is now unused after the search-tab tracking removal
packages/kilo-vscode/tests/unit/transcript-search-text.test.ts 56 Assistant markdown-stripping test does not assert ranges

No functional defects found. The refactor cleanly narrows search to user/assistant text parts, and the removed forceOpen/partFile/question-tab plumbing has no remaining consumers or dangling references. It also removes module-level activeQuestionTabs state, so no new leaks are introduced.

Files Reviewed (11 files)
  • .changeset/chat-search-messages-only.md - no issues
  • packages/kilo-ui/src/components/message-part.tsx - no issues
  • packages/kilo-vscode/tests/unit/transcript-search-text.test.ts - 1 issue
  • packages/kilo-vscode/webview-ui/src/components/chat/AssistantMessage.tsx - no issues
  • packages/kilo-vscode/webview-ui/src/components/chat/MessageList.tsx - no issues
  • packages/kilo-vscode/webview-ui/src/components/chat/QuestionDock.tsx - 1 issue
  • packages/kilo-vscode/webview-ui/src/components/chat/TranscriptRow.tsx - no issues
  • packages/kilo-vscode/webview-ui/src/components/chat/question-dock-utils.ts - no issues
  • packages/kilo-vscode/webview-ui/src/components/chat/transcript-search-highlight.ts - no issues
  • packages/kilo-vscode/webview-ui/src/components/chat/transcript-search-text.ts - no issues
  • packages/kilo-vscode/webview-ui/src/context/transcript-search.tsx - no issues

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants