Roo-Code: Diff tool failed
App Version
3.1.1
API Provider
Google Gemini
Model Used
Gemini 2.5 Pro
Actual vs. Expected Behavior
I have a 570k context window and start noticing that the diff tool fails all the time now. Roo reverts to write_to_file which does actually help, but obviously not optimised.
This did not happen when I first started the project, but possibly due to large context and/or project.
Detailed Steps to Reproduce
- Have 500k+ context
- Make any changes to or modifications.
Relevant API Request Output
Additional Context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 19
I dont want to sound rude, but the solution here is to refactor the whole system instruction, this is you guys supposed to be in top priority instead of adding new feats,
Current system instruction design is very poor, it works to claude, but most of the llm including gemini struggles and confuse. 2.0 flash is crap in diffs but not 2.5 i dont have a single issue with 2.5.
If total system instruction is higher than 500 lines and too many redundant unclear, not concise instruction, dont expect it to work well specially to gemini.
Suggested principle for instruction. Concise and direct.
If you guys dont want to risk of degrading claude for new instruction, create a system where theres a unique instruction per model.
I tested it before and after that commit to verify, and you are correct.
But @zewpo is not the OP of this issue so please leave it open, as I would like to collect other samples if others can provide their output to continue validating.
Sounds good. I did just release the fix for this particular issue in 3.11.4 - thanks all for helping to track down and fix that one, and for all the rest of the feedback and ideas.
Apologies I have been unable to conduct testing still. I will try and provide some more samples this evening and report back! Thanks for all the contributions and discussions so far. It’s reassuring to see!
I am collecting test samples and running them through #2220 to figure out what needs to be fixed.
@KJ7LNW the problem in @zewpo’s example is the line numbers in the search content right? Is that what https://github.com/RooVetGit/Roo-Code/pull/2193 fixes?
Everyone on this ticket: In order to troubleshoot this, I need the following when errors occur:
1. click the button in blue and save the file:
2. scroll to the and of the file and find the
<error>response:3. scroll to the end of the file and find the apply_diff section that failed. For example:
4. Do not modify the content
Attach both XML samples to your response.
I know this may contain confidential information, and you can decline to share it if you wish, but if you modify the content it may be difficult for me to fully understand edge cases. If you do change the content for any reason please tell me so that I am aware that the information maybe incomplete.
5. reproducible?
If you have a reproducer please provide as much information as you can. I would love to replicate this exactly and reliably, so it can be solved either with force-feedback to the model or system instructions.
BTW @Mac-V-Sog if it is happening when the context is larger that is most certainly because gemini is not handling its tool calls well at higher contexts. Thats a gemini problem then and has nothign to do with Roo… I think… that being said… I am not ruling out Roo being the cause. We need to keep an eye on this. Please update with anything else you discover. Thank you.
yes Iit does seem to be on larger files or larger contexts… hmm… i wonder if the output gemini is putting out degrades at a higher context so its ability to follow the rules needed to make the tool calls falters. @KJ7LNW thoughts?
@Mac-V-Sog the new version has a more agressive multiblock diff process which makes multiple edits in a larger file instead of writing the whole file out or making a number of single diffs.