Skip to content

apply_diff triggers 'recently modified' which causes spurious read_file eventsΒ #3458

@KJ7LNW

Description

@KJ7LNW

Which version of the app are you using?

v3.16.3

Which API Provider are you using?

Anthropic

Which Model are you using?

sonnet-3.7

What happened?

When using the apply_diff tool, the system marks the file as "recently modified" in the environment details. This triggers a notification to the AI that the file has been modified, suggesting that it should be re-read before editing again.

This leads to unnecessary read_file operations even when the changes were made by Roo itself, wasting tokens and slowing down the workflow.

This feature (regression?) was introduced in commit 5352beb (PR #2440).

Expected behavior: Files should only be marked as "recently modified" if their content has been changed outside of Roo. Changes made by Roo's own tools should not trigger this notification.

Steps to reproduce

  1. Use apply_diff on a file
  2. Observe that the environment details show the file as "recently modified" in the next response
  3. The AI is prompted to re-read the file before making further edits, which is unnecessary since Roo already knows about the changes it made

Relevant API REQUEST output

<apply_diff>
<path>locales/__tests__/lint-translations.test.ts</path>
<diff>
<<<<<<< SEARCH
...
=======
...
>>>>>>> REPLACE
</diff>
</apply_diff>

Environment details example

After applying the diff, the environment details include:

# Recently Modified Files
These files have been modified since you last accessed them (file was just edited so you may need to re-read it before editing):
locales/__tests__/lint-translations.test.ts

This notification prompts the AI to unnecessarily re-read the file, even though it was modified by Roo itself.

Additional context

This issue affects workflow efficiency in all modes that use the apply_diff tool, as it causes unnecessary token usage for re-reading files that were modified by Roo itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions