race condition when applying changes immediatly after each other on same file
Description
When multiple changes are proposed for user to accept on the same file and user press "enter" to accept them one by one immediately after each other, the last change on the file will override all previous changes, resulting the previous changes not being applied correctly on that file and only the last change is applied correctly.
OpenCode version
0.15.29
Steps to reproduce
- send a prompt that results in multiple changes that need to be accepted sequentially on one file
- accept all of them by pressing "enter" multiple times quickly
- only the last change is applied correctly
Screenshot and/or share link
No response
Operating System
macOS 14.7.1
Terminal
Ghostty
This issue might be a duplicate of existing issues. Please check:
- #2882: Describes parallel edit tool calls on same file causing errors, which appears to be the same race condition where multiple rapid changes to a file interfere with each other
- #196: Mentions a race condition with streamed operations, potentially related to the same timing issues with sequential operations
Feel free to ignore if none of these address your specific case.
Found workaround: set permission "write": true. OpenCode rejects writes out of the working directory, and has functionality to undo the last edit. So I think this permission must be safe for most cases
Found workaround: set permission
"write": true. OpenCode rejects writes out of the working directory, and has functionality to undo the last edit. So I think this permission must be safe for most cases
I think write tool is being enabled by default. Also, to reproduce this error, the file do not have to be outside of cwd.