agentHost: show rich diffs when requesting write confirmations#311025
Merged
connor4312 merged 6 commits intomainfrom Apr 17, 2026
Merged
agentHost: show rich diffs when requesting write confirmations#311025connor4312 merged 6 commits intomainfrom
connor4312 merged 6 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for showing rich file diffs when an agent host tool requests write confirmation, by transporting “before/after” content references through the agent-host protocol and wiring them into the chat confirmation UI.
Changes:
- Extend protocol and chat data models to carry pending file-edit previews (including separate original/modified content URIs).
- Generate and serve transient “after” content for write permission requests via an in-memory file provider (
pending-edit-content:). - Update chat UI/tool invocation adapter to render modified-files confirmations (single diff + multi-diff), and adjust tests accordingly.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/test/browser/agentSessions/stateToProgressAdapter.test.ts | Updates adapter tests for new connectionAuthority parameter. |
| src/vs/workbench/contrib/chat/common/chatService/chatService.ts | Adds modifiedUri to references and extends modified-files confirmation data with content URIs. |
| src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatModifiedFilesConfirmationSubPart.ts | Uses optional original/modified content URIs when opening diffs and multi-diff editor. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/stateToProgressAdapter.ts | Maps pending edits into modified-files confirmation UI data; adds URI wrapping for remote agent-host URIs. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListController.ts | Aligns diff typing to protocol ISessionFileDiff. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts | Passes connectionAuthority through to active turn progress/tool invocation conversion. |
| src/vs/sessions/common/agentHostDiffs.ts | Uses protocol ISessionFileDiff type for diff-to-change mapping/equality. |
| src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts | Makes permission tests deterministic by waiting for tool_ready progress. |
| src/vs/platform/agentHost/node/copilot/pendingEditContentStore.ts | Introduces pending-edit-content: URI builder and provider registration helper. |
| src/vs/platform/agentHost/node/copilot/copilotToolDisplay.ts | Extends typed write permission requests with diff and newFileContents. |
| src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts | Builds file-edit previews for write permissions, writes “after” content to in-memory FS, cleans up on resolve/dispose. |
| src/vs/platform/agentHost/node/copilot/copilotAgent.ts | Updates SDK session config typing to ResumeSessionConfig. |
| src/vs/platform/agentHost/node/agentHostServerMain.ts | Registers pending-edit-content: provider on the agent host file service. |
| src/vs/platform/agentHost/node/agentHostMain.ts | Registers pending-edit-content: provider on the agent host file service. |
| src/vs/platform/agentHost/node/agentEventMapper.ts | Propagates edits into SessionToolCallReady actions. |
| src/vs/platform/agentHost/common/state/protocol/state.ts | Adds pending-confirmation edits and factors out shared IFileEdit interface. |
| src/vs/platform/agentHost/common/state/protocol/reducers.ts | Persists edits/editable on ready; applies editedToolInput on confirmation. |
| src/vs/platform/agentHost/common/state/protocol/actions.ts | Updates generated action typings for edits/editable/editedToolInput. |
| src/vs/platform/agentHost/common/state/protocol/.ahp-version | Bumps protocol sync version. |
| src/vs/platform/agentHost/common/agentService.ts | Adds edits to IAgentToolReadyEvent payload. |
Copilot's findings
- Files reviewed: 20/20 changed files
- Comments generated: 3
Contributor
roblourens
previously approved these changes
Apr 17, 2026
lszomoru
previously approved these changes
Apr 17, 2026
connor4312
added a commit
that referenced
this pull request
Apr 17, 2026
rzhao271
approved these changes
Apr 17, 2026
This was referenced Apr 21, 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.
No description provided.