8000 fix(FileContextTracker): mark file as edited by Roo when added to context tracker by samhvw8 · Pull Request #3499 · RooCodeInc/Roo-Code · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(FileContextTracker): mark file as edited by Roo when added to context tracker #3499

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2025

Conversation

samhvw8
Copy link
Collaborator
@samhvw8 samhvw8 commented May 12, 2025

Related GitHub Issue

Closes: #3458

Description

Roo mistake with Roo edited content, should re-read only file that use has been edited

Test Procedure

Type of Change

  • 🐛 Bug Fix: Non-breaking change that fixes an issue.
  • New Feature: Non-breaking change that adds functionality.
  • 💥 Breaking Change: Fix or feature that would cause existing functionality to not work as expected.
  • ♻️ Refactor: Code change that neither fixes a bug nor adds a feature.
  • 💅 Style: Changes that do not affect the meaning of the code (white-space, formatting, etc.).
  • 📚 Documentation: Updates to documentation files.
  • ⚙️ Build/CI: Changes to the build process or CI configuration.
  • 🧹 Chore: Other changes that don't modify src or test files.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Code Quality:
    • My code adheres to the project's style guidelines.
    • There are no new linting errors or warnings (npm run lint).
    • All debug code (e.g., console.log) has been removed.
  • Testing:
    • New and/or updated tests have been added to cover my changes.
    • All tests pass locally (npm test).
    • The application builds successfully with my changes.
  • Branch Hygiene: My branch is up-to-date (rebased) with the main branch.
  • Documentation Impact: I have considered if my change 8000 s require documentation updates (see "Documentation Updates" section below).
  • Changeset: A changeset has been created using npm run changeset if this PR includes user-facing changes or dependency updates.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

Documentation Updates

Additional Notes


Important

Fixes FileContextTracker to mark files as edited by Roo when added with roo_edited source, preventing unnecessary reloads.

  • Behavior:
    • In FileContextTracker, addFileToFileContextTracker() now calls markFileAsEditedByRoo(filePath) for roo_edited source to prevent unnecessary reloads.
  • Functions:
    • markFileAsEditedByRoo(filePath) is used to mark files as edited by Roo, preventing false positives in file watchers.

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

Copy link
changeset-bot bot commented May 12, 2025

⚠️ No Changeset found

Latest commit: 147b491

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels May 12, 2025
@mrubens
Copy link
Collaborator
mrubens commented May 12, 2025

Even though this is unintentional, I wonder what the impact will be of fixing it. With it fixed, does Roo have a easy view of the full content of the file or does it need to piece it together from diffs? We don't read the full file content into context after doing a diff edit do we?

@samhvw8
Copy link
Collaborator Author
samhvw8 commented May 12, 2025

We should add a prompt requiring full file reading when file is marked to re-read. Sometime Roo using Read by chunk only 50 line per chunk, we can promote Roo the use of list definitions/search for effective chunk reading, and increase the maxReadFileLine limit from 500 to 5000.

does it need to piece it together from diffs?

we can consider use this when checkpoint active, but current our checkpoint system not efficiently

We don't read the full file content into context after doing a diff edit do we?

yeah, this file context tracker should only inform Roo re-read file that edited by user

@samhvw8 samhvw8 force-pushed the fix/roo-edit-tracking branch from b6944f4 to 147b491 Compare May 12, 2025 23:00
@KJ7LNW
Copy link
Collaborator
KJ7LNW commented May 13, 2025

will this work for all of write_to_file , insert_content and search_and_replace?

@hannesrudolph hannesrudolph moved this from New to PR [Pre Approval Review] in Roo Code Roadmap May 13, 2025
@samhvw8
Copy link
Collaborator Author
samhvw8 commented May 14, 2025

will this work for all of write_to_file , insert_content and search_and_replace?

yes, this will work for all of there tool, (apply_diff too)

btw with this we can optimize checkpoint & show what file edit/read in context of current task to improve UX

@KJ7LNW
Copy link
Collaborator
KJ7LNW commented May 14, 2025

btw with this we can optimize checkpoint & show what file edit/read in context of current task to improve UX

does this persist across close/reopen cycles? if so, how is that stored persistently?

(I think these are off topic let's discuss in a different PR)

Back on topic: have you tested and verified manually that:

  1. this functions as you expect?
  2. when you run the same manual test in origin/main, validate that it does not work double check/QA as a solid control

assuming the fix works and you can confirm that it does not work in the current branch using the same manual test method, then let's get this pushed

@samhvw8
Copy link
Collaborator Author
samhvw8 commented May 16, 2025

btw with this we can optimize checkpoint & show what file edit/read in context of current task to improve UX

does this persist across close/reopen cycles? if so, how is that stored persistently?

(I think these are off topic let's discuss in a different PR)

Back on topic: have you tested and verified manually that:

  1. this functions as you expect?
  2. when you run the same manual test in origin/main, validate that it does not work double check/QA as a solid control

assuming the fix works and you can confirm that it does not work in the current branch using the same manual test method, then let's get this pushed

let me try to write that test

@KJ7LNW
Copy link
Collaborator
KJ7LNW commented May 16, 2025

let me try to write that test

and I am not asking you to write a test, I just want to make sure that you confirm that your change actually creates a difference in the XML output given the test case that I provided above.

if it does, then this is a simple fix and we should push it out as soon as possible because I think it is a small change with a major increase in productivity

@KJ7LNW
Copy link
Collaborator
KJ7LNW commented May 20, 2025

Please prioritize this I think it is really important and will help lots of people:

  1. reproduce the problem discovered in bug 3458 without your PR (ie, on current origin/main)
  2. verify that this PR fixes what you reproduced

If that works then let's get this merged ASAP.

@hannesrudolph hannesrudolph moved this from New to PR [Pre Approval Review] in Roo Code Roadmap May 20, 2025
@KJ7LNW
Copy link
Collaborator
KJ7LNW commented May 24, 2025

@mrubens

This one-line PR fixes a major issue where every modification tells the model that it should reread the file. This should be merged ASAP.

I tested with write_to_file, apply_diff, insert_content, and search_and_replace, and it solves the problem for all four file modification tools:

Before

**Assistant:**

I will add a second line to [`test_file.txt`](test_file.txt:1).
<apply_diff>
<path>test_file.txt</path>
<diff>
<<<<<<< SEARCH
:start_line:1
-------
This is the first line.
=======
This is the first line.
This is the second line.
>>>>>>> REPLACE
</diff>
</apply_diff>

---

**User:**

[apply_diff for 'test_file.txt'] Result:
Changes successfully applied to test_file.txt:

<environment_details>
...

# Recently Modified Files  <<<< THIS IS THE PROBLEM
These files have been modified since you last accessed them (file was just edited so you may need to re-read it before editing):
test_file.txt

After

Now you can see environment retails do not have this problem:

**Assistant:**

I will add a second line to [`test_file.txt`](test_file.txt:1).
<apply_diff>
<path>test_file.txt</path>
<diff>
<<<<<<< SEARCH
:start_line:1
-------
This is the first line.
=======
This is the first line.
This is the second line.
>>>>>>> REPLACE
</diff>
</apply_diff>

---

**User:**

[apply_diff for 'test_file.txt'] Result:
Changes successfully applied to test_file.txt:



<environment_details>
# VSCode Visible Files


# VSCode Open Tabs
test_file.txt

# Current Time
5/23/2025, 7:23:50 PM (America/Los_Angeles, UTC-7:00)

# Current Context Size (Tokens)
17,177 (2%)

# Current Cost
$0.07

# Current Mode
<slug>code</slug>
<name>💻 Code</name>
<model>google/gemini-2.5-pro-preview</model>
</environment_details>

@mrubens mrubens merged commit e86c0a1 into RooCodeInc:main May 24, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from PR [Pre Approval Review] to Done in Roo Code Roadmap May 24, 2025
@github-project-automation github-project-automation bot moved this from PR [Pre Approval Review] to Done in Roo Code Roadmap May 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Assignees
No one assigned
Labels
bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

apply_diff triggers 'recently modified' which causes spurious read_file events
3 participants
0