Skip to content

Critical bug revert undo messages #10287

Closed

Description

@Genrie9

Undo/revert reverts files to incorrect (old) state, deleting committed code

Description

When using the "revert messages" / undo functionality in the OpenCode TUI, files in the working directory were reverted to an old state (from weeks ago), not to the state before the reverted message. This caused ~1300 lines of committed code to be silently deleted from the working directory.

Steps to Reproduce

  1. Have a project with recent commits (e.g., commits from the past 2 weeks)
  2. Use "revert messages" or undo in the OpenCode TUI to undo a recent message
  3. Run git status — shows many modified files
  4. Run git diff --stat — shows massive deletions

Expected Behavior

Files should be reverted to their state before the undone message's changes, preserving all other committed code.

Actual Behavior

  • Multiple files were modified (uncommitted changes appeared)
  • git diff --stat showed ~1300 lines deleted across ~35 files
  • The deleted code was from commits made days/weeks ago (not from the reverted message)
  • Affected files included core entities, DbContext, services, etc.
  • Running dotnet build failed with 40+ errors due to missing properties/entities
  • git reflog showed NO reset/revert operations — changes were only in working directory
  • git checkout -- . restored everything correctly

Environment

  • OS: Windows 10
  • OpenCode version: latest as of Jan 2026
  • Shell: PowerShell / Git Bash

Workaround

Run git checkout -- . to restore all files to the last committed state.

Impact

High — This bug can silently delete large amounts of committed code without any warning. Users may not notice until build fails or runtime errors occur. If users commit these changes without reviewing, they could lose significant work.

Related Issues

Activity

  1. github-actions commented on Jan 23, 2026

    @github-actions
    Contributor

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

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

  2. AndryHTC commented on Feb 4, 2026

    @AndryHTC

    This is killing me. I have to step out of OpenCode. So many lost changes

  3. Woukim commented on Feb 4, 2026

    @Woukim

    This is killing me. I have to step out of OpenCode. So many lost changes

    And this will be the right decision

  4. f123888 commented on Feb 6, 2026

    @f123888

    It's hard to believe that a project with nearly 100,000 stars would have such a basic bug.

  5. Jebvvnnb commented on Feb 6, 2026

    @Jebvvnnb

    I've encountered this problem as well, and not just once. I thought I accidentally pressed some button, but it seems this is an ongoing bug... I'm speechless.

  6. AledHe commented on Feb 13, 2026

    @AledHe

    Same here via clicking a message and choosing revert. I was trying to revert a interruptted message, and see all my recent git diff also reverted. I realized something happened again felt really frustrated.

    Looks like a simple restore/reset --hard if opencode bugged, but we don't know what the bug is, I suggest developers don’t simply do reset/restore (git) with the revert (opencode) for now. This causes disasters.

    btw, after seeing the code diff showed up after the revert message, I tried ctrl+x r, no recovery

  7. UPROOT01 commented on Feb 16, 2026

    @UPROOT01

    #7775 (comment)

    I think these two might be related because when i hit redo (after I got this other folder reverted to IDK when after an undo), it didnt redo the other foler, i had to restore my last commit which luckily was pretty recent but I completely do not trust the undo/redo commands right now

  8. AndryHTC commented on Feb 20, 2026

    @AndryHTC

    #7775 (comment)

    I think these two might be related because when i hit redo (after I got this other folder reverted to IDK when after an undo), it didnt redo the other foler, i had to restore my last commit which luckily was pretty recent but I completely do not trust the undo/redo commands right now

    Yes. It's a "you lied once, you are lier forever" situation

  9. github-actions commented on Apr 22, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  10. BartekDeveloper commented on Jul 28, 2026

    @BartekDeveloper

    It still happens.

  11. Cleroth commented on Jul 28, 2026

    @Cleroth

    Chill guys, they need to wait for GPT 7 to fix this.

    ... Or just put "snapshot": false in your config and use something else because the snapshot system in opencode is just useless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions