Review and revert agent changes
Use this guide to review agent changes, request revisions, and undo unwanted edits in a folder, worktree, or cloud session.
Choose your review approach
You can review agent changes in diffs. Depending on your harness and window, a working set also lets you keep or undo individual changes, files, or all pending edits. Use the table to find the review controls available for your setup.
| Setup | Primary review approach |
|---|---|
| Copilot harness in the editor window | Review pending edits in the working set. You can also compare diffs. |
| Claude or Codex harness in the editor window | Compare saved changes in diffs. |
| Agents window | Compare diffs in the Changes view. |
| Cloud session | Review pull request diffs. |
| Local harness The Local harness is deprecated and will be removed in February 2027. Move your workflows to the Copilot harness before then. Learn more about Local harness deprecation. | Review pending edits. See also Local-specific behavior. |
To check which harness your session uses, see Identify your current agent harness.
Agents can change files through editing tools, terminal commands, scripts, and MCP tools. Review the resulting files before you commit or integrate them, including changes that might not appear in a tool-specific list.
For keyboard and screen reader access to a diff, use the Accessible Diff Viewer, which presents changes in a unified patch format.
Review pending edits with the working set
When you use Copilot and Local harness The Local harness is deprecated and will be removed in February 2027. Move your workflows to the Copilot harness before then. Learn more about Local harness deprecation. sessions in the editor window, supported file edits are tracked as pending review (working set). Keep retains the changes and clears their pending-review state. Undo reverts them without rewinding the agent conversation.
Pending edits are already saved to disk, so running your application or tests uses the changed files. You don't need Git to review them, and Keep doesn't stage or commit them.
To review pending edits:
-
Open a file from the changed-files list in the Chat view.
-
Review the highlighted changes in the editor. Use the Up and Down controls in the editor overlay to navigate between edits.
-
Select Keep or Undo beside an individual change, or use the file-level or all-files review controls to resolve multiple pending edits at once.
Staging changes in the Source Control view automatically keeps the corresponding pending edits.
The working set only tracks changes from supported agent edit tools. Changes made through terminal commands, scripts, or other untracked tools don't appear. Review these changes separately, and use Source Control to inspect changed and untracked files when the folder uses Git.
Configure review controls
-
chat.editor.workingSet.enabled Editor working set is experimental and might change or be removed. (Copilot only): Show the working set. Defaults to
true. -
chat.editing.revealNextChangeOnResolve : Set to
falseto stay at the current change after keeping or undoing an edit, instead of navigating to the next pending change.
Review changes by comparing diffs
For Claude or Codex harness sessions in the editor window, the Agents window, and cloud sessions, compare diffs instead of keeping or undoing pending edits.
In the editor window, a pill above the chat input shows the number of affected files and diff statistics. Copilot harness sessions can use this presentation by selecting Show Pill from the working set context menu.
Use any of these review options:
-
Select the changed-files pill to open a multi-diff editor with all changes.
-
Select a changed file in the agent's response to open its diff.
-
In the editor, use the Source Control view to review changed and untracked files when the folder uses Git.
Review changes in the Agents window
-
Open the Changes view in the side panel by using the layout controls in the title bar, or use the ⌥⌘B (Windows, Linux Ctrl+Alt+B) keyboard shortcut.
-
Select a file in the Changes view to open a diff of the agent's edits.
Other Files groups edits outside the workspace, such as session plans, which aren't committed with workspace changes. Also check Source Control for untracked files and changes made outside tracked edit tools.
TipUse the Branch Changes dropdown to choose which changeset to review.
-
Select Mark as Reviewed in a file's toolbar to track files you've reviewed in the Branch Changes changeset.
The reviewed state clears if you or the agent changes the file again.
Review cloud changes
Review the session's pull request on GitHub, or check out its branch locally to inspect and revise the changes.
Customize change review in the Agents window
By default, selecting a file in the Changes view opens a multi-file diff editor with all the session changes. To open a focused single-file diff, enable sessions.changes.openSingleFileDiff .
Use the diff toolbar to show the editor beside chat or in a modal window. Select More Actions (...) > Diff View to choose Inline, Side by Side, or Automatic. Automatic switches to inline when the editor is too narrow for side-by-side diffs.
Configure word wrap in diff editors
Control how diff editors in the Changes view wrap long lines with sessions.diffEditor.wordWrap . This setting has the following values:
inherit(default): Follow the editor.wordWrap setting.on: Wrap lines at the editor viewport width.off: Never wrap lines.
This setting is independent of word wrap in code editors.
To change it from a diff editor, select More Actions (...) > Word Wrap.
Separate test files
To review implementation code before tests in the Agents window, select Separate Test Files from the Toggle Details dropdown, the Files View submenu, or the Changes view title menu.
- Matching test files group into a collapsible Test Files section with a file count badge in list view, tree view, floating details, and modal diff sidebars.
- In multi-repository sessions, test files group within each repository.
- The Changes multi-file diff editor reorders diffs to match, placing test diffs after source files.
Test files are matched with
sessions.changes.testFilePatterns
, which uses the same { "<glob>": boolean } format as
files.exclude
. Patterns match each changed file's path relative to its session folder, and VS Code merges keys across Default, User, and Workspace settings.
The built-in defaults cover common test folders and naming conventions:
"sessions.changes.testFilePatterns": {
"**/{test,tests,__tests__,Tests}/**": true,
"**/*.{test,spec}.*": true,
"**/{test_*,*_test,conftest}.py": true,
"**/*_test.{go,rs,c,cc,cpp}": true,
"**/*_{spec,test}.rb": true,
"**/*.Tests/**": true,
"**/*{Test,Tests}.{cs,java,kt,php,swift}": true
}
To extend patterns for a language while keeping all built-in defaults, add new glob entries set to true in User or Workspace settings.json:
"sessions.changes.testFilePatterns": {
"**/*.e2e.ts": true,
"**/*.integration.ts": true,
"**/*_bench.go": true
}
To override a language's default pattern, set the exact default key to false and add your replacement pattern set to true. For example, to match only *_test.py files in Python instead of test_*.py and conftest.py:
"sessions.changes.testFilePatterns": {
"**/{test_*,*_test,conftest}.py": false,
"**/*_test.py": true
}
When a language shares a brace-grouped default key, disabling that key turns it off for every extension in the group. Re-add the other extensions you want to keep alongside your replacement pattern:
"sessions.changes.testFilePatterns": {
"**/*_test.{go,rs,c,cc,cpp}": false,
"**/*_test.{rs,c,cc,cpp}": true,
"**/*_{test,integration}.go": true
}
[!NOTE]
- Setting a pattern to
falsedisables that exact default key rather than acting as a negative exclusion rule. For example,"**/foo.test.ts": falsedoesn't excludefoo.test.tsfrom"**/*.{test,spec}.*": true.- Files inside
test,tests,__tests__, orTestsfolders still match"**/{test,tests,__tests__,Tests}/**": trueeven if you disable a language's filename pattern. Set that folder pattern tofalseto opt out of folder-based matching.- Language-specific
[languageId]setting blocks don't apply to sessions.changes.testFilePatterns . Target languages by file extension or folder path in User or Workspace settings instead.
Provide feedback and request revisions
You can ask the agent to revise its work from any review workflow. Send a follow-up prompt, edit the files directly, or provide inline feedback in the Agents window.
To act on existing review feedback or failing checks without switching conversations, use Fix Checks and Address Comments in the sessions list.
Provide inline feedback to the agent
-
In the Agents window, open a file from the Changes view.
-
Select a range of code in the diff, and enter feedback in the inline comment box.
-
Add feedback to other changes as needed, and then select Submit Feedback to send all comments to the agent.
The agent reads your comments, makes the requested edits, and resolves each comment. Resolved comments disappear from the diff view.
Add pull request review comments
In the Agents window, publish review comments to a session's open GitHub pull request when it uses the Copilot or Claude harness, or the experimental Codex integration.
-
Enable the chat.experimental.agentsWindowPRComments setting.
-
Open a changed file from the Changes view.
-
Start a comment on lines that are part of the pull request diff, and enter your comment:
- With the default inline feedback input, select a range of code in the diff and enter your comment in the inline feedback box.
- With the experimental editor comment control ( chat.experimental.agentsWindowEditorComments ), select + in the editor gutter on a line or selection and enter your comment.
-
Select Add PR Comment to publish the review comment. If the session is associated with multiple pull requests, select the target pull request (
owner/repository#number).
Only lines that are part of the pull request diff are eligible for pull request comments. With chat.experimental.agentsWindowEditorComments enabled, Add PR Comment appears only on eligible lines, and other lines offer only Add Feedback. With the default inline feedback input, selecting Add PR Comment on an ineligible range reports that a pull request comment can't be added to the line.
When chat.experimental.agentsWindowEditorComments is enabled and another comment provider such as the GitHub Pull Requests extension handles commenting on that line, VS Code hides Add PR Comment inside the Agent Feedback thread. Use the extension's commenting option from the editor gutter instead.
Add PR Comment publishes the comment to GitHub and doesn't send it to the agent. To request a code change, add the comment as feedback and select Submit Feedback.
Get a second opinion with Rubber Duck
In a Copilot harness session, Rubber Duck uses a complementary model to review plans, code, and tests for substantive issues. It is read-only and doesn't edit files or run commands that change your environment.
The harness might consult Rubber Duck automatically during non-trivial work. To request a review yourself, ask:
Get a second opinion on the changes made so far.
You can also enter /rubber-duck <question>, such as /rubber-duck What edge cases are missing?. The harness summarizes the critique and decides how to act on it.
Rubber Duck requires a Claude or GPT model in the main session and an available complementary model. The additional model pass adds latency and model usage.
Learn more about the Rubber Duck agent.
Undo changes at the right scope
Choose a recovery action based on how much work you want to undo:
| Action | Applies to | Effect |
|---|---|---|
| Undo pending edits | Copilot editor working sets | Reverts an individual change, a file, or all pending edits without rewinding the conversation. |
| Edit a previous request | Sessions that support request editing | Reverts file changes from that request and later requests, then resends the revised request. |
| Restore a checkpoint | Sessions with Restore Checkpoint | Restores affected workspace files to the checkpoint and removes subsequent conversation turns. |
| Discard with Source Control | Folders that use Git | Reverts selected repository changes without changing the conversation. |
| Use an external service's recovery controls | Deployments, issues, databases, and other external state | Reverses effects that checkpoints and Git don't control. |
| Undo pending edits | Local harness sessions The Local harness is deprecated and will be removed in February 2027. Move your workflows to the Copilot harness before then. Learn more about Local harness deprecation. | Reverts an individual change, a file, or all pending edits without rewinding the conversation. |
For help choosing an action, see Get an agent back on track.
Edit a previous chat request
In sessions that support request editing, you can edit a previous request in your conversation history. VS Code reverts file changes made by that request and subsequent requests, and then sends the updated request to the language model.
Before you resend the request, review the affected changes so you understand which work will be removed. Select the request in the conversation, modify it, and resend it. Configure or turn off request editing with chat.editRequests .
Restore a checkpoint
Checkpoints are enabled by default for supported chat sessions. Before processing each request, VS Code creates a snapshot of affected workspace files. Set chat.checkpoints.enabled to control checkpoints.
To restore your workspace to an earlier checkpoint:
-
Navigate to a previous request in the conversation.
-
Hover over the request and select Restore Checkpoint.

-
Confirm that you want to restore the checkpoint.
VS Code removes subsequent requests from the conversation history and restores the workspace files to their state at the checkpoint.
A checkpoint restores affected workspace files and chat history. It doesn't reverse completed terminal commands, network requests, deployments, or changes that tools made to external services. Use Git and the external service's recovery controls for those effects.
Require approval before sensitive edits
For supported edit tools, chat.tools.edits.autoApprove uses glob patterns to request confirmation before an edit is saved. This is separate from reviewing the resulting files afterward.
In Copilot sessions, Allow all, global auto-approval, or an applicable saved approval for the exact file can allow an edit without another prompt. These rules don't prevent file reads or protect against every write made through terminal commands or other tools. See approval behavior and sandbox file restrictions for the corresponding controls.
When these rules are evaluated, the following configuration automatically approves edits except to JSON files in .vscode folders and files named .env:
{
"chat.tools.edits.autoApprove": {
"**/*": true,
"**/.vscode/*.json": false,
"**/.env": false
}
}
Local harness-specific behavior
Local harness sessions and existing extension-host sessions use the shared review process. In these sessions, discarding changes in Source Control also discards their pending edits.
Auto-accept edits
For Local harness sessions, use chat.editing.autoAcceptDelay to automatically keep pending edits after a configurable delay. Hover over the editor overlay controls to stop the countdown.
If you automatically keep all edits, review the changes before you commit them in Source Control. Learn more about the security considerations of using AI in VS Code.