opencode reverts developer modifications to the LLM generated code #2728

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

Originally created by @albertborsos on GitHub (Nov 9, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

Opencode reverts/overwrites the user modifications on opencode generated contents.

I think opencode should watch if these file are changed since it red last time. Before any new file modification.

OpenCode version

1.0.35

Steps to reproduce

  1. If I give a task to opencode, it implements in its way. Usually it is OK, but not perfect. That is fine.
  2. I modify the generated code to my needs
  3. then I give another task to opencode
  4. and it reverts my modifications to the previously generated code by opencode.

Screenshot and/or share link

No response

Operating System

macOS 15.7.2

Terminal

vscode

Originally created by @albertborsos on GitHub (Nov 9, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description Opencode reverts/overwrites the user modifications on opencode generated contents. I think opencode should watch if these file are changed since it red last time. Before any new file modification. ### OpenCode version 1.0.35 ### Steps to reproduce 1. If I give a task to opencode, it implements in its way. Usually it is OK, but not perfect. That is fine. 2. I modify the generated code to my needs 3. then I give another task to opencode 4. and it reverts my modifications to the previously generated code by opencode. ### Screenshot and/or share link _No response_ ### Operating System macOS 15.7.2 ### Terminal vscode
yindo added the discussion label 2026-02-16 17:36:59 -05:00
Author
Owner

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

This issue might be a duplicate of existing issues. Please check:

  • #3064: Feature request for checking uncommitted changes before continuing - addresses the same core problem of preventing OpenCode from overwriting user modifications by implementing a "commit_before_write" configuration option

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Nov 9, 2025): This issue might be a duplicate of existing issues. Please check: - #3064: Feature request for checking uncommitted changes before continuing - addresses the same core problem of preventing OpenCode from overwriting user modifications by implementing a "commit_before_write" configuration option Feel free to ignore if none of these address your specific case.
Author
Owner

@albertborsos commented on GitHub (Nov 9, 2025):

I do not let opencode, to commit the changes. Overwrite/revert also happens if I would like to make other changes on the same session, on the same part of the code. So the mentioned ticket is irrelevent in this ticket.

@albertborsos commented on GitHub (Nov 9, 2025): I do not let opencode, to commit the changes. Overwrite/revert also happens if I would like to make other changes on the same session, on the same part of the code. So the mentioned ticket is irrelevent in this ticket.
Author
Owner

@rekram1-node commented on GitHub (Nov 9, 2025):

generally I try to tell it i made a modification by @ referencing the file and saying so but ive ran into this myself

We could automatically inject somethign into the prompt telling the model that edits were made

or we could make some shortcut for that

@rekram1-node commented on GitHub (Nov 9, 2025): generally I try to tell it i made a modification by @ referencing the file and saying so but ive ran into this myself We could automatically inject somethign into the prompt telling the model that edits were made or we could make some shortcut for that
Author
Owner

@albertborsos commented on GitHub (Nov 9, 2025):

Should we make sure to notify the client and reference the modifications, especially if we’ve modified a lot of files? It’s easy to forget when we’re in the flow.

Is it possible that before OpenCode starts editing a file or reading it for context, it checks the latest modification date from its cache and compares it to the file’s modification date? If they’re different, it rereads the file.

I don’t know how it works, I’m just thinking out loud.

@albertborsos commented on GitHub (Nov 9, 2025): Should we make sure to notify the client and reference the modifications, especially if we’ve modified a lot of files? It’s easy to forget when we’re in the flow. Is it possible that before OpenCode starts editing a file or reading it for context, it checks the latest modification date from its cache and compares it to the file’s modification date? If they’re different, it rereads the file. I don’t know how it works, I’m just thinking out loud.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2728