Skip to content

Conversation

@roomote
Copy link

@roomote roomote bot commented Oct 30, 2025

This PR addresses the enhancement request in Issue #8927 to provide granular control over the re-read after edit feature.

Changes

New Features

  • Added granular checkboxes for each edit operation type (apply diff, multi-apply diff, write to file, insert content, search and replace)
  • Implemented a master toggle that controls all individual checkboxes
  • Added indeterminate state for the master checkbox when some but not all operations are enabled
  • Maintained backward compatibility with the existing boolean reReadAfterEdit experiment

Implementation Details

Type System Updates

  • Added ReReadAfterEditGranular type to support granular settings
  • Updated Experiments type to include the new reReadAfterEditGranular property
  • Modified type constraints to allow experiments to be Record<string, boolean | any>

Tool Integration

  • Updated all file editing tools (applyDiffTool, multiApplyDiffTool, writeToFileTool, insertContentTool, searchAndReplaceTool) to check their specific granular setting
  • Added isReReadAfterEditEnabled method to the experiments module to handle both legacy and granular settings

UI Components

  • Created new ReReadAfterEditGranularSettings component with nested checkboxes
  • Integrated the component into the Settings page
  • Added visual hierarchy with indentation for individual checkboxes

Internationalization

  • Added translations for all new UI elements in multiple languages

Testing

  • Comprehensive test suite added for the granular settings logic
  • Tests cover all combinations of legacy and granular settings
  • All tests passing

Backward Compatibility

  • The legacy reReadAfterEdit boolean setting continues to work
  • When the legacy setting is enabled, it overrides all granular settings
  • Smooth migration path for users

Related Issue

Closes #8927

Screenshots

The new UI provides fine-grained control over which edit operations trigger file re-reading:

  • Master toggle for quick enable/disable all
  • Individual checkboxes for each operation type
  • Clear visual hierarchy

Testing Instructions

  1. Navigate to Settings
  2. Find the "Re-read After Edit (Granular)" experiment
  3. Toggle the master checkbox to enable/disable all operations
  4. Toggle individual checkboxes to customize behavior
  5. Verify that each tool respects its specific setting

cc @da2ce7


Important

Introduces granular control for re-read after edit settings, allowing specific edit operations to trigger re-read suggestions, with UI and tool updates.

  • Behavior:
    • Added granular checkboxes for edit operations (apply diff, multi-apply diff, write to file, insert content, search and replace) with a master toggle in ReReadAfterEditGranularSettings.
    • Maintained backward compatibility with reReadAfterEdit boolean setting.
  • Type System:
    • Added ReReadAfterEditGranular type and updated Experiments type in experiment.ts.
  • Tool Integration:
    • Updated tools (applyDiffTool, multiApplyDiffTool, writeToFileTool, insertContentTool, searchAndReplaceTool) to check granular settings.
    • Added isReReadAfterEditEnabled method in experiments.ts.
  • UI Components:
    • Created ReReadAfterEditGranularSettings component and integrated into ExperimentalSettings.
  • Internationalization:
    • Added translations for new UI elements in settings.json.
  • Testing:
    • Added tests for granular settings logic in experiments-granular.spec.ts and experiments-reReadAfterEdit.spec.ts.

This description was created by Ellipsis for 8e65a4d. 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.
- Added reReadAfterEditGranular experiment with individual toggles for each edit operation type
- Updated all file editing tools to check their specific granular setting
- Created new ReReadAfterEditGranularSettings UI component with master toggle and individual checkboxes
- Maintained backward compatibility with legacy reReadAfterEdit setting that overrides granular settings
- Added comprehensive tests for the new granular settings functionality
- Added translations for the new UI elements

This allows users to selectively enable automatic review for specific edit types like:
- Apply Diff (search and replace blocks)
- Multi-file Apply Diff
- Write to File (complete file rewrites)
- Insert Content (add lines to files)
- Search and Replace (find and replace text)

Addresses Issue #8927 - implements the suggestion to have checkboxes for selecting review based on edit type
@roomote roomote bot requested review from cte, jr and mrubens as code owners October 30, 2025 12:06
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Oct 30, 2025
@roomote
Copy link
Author

roomote bot commented Oct 30, 2025

Review Summary

I've reviewed the PR and identified 1 issue that needs attention:

Issues Found

  • Master toggle logic creates state inconsistency - The handleMasterToggle function in ReReadAfterEditGranularSettings.tsx sets both granular settings and the legacy reReadAfterEdit boolean. This breaks granular control because the backend gives the legacy setting precedence, causing individual checkbox changes to be ignored when the master toggle was used.

Follow Along on Roo Code Cloud

newSettings[type.key] = checked
})
onGranularChange(newSettings)
onChange(checked)
Copy link
Author

Choose a reason for hiding this comment

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

The master toggle logic creates a state inconsistency that breaks granular control. When handleMasterToggle is called with checked=true, it sets both the granular settings AND the legacy reReadAfterEdit boolean to true via onChange(checked) on line 46. However, the backend logic in experiments.ts (lines 58-60) gives the legacy setting precedence: if reReadAfterEdit is true, it returns true for ALL edit types regardless of granular settings. This means if a user enables the master toggle then unchecks an individual edit type, that type will still trigger re-read because the legacy boolean remains true and overrides the granular setting. The master toggle should only control granular settings, not the legacy boolean. Remove the onChange(checked) call on line 46, as the legacy setting should remain independent of the granular UI controls.

Copy link
Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Review complete. Found 1 issue that needs to be addressed before this PR can be merged. See inline comment for details.

@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 New to Done in Roo Code Roadmap Oct 30, 2025
@github-project-automation github-project-automation bot moved this from Triage 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:L This PR changes 100-499 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