Text of code.visualstudio.com › docs › agents › run › review-code-edits as Styx crawled it on Oct 9, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Review and revert agent changes

AI agents: See llms.txt for documentation discovery and navigation. Documentation articles are also available as Markdown by appending .md to the article URL. 🎬 Watch The Story of VS Code! VS Code is now on Instagram, follow @vscode.ig for updates, tips, and more. Rewatch GitHub Copilot Day. Review and revert agent changes View as Markdown Ask in VS Code Ask in VS Code Insiders When you work with an agent in Visual Studio Code, it can change multiple files in your project.

This article explains how to inspect, revise, integrate, or discard these AI-generated changes. Note You can review AI-generated changes in both the Chat view and the Agents window . The review experience follows the same concepts, but the user interface differs between the two surfaces. Review agent changes Agents can change workspace files through editing tools, terminal commands, scripts, and MCP tools . An editor-maintained pending-edit state might not represent every change made through these paths, so the review workflow differs between Agent Host and the Local harness.

In Agent Host sessions, the agent applies and saves edits directly in the session's folder or isolated Git worktree. These edits don't have a pending review state, so inspect the diff and Source Control changes before you commit or integrate them. You can restore a checkpoint to recover affected workspace files and chat history, but it doesn't reverse completed commands or external effects. Manual permissions doesn't require confirmation for edits that your approval settings already allow.

To require confirmation before specific files are edited, configure sensitive-file approval . The Local harness runs in the VS Code extension host and marks supported file edits as pending so you can keep or undo them individually. The Agent Host Changes view doesn't provide the same per-edit Keep and Undo workflow. Expand Review extension-host changes below for Local's controls. Review agent changes as you would other workspace or branch changes through the diff view, Source Control, or pull request workflow.

For keyboard and screen reader access to a diff, use the Accessible Diff Viewer , which presents changes in a unified patch format. Select a changed file in the agent's response to open its diff or select it from the Source Control view. To see a summary after each completed request, set chat.checkpoints.showFileChanges Open in VS Code Open in VS Code Insiders to true . Expand the changed-files summary to see the files and diff statistics, or select View All File Changes to open a multi-file diff.

If you want to make further changes, send a follow-up prompt or edit the files directly. To revert a request and all later changes, restore a checkpoint . Run tests and use the debugger or other editor tools to validate the result. When you're satisfied with the changes: For folder-isolated sessions, stage and commit the changes with Source Control. For worktree-isolated sessions, apply or merge the worktree changes into your main workspace.

For cloud sessions, review the pull request or check out its branch locally. By default, the Agents window shows these views in a side panel: Files : a file explorer for the session workspace. Changes : files that the agent changed, added, or deleted. Use the Branch Changes dropdown to choose which changeset to review. The Changes view groups edits outside the workspace under Other Files . These files, such as plans in the session-state folder, aren't committed with workspace changes.

Files changed only through terminal commands or scripts might not appear in tool-specific change tracking. Review the session's folder or worktree in Source Control as well, including untracked files, before committing or integrating changes. Configure word wrap in diff editors Control how diff editors in the Changes view wrap long lines with sessions.diffEditor.wordWrap Open in VS Code Open in VS Code Insiders . This setting has the following values: inherit (default): Follow the editor.wordWrap Open in VS Code Open in VS Code Insiders setting. on : Wrap lines at the editor viewport width. off : Never wrap lines.

This setting only affects diff editors and doesn't affect code editors in the Agents window. To configure word wrapping in code editors, see Configure word wrap for code editors . To change this setting from a diff editor, select More Actions ( ... ) > Word Wrap . This action updates sessions.diffEditor.wordWrap Open in VS Code Open in VS Code Insiders independently of the code editor setting. To review and integrate the changes: Select a file in the Changes view to open a diff view of the agent's edits.

By default, selecting a file opens a multi-file diff editor with all the session changes. To open a focused single-file diff, enable sessions.changes.openSingleFileDiff Open in VS Code Open in VS Code Insiders . Use the diff toolbar to show the editor side by side with chat or in a modal window. To change the diff layout, select More Actions ( ... ) > Diff View , and then select Inline , Side by Side , or Automatic . With Automatic , the Changes editor shows files side by side when there is enough space and switches to inline when the editor is narrow.

Select a range of code in a changed file, select Add Feedback , and enter a comment that describes the change you want. Add more comments on other selections or files, and then select Submit Feedback to send them to the agent. Markdown files follow the same feedback flow. Open a workspace file from the Changes tab and use Locked mode in the Markdown editor to add range-based feedback. Feedback stays in sync if you reopen the file in the text editor.

The agent reads your comments, makes the requested edits, and resolves each comment. Resolved comments disappear from the diff view. 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. Use the Commit , Merge , Checkout , or Discard actions to act on the edits. When you create a session, use the sync button in the Files panel to pull upstream changes from the base branch before the agent starts.

Starting from the latest branch state reduces merge conflicts when you integrate the result. Add pull request review comments For an Agent Host session associated with an open GitHub pull request, you can add a review comment to the pull request directly from the Changes view. This is different from agent feedback, which asks the agent to revise its changes. Enable the chat.experimental.agentsWindowPRComments Open in VS Code Open in VS Code Insiders setting.

Open a changed file from the Changes view and select a range of code. Select Add Feedback and enter your comment. Select Add PR Comment to add the review comment to the pull request. If the session is associated with multiple pull requests, the action identifies the target as owner/repository#number . The selected range must contain only lines that are part of the pull request diff. If the range isn't eligible, VS Code reports that a pull request comment can't be added to the line.

Add PR Comment adds the comment to GitHub and doesn't send it to the agent. To ask the agent to change the code instead, add the comment as feedback and select Submit Feedback . Review changes in the single-pane layout (Experimental) When you enable the experimental single-pane editor panel , the Changes view and diff editor share one docked pane. Use Expand All Diffs or Collapse All Diffs to control all files at once.

The keybinding toggles the preferred diff view in the Agents window. The Changes editor restores each file's expanded or collapsed state when you switch sessions or reload the window. The editor tab title shows the next integration action, such as Create Pull Request , and switches to an icon when space is limited. Integrate worktree changes A worktree session keeps the agent's branch and working files separate from your primary worktree.

A

The rest of this page is on the live site.