Repository navigation
chat: index only content Find can reveal - #330585
Merged
Osvaldo Ortega (osortega) merged 2 commits intoAug 13, 2026
Merged
Conversation
Find reported matches it could not navigate to. Searching a long transcript
showed a count that fell as rows rendered (9999 -> 4013 -> 3793 in one
session), navigation that moved the counter without moving the view, and
repaints that scanned thousands of matches to locate almost none.
The index reused the accessible view's extraction, which describes a
response to a screen reader rather than mirroring what is drawn. It
synthesizes text with no on-screen equivalent ("Input:", "Errored", MCP
authentication prompts) and includes tool result payloads, so the painter
had nothing to highlight for those matches.
Give Find its own extraction covering markdown, inline reference labels,
elicitations and error details. Reasoning and tool invocations are left
out: where a tool renders is decided while rendering (the renderer assigns
isAttachedToThinking), so indexing them made the count depend on how far
the transcript had drawn, and a row that had not yet been drawn contributed
matches that vanished once it was.
Also skip matches whose row is not rendered before scanning its parts, and
advance past any match the DOM cannot produce so navigation never appears
to do nothing.
Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces renderer-aligned chat Find indexing to reduce phantom matches and stabilize navigation.
Changes:
- Adds Find-specific response text extraction.
- Skips unrendered rows during repaint.
- Advances past unlocatable matches and adds model regressions.
Show a summary per file
| File | Description |
|---|---|
chatFindContent.ts |
Defines searchable response content. |
chatFindModel.ts |
Uses the new extraction logic. |
chatFindWidget.ts |
Optimizes repainting and navigation. |
chatFindModel.test.ts |
Tests tool exclusion and stable counts. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Suppressed comments (3)
src/vs/workbench/contrib/chat/browser/widget/chatFind/chatFindContent.ts:57
renderAsPlaintextis still configured to synthesize text that the row never renders:includeCodeBlocksFencesinjects literal ``` delimiters, anduseLinkFormatterinvents a basename for an empty link (`markdownRenderer.ts:803-815`). Queries matching either value are therefore counted but cannot be located in the DOM/editor. Use the default plaintext renderer here so the indexed markdown mirrors visible text.
const text = renderAsPlaintext(part.content, { includeCodeBlocksFences: true, useLinkFormatter: true });
src/vs/workbench/contrib/chat/browser/widget/chatFind/chatFindContent.ts:54
- Filtered responses do not render any
response.valueparts (chatListRenderer.ts:1602-1612), but this loop still indexes their markdown, references, and elicitations. Those matches remain phantom results; return after collecting the visible error text whenresponseIsFilteredis set.
item.response.value.forEach((part, partIndex) => {
src/vs/workbench/contrib/chat/browser/widget/chatFind/chatFindContent.ts:82
- Hidden elicitations are indexed even though the renderer returns a no-content part for them (
chatListRenderer.ts:3704-3707). This recreates an unlocatable match whenever either the live observable or serializedisHiddenflag is true; apply the same visibility check before extracting the title/message.
case 'elicitation2':
case 'elicitationSerialized': {
const title = isMarkdownString(part.title) ? renderAsPlaintext(part.title) : part.title;
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Balanced
Address review feedback on the Find index. Error details were indexed unconditionally, but the renderer omits the error part for canceled or non-final responses and replaces the message with fixed copy for the quota and anonymous rate-limit variants. Mirror those conditions, and render the message as plaintext since it is drawn as markdown. Markdown was extracted with code fences and link formatting enabled. The ``` markers are consumed by the code block and an empty link renders as an empty anchor, so both contributed text that was counted but absent from the DOM. Add regression coverage for the walk past unlocatable matches, proving it keeps the requested direction, stops at the cap, and lands on a later locatable match. Co-authored-by: Copilot <[email protected]>
Osvaldo Ortega (osortega)
marked this pull request as ready for review
August 13, 2026 02:26
Osvaldo Ortega (osortega)
enabled auto-merge (squash)
August 13, 2026 02:26
Dirk Bäumer (dbaeumer)
approved these changes
Aug 13, 2026
Osvaldo Ortega (osortega)
deleted the
osortega/agents/chat-find-reachable-matches
branch
August 13, 2026 05:35
This was referenced Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #330340. Fixes Find reporting matches it cannot navigate to.
Symptoms
Searching a common word in a long transcript showed:
9999 → 4013 → 3793, another5949 → 705 → 240 → 123Cause
The index reused
getChatResponsePlaintextParts, the accessible view's extraction. That function describes a response to a screen reader rather than mirroring what is drawn, so it:Input:,Files:,Errored, MCP authentication promptsMatches in that text were counted, but the painter had nothing to highlight.
The count instability had a sharper cause:
isAttachedToThinkingis assigned by the renderer while drawing a row. A row that had not yet rendered looked un-grouped, so its tools were indexed; once drawn, they were excluded and those matches vanished. Navigating toward one meant targeting a match that ceased to exist.Changes
New
chatFindContent.ts— a Find-specific extraction covering markdown, inline reference labels, elicitations and error details.Reasoning and tool invocations are deliberately not indexed. Where a tool renders is decided during rendering, and reasoning bodies are built on expansion; indexing either makes the count depend on how far the transcript has drawn. This is the "start small" position — broadening it needs a typed expansion API on
ChatCollapsibleContentPart, tracked separately.Repaint skips unrendered rows. One memoized row lookup before scanning parts. In a captured trace, 51,298 of 51,363 locate attempts were for rows that were not on screen.
Navigation advances past unlocatable matches (bounded at 50), so Next never appears to do nothing if a prediction is still wrong.
Tradeoff
Text inside a tool pill — including a terminal command header — is no longer searchable. Those matches were real and highlighted correctly, but keeping them requires reading render-time state, which is what produced the phantom results.
Testing
isAttachedToThinkingafter indexing and asserts the count is unchangedtypecheck-client,valid-layers-check, ESLint cleanDiagnosed from console traces captured behind a temporary flag; the scaffolding is removed from this branch.