Skip to content

Conversation

@roomote
Copy link

@roomote roomote bot commented Oct 30, 2025

This PR implements #8927 - Add option to suggest reviewing changes after file edits.

Summary

Adds an experimental feature that prompts the AI to review changes after editing files, helping catch errors that might be introduced during editing.

Changes

  • Added RE_READ_AFTER_EDIT experiment configuration to types and experiments system
  • Updated all file editing tools to suggest review when experiment is enabled:
    • applyDiffTool.ts - Single file diff applications
    • multiApplyDiffTool.ts - Multi-file diff applications
    • writeToFileTool.ts - File writes
    • insertContentTool.ts - Content insertion
    • searchAndReplaceTool.ts - Search and replace operations
  • Added UI setting in experimental settings with English translation
  • Added comprehensive test coverage for the new experiment
  • Updated existing tests to include the new experiment

How it works

When the experiment is enabled, after any file editing operation, the AI will receive a <review_suggestion> message suggesting to use the read_file tool to review the changes. The suggestions are contextual (e.g., "The file has been edited" vs "2 files have been edited").

Trade-offs

As mentioned in the issue, this feature will:

  • ✅ Help catch errors introduced during editing
  • ⚠️ Increase context usage
  • ⚠️ Take more time for operations

This is why it's implemented as an opt-in experiment, allowing users to decide based on their needs.

Testing

  • All tests pass ✅
  • Type checking passes ✅
  • Linting passes ✅

Closes #8927


Important

Introduces RE_READ_AFTER_EDIT experiment to suggest reviewing changes after file edits, with updates to tools, configuration, and tests.

  • Behavior:
    • Adds RE_READ_AFTER_EDIT experiment to suggest reviewing changes after file edits.
    • Updates applyDiffTool.ts, multiApplyDiffTool.ts, writeToFileTool.ts, insertContentTool.ts, and searchAndReplaceTool.ts to include review suggestions when the experiment is enabled.
  • Configuration:
    • Adds reReadAfterEdit to experiment.ts and experiments.ts.
    • Adds UI setting for RE_READ_AFTER_EDIT in settings.json.
  • Testing:
    • Adds experiments-reReadAfterEdit.spec.ts for testing the new experiment.
    • Updates experiments.spec.ts and ExtensionStateContext.spec.tsx to include the new experiment.

This description was created by Ellipsis for f86af76. You can customize this summary. It will automatically update as commits are pushed.

Implements issue #8927 - Add option to suggest reviewing changes after file edits.
- Added RE_READ_AFTER_EDIT experiment configuration
- Updated all file editing tools to suggest review when experiment is enabled
- Added UI setting with English translation
- Added tests for the new experiment

When enabled, the AI will suggest using the read_file tool to review changes
after editing files, helping catch errors that might be introduced during editing.
@roomote roomote bot requested review from cte, jr and mrubens as code owners October 30, 2025 10:36
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Oct 30, 2025
@roomote
Copy link
Author

roomote bot commented Oct 30, 2025

Review Complete

I've reviewed the changes in this PR and found 1 issue that should be addressed:

Issues Found

  • Inaccurate review suggestion count in multiApplyDiffTool.ts - The code counts "approved" files rather than actually edited files when generating review suggestions. Files that are approved but have all diffs fail (successCount === 0) are still counted, leading to misleading suggestions like "2 files have been edited" when only 1 file was successfully modified.

Follow Along on Roo Code Cloud

Comment on lines +687 to +692
// Count how many files were successfully edited
const editedFiles = operationResults.filter((op) => op.status === "approved").length
const reReadSuggestion =
isReReadAfterEditEnabled && editedFiles > 0
? `\n\n<review_suggestion>${editedFiles === 1 ? "The file has" : `${editedFiles} files have`} been edited. Consider using the read_file tool to review the changes and ensure they are correct and complete.</review_suggestion>`
: ""
Copy link
Author

Choose a reason for hiding this comment

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

The review suggestion count may be inaccurate. When a file is approved but all its diffs fail to apply (successCount === 0 at line 494), the code continues without saving changes (line 514), but the file remains with status "approved". Later at line 688, the code counts all "approved" files for the review suggestion, incorrectly including files that were approved but never actually edited. This could result in suggestions like "2 files have been edited" when only 1 file was successfully modified.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 30, 2025
@daniel-lxs
Copy link
Member

#8927 (comment)

@daniel-lxs daniel-lxs closed this Oct 30, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Oct 30, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] [OPTION] Re-read after edit.

4 participants