Skip to content

Render apply_patch as an edit tool#315419

Draft
roblourens wants to merge 1 commit intomainfrom
agents/vsckb-implement-when-edits-are-made-with-gpt-e3bfe095
Draft

Render apply_patch as an edit tool#315419
roblourens wants to merge 1 commit intomainfrom
agents/vsckb-implement-when-edits-are-made-with-gpt-e3bfe095

Conversation

@roblourens
Copy link
Copy Markdown
Member

Summary

  • render apply_patch/git_apply_patch with edit-style patch messages instead of the generic tool fallback
  • extract affected paths from apply patch and git patch payloads so patch changes flow through file-edit tracking
  • add focused coverage for apply_patch display and affected-file extraction

Validation

  • npm run compile-check-ts-native
  • npm run gulp compile
  • ./scripts/test.sh --run src/vs/platform/agentHost/test/node/copilotToolDisplay.test.ts
  • npm run valid-layers-check

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 9, 2026 01:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Copilot CLI tool rendering and file-edit tracking in the agent host by treating apply_patch / git_apply_patch as first-class edit tools (with edit-style messaging) and extracting affected file paths from patch payloads so edits can be tracked across multiple files.

Changes:

  • Add explicit invocation/past-tense display strings and tool-input rendering for apply_patch / git_apply_patch.
  • Extract affected file paths from apply-patch and git-diff patch text and use them to drive FileEditTracker lifecycle for patch tools.
  • Add focused unit coverage for patch display and affected-file extraction.
Show a summary per file
File Description
src/vs/platform/agentHost/test/node/copilotToolDisplay.test.ts Adds tests for patch tool display strings and affected-file extraction.
src/vs/platform/agentHost/node/copilot/mapSessionEvents.ts Hardens tool-argument JSON parsing (only accepts plain objects).
src/vs/platform/agentHost/node/copilot/copilotToolDisplay.ts Implements patch-tool messaging, tool input selection, and patch path extraction helpers.
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts Tracks multiple edited files per tool call and hardens argument parsing.

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 1

Comment on lines +237 to +240
const gitDiffMatch = line.match(/^diff --git a\/(?<before>.+) b\/(?<after>.+)$/);
if (gitDiffMatch?.groups) {
addPath(gitDiffMatch.groups.after);
continue;
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 9, 2026

blocks-ci screenshots changed

Replace the contents of test/componentFixtures/blocks-ci-screenshots.md with:

Updated blocks-ci-screenshots.md
<!-- auto-generated by CI — do not edit manually -->

#### editor/codeEditor/CodeEditor/Dark
![screenshot](https://hediet-screenshots.azurewebsites.net/images/67bfb687fd2818bd53771a60660541b9ed6f38b80d37da0aac15d267ecaeacec)

#### editor/codeEditor/CodeEditor/Light
![screenshot](https://hediet-screenshots.azurewebsites.net/images/0469dd8d0a587d94a1eaec514c79917b93b9a38694ef2b767bb1892819ae0a55)

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Dark
![screenshot](https://hediet-screenshots.azurewebsites.net/images/97162fc53c861ee13dc78a18e41fe3a25a42f62dc52a560510ebf084a418e1c3)

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Light
![screenshot](https://hediet-screenshots.azurewebsites.net/images/3b7e2eb5cc9ba727e2bc1c5113c3e17d8e9a6ce9a37b77519be3716ceb9a9afa)

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Dark
![screenshot](https://hediet-screenshots.azurewebsites.net/images/97162fc53c861ee13dc78a18e41fe3a25a42f62dc52a560510ebf084a418e1c3)

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Light
![screenshot](https://hediet-screenshots.azurewebsites.net/images/3b7e2eb5cc9ba727e2bc1c5113c3e17d8e9a6ce9a37b77519be3716ceb9a9afa)

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