[Bug]: Agent (Devstral) file modification frequently fails
Is there an existing issue for the same bug? (If one exists, thumbs up or comment on the issue instead).
- [x] I have checked the existing issues.
Describe the bug and reproduction steps
When the agent is trying to make modifications to a file, it frequently encounters an error ERROR: No replacement was performed, old_str ... did not appear verbatim in ... even though what it's doing seems to be as intended. It could be an issue with line breaks or something more subtle. Sometimes the agent is eventually able to work around the issue by deleting and recreating the file, but it usually never recovers.
OpenHands Installation
Docker command in README
OpenHands Version
docker.all-hands.dev/all-hands-ai/runtime:0.41-nikolaik
Operating System
MacOS
Same issue, almost same setup — using codestral via API
It must be something simple but I haven't yet had time to continue trying to fix it.
I have a similar issue, endless failing replacement loop. In my case, it looks like LLM has old file state cached, and it tries to replace a string that doesn't exist any more. Is there a way to tell it "clear the cache, read file again"?
I can't really get the simplest tasks to work, because all file editing fails with mentioned error message. in some rare cases the agent starts writing shell scripts to edit files (and killing its whole content), but most of the time it just starts looping and not getting to any solution. Is there something i can test? Some information which could help resolving this issue?
EDIT: i feel like it has something to do with line breaks, since single line edits almost always work and some file operations seem to add an awful lot of line breaks. It recreated a file to work around the problem and went from ~150 lines to ~1000 lines, most of them being empty. So i guess the proposed MR should fix this...
Same issue here and the worst part is that the agent creates a brand new file and replaces the existing, often changing things that should not be changed.
Will be completed when #10502 is merged!