Skip to content

[bug] /undo removed the last message, but didn't revert the code edit. #2642

Closed

Description

@SsparKluo

When undo the latest message, it shows revert 1 message and several tool calls, but the real file is not reverted to the previous content.

An example here: https://opencode.ai/s/zOL38Zus

I have /undo the latest message:

Image

but the file content is still:


# Demo File

This is a sample markdown file created as a demo.

- Item 1
- Item 2
- Item 3

## Code Block Example

```python
print("Hello, world!")
```

It happens with different models, including copilot/gpt-4.1, deepseek-reasoner, qwen3-coder.

Activity

  1. github-actions commented on Sep 17, 2025

    @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. thdxr commented on Sep 17, 2025

    @thdxr
    Member

    we only turn on snapshotting in git repos (we don't actually use it but this is way to avoid running it on huge dirs)

    is this ia git dir?

  3. SsparKluo commented on Sep 17, 2025

    @SsparKluo
    Author

    That demo, no. Do you means the cwd should be in a git dir to use /undo?

  4. rekram1-node commented on Sep 17, 2025

    @rekram1-node
    Contributor

    He is saying that file changes will only be reverted in git repos rn so if you arent in a git repo this is expected behavior

  5. SsparKluo commented on Sep 17, 2025

    @SsparKluo
    Author

    I see. Just ... didn't see any info in the docs mention that

  6. riotrah commented on Oct 24, 2025

    @riotrah

    I think this would benefit from being made clearer when attempting to use it

  7. rekram1-node commented on Oct 24, 2025

    @rekram1-node
    Contributor

    i agree, also: we are thinking about a smarter way to implement it that wont rely on git and will he more performant

  8. riotrah commented on Oct 28, 2025

    @riotrah

    Awesome, would love to hear more or see it. Aside while I have your attention: crazy to think your serverless stack tutorial was my first introduction to full stack web dev in college, and a decade I find out this tool is by you guys too. Cheers man!

  9. rekram1-node commented on Oct 28, 2025

    @rekram1-node
    Contributor

    That was before I joined so all credit goes to the original 3 (Dax, Jay, Frank)

    Thank you tho!

    Awesome, would love to hear more or see it

    We are thinking about using parcel with file apis to monitor for edits and track diffs

  10. zhennandu commented on Mar 16, 2026

    @zhennandu

    I solved this problem by deleting ~/.local/share/opencode/snapshot/global, as it didn't contain any ref files. After deletion, a normal ref file was automatically regenerated.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions