race condition when applying changes immediatly after each other on same file #2552

Open
opened 2026-02-16 17:36:12 -05:00 by yindo · 3 comments
Owner

Originally created by @chenxin-yan on GitHub (Nov 3, 2025).

Originally assigned to: @rekram1-node on GitHub.

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

  1. send a prompt that results in multiple changes that need to be accepted sequentially on one file
  2. accept all of them by pressing "enter" multiple times quickly
  3. only the last change is applied correctly

Screenshot and/or share link

No response

Operating System

macOS 14.7.1

Terminal

Ghostty

Originally created by @chenxin-yan on GitHub (Nov 3, 2025). Originally assigned to: @rekram1-node on GitHub. ### 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 1. send a prompt that results in multiple changes that need to be accepted sequentially on one file 2. accept all of them by pressing "enter" multiple times quickly 3. only the last change is applied correctly ### Screenshot and/or share link _No response_ ### Operating System macOS 14.7.1 ### Terminal Ghostty
yindo added the bug label 2026-02-16 17:36:12 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 3, 2025):

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.

@github-actions[bot] commented on GitHub (Nov 3, 2025): 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.
Author
Owner

@sr-tream commented on GitHub (Nov 6, 2025):

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

@sr-tream commented on GitHub (Nov 6, 2025): 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
Author
Owner

@chenxin-yan commented on GitHub (Nov 7, 2025):

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.

@chenxin-yan commented on GitHub (Nov 7, 2025): > 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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2552