AH: show warning message when restoring edits - #321028
Open
justschen wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the chat editing session API so the “restore checkpoint / undo requests” confirmation can correctly detect modified files even for agent-host-backed sessions (where edits are applied externally and entries is empty). This enables showing the intended warning message when restoring a checkpoint that would discard edits.
Changes:
- Added
IChatEditingSession.getModifiedFileResourcesForRequests(...)to query de-duplicated modified resources for a set of request IDs. - Implemented the API for both in-memory chat editing sessions (
ChatEditingSession) and agent-host sessions (AgentHostSnapshotController). - Updated confirmation messaging logic to use the new API (instead of
session.entries) and added a unit test for agent-host resource de-duplication.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/common/editing/chatEditingService.ts | Extends IChatEditingSession with getModifiedFileResourcesForRequests and documents intended usage. |
| src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.ts | Implements resource collection + de-duplication for normal (entry-backed) editing sessions. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSnapshotController.ts | Implements resource collection + de-duplication for agent-host sessions by walking checkpoint edits. |
| src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.ts | Uses the new API to decide whether to prompt and to populate prompt content/counts. |
| src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts | Mirrors the confirmation logic update for the submit/execute flow. |
| src/vs/workbench/contrib/chat/test/browser/agentHost/agentHostSnapshotController.test.ts | Adds a test for de-duped modified resources from agent-host checkpoints. |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 1
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
justschen
marked this pull request as ready for review
June 11, 2026 22:34
justschen
enabled auto-merge (squash)
June 12, 2026 00:40
justschen
disabled auto-merge
June 12, 2026 00:41
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.
when restoring checkpoint that would overwrite or make edits, make sure that we show the user this