agents: render Copilot CLI 'rg' search tool#313838
Merged
roblourens merged 7 commits intomainfrom May 2, 2026
Merged
Conversation
The Copilot CLI emits both 'grep' and 'rg' search tool calls, but the
agent-host only recognized 'grep'. 'rg' calls fell through to generic
'Using "rg"' / 'Used "rg"' messages.
Add 'rg' as a first-class tool in copilotToolDisplay.ts with its own
typed args interface (matching the CLI parity reference), display name
'Search', and 'Searching for {pattern}' / 'Searched for {pattern}'
messages mirroring the existing 'grep' wording. Also broaden
ICopilotGrepToolArgs to match the current CLI schema.
(Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class display support for the Copilot CLI rg search tool in the agent-host so rg tool calls render like grep (as “Search”) instead of falling back to the generic “Using/Used …” messaging.
Changes:
- Add
rgto the known Copilot tool names and implement dedicated display/invocation/past-tense/input-string handling. - Expand the typed
grepargs schema to match current CLI behavior and introduce a parallelrgargs interface. - Add focused unit tests covering
rg/grepinvocation & completion messages andgetToolInputString.
Show a summary per file
| File | Description |
|---|---|
src/vs/platform/agentHost/node/copilot/copilotToolDisplay.ts |
Adds rg tool support and updates grep/rg argument typing + message rendering. |
src/vs/platform/agentHost/test/node/copilotToolDisplay.test.ts |
Adds tests validating rg/grep rendering parity and pattern extraction. |
Copilot's findings
Comments suppressed due to low confidence (1)
src/vs/platform/agentHost/node/copilot/copilotToolDisplay.ts:450
- Same localization duplication concern as in
getInvocationMessage:toolComplete.rgPattern/toolComplete.rgintroduce new keys even though the text matches thegrepcompletion messages. Reusing thegrepkeys until divergence would reduce translation churn.
case CopilotToolName.Rg: {
const args = parameters as ICopilotRgToolArgs | undefined;
if (args?.pattern) {
return md(localize('toolComplete.rgPattern', "Searched for {0}", appendEscapedMarkdownInlineCode(truncate(args.pattern, 80))));
}
return localize('toolComplete.rg', "Searched files");
}
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Remove bare filename reference from ICopilotGrepToolArgs doc comment - rg cases reuse toolInvoke.grepPattern/grep and toolComplete.grepPattern/grep instead of introducing duplicate localization keys with identical strings (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
blocks-ci screenshots changedReplace the contents of Updated blocks-ci-screenshots.md<!-- auto-generated by CI — do not edit manually -->
#### editor/codeEditor/CodeEditor/Dark

#### editor/codeEditor/CodeEditor/Light

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Dark

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Light

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Dark

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Light
 |
- Add SEARCH_TOOL_NAMES set (grep, rg) in copilotToolDisplay.ts; getToolKind() returns 'search' for these tools
- Widen toolKind type to include 'search' in mapSessionEvents.ts, sessionReducers.ts, and IHistoryToolStartRecord
- Add IChatSearchToolInvocationData { kind: 'search' } to chatService.ts and all toolSpecificData union types
- stateToProgressAdapter: set toolSpecificData = { kind: 'search' } for completed and running search tools
- chatToolInvocationSubPart.ts: getIcon() returns Codicon.search (spinning while running) for search tools
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…icData Revert the 'search' toolKind / IChatSearchToolInvocationData approach from the previous commit. Instead, use the existing getToolInvocationIcon() function (chatThinkingContentPart.ts) which already returns Codicon.search for tool IDs containing 'grep', 'search', the same mechanism used by EH CLI sessions.etc. Changes: - Add 'rg' exact-match to getToolInvocationIcon()'s search condition - getIcon() in BaseChatToolInvocationSubPart now calls getToolInvocationIcon(toolId) instead of hardcoding Codicon.check / Codicon.loading, so all tools show their semantic icon (search, pencil, terminal, etc.) rather than a generic check/spinner - Revert all IChatSearchToolInvocationData / toolSpecificData / getToolKind changes (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…olSpecificData" This reverts commit 1ad9ff2.
(Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The rg/grep tools were showing two icons per row: - Outer icon: generic tools (Codicon.tools) from chatThinkingContentPart - Inner icon: Codicon.search from getIcon() in BaseChatToolInvocationSubPart This is inconsistent with how terminal tools work (outer=terminal, inner=check/spinner). Fix: - chatThinkingContentPart: detect toolSpecificData.kind === 'search' and show Codicon.search as the outer type-icon (same pattern as the isTerminalTool check) - chatToolInvocationSubPart: remove the search-specific case from getIcon() so the inner icon reverts to normal check/spinner status icons Result: outer=search (type), inner=check/spinner (status) - consistent with terminal. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dileepyavan
approved these changes
May 2, 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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds first-class rendering for the Copilot CLI
rgandgrepsearch tools in VS Code's agent host.Changes
Tool display (
copilotToolDisplay.ts)rgas a first-class tool alongsidegrepSearching for "{pattern}"while running andSearched for "{pattern}"when completeICopilotGrepToolArgs/ICopilotRgToolArgsinterfaces matching the EH-CLIGrepToolschemargreuses thegrepl10n keys to avoid duplicate strings for translatorsSearch icon pipeline
IChatSearchToolInvocationData { kind: 'search' }to thetoolSpecificDatadiscriminated uniongetToolKind()incopilotToolDisplay.tsreturns'search'for grep/rg toolsstateToProgressAdapter.tssetstoolSpecificData = { kind: 'search' }for running and completed search toolschatThinkingContentPart.tsdetectstoolSpecificData.kind === 'search'and showsCodicon.searchas the outer type-icon — consistent with how terminal tools useisTerminalToolto showCodicon.terminalgetIcon()inBaseChatToolInvocationSubPartas normalTests
copilotToolDisplay.test.tscovering rg/grep invocation and past-tense messages(Written by Copilot)