Skip to content

Critical bug revert undo messages #10287

@Genrie9

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

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions