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

Closed
opened 2026-02-16 17:32:25 -05:00 by yindo · 9 comments
Owner

Originally created by @SsparKluo on GitHub (Sep 17, 2025).

Originally assigned to: @thdxr on GitHub.

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.

Originally created by @SsparKluo on GitHub (Sep 17, 2025). Originally assigned to: @thdxr on GitHub. 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: <img width="1435" height="529" alt="Image" src="https://github.com/user-attachments/assets/790f1055-1ae1-443e-b4ce-6f7a5ec1a423" /> but the file content is still: <pre><code> # 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!") ``` </code></pre> It happens with different models, including copilot/gpt-4.1, deepseek-reasoner, qwen3-coder.
yindo closed this issue 2026-02-16 17:32:25 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Sep 17, 2025):

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

  • #2612: /undo after a agent did some task does undo the work of that agent but doesn't remove the agent's tab - This issue describes the same problem where /undo removes the message but doesn't properly revert code edits

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

@github-actions[bot] commented on GitHub (Sep 17, 2025): This issue might be a duplicate of existing issues. Please check: - #2612: /undo after a agent did some task does undo the work of that agent but doesn't remove the agent's tab - This issue describes the same problem where /undo removes the message but doesn't properly revert code edits Feel free to ignore if none of these address your specific case.
Author
Owner

@thdxr commented on GitHub (Sep 17, 2025):

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?

@thdxr commented on GitHub (Sep 17, 2025): 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)<br><br>is this ia git dir?
Author
Owner

@SsparKluo commented on GitHub (Sep 17, 2025):

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

@SsparKluo commented on GitHub (Sep 17, 2025): That demo, no. Do you means the cwd should be in a git dir to use /undo?
Author
Owner

@rekram1-node commented on GitHub (Sep 17, 2025):

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

@rekram1-node commented on GitHub (Sep 17, 2025): 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
Author
Owner

@SsparKluo commented on GitHub (Sep 17, 2025):

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

@SsparKluo commented on GitHub (Sep 17, 2025): I see. Just ... didn't see any info in the docs mention that
Author
Owner

@riotrah commented on GitHub (Oct 23, 2025):

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

@riotrah commented on GitHub (Oct 23, 2025): I think this would benefit from being made clearer when attempting to use it
Author
Owner

@rekram1-node commented on GitHub (Oct 23, 2025):

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

@rekram1-node commented on GitHub (Oct 23, 2025): i agree, also: we are thinking about a smarter way to implement it that wont rely on git and will he more performant
Author
Owner

@riotrah commented on GitHub (Oct 28, 2025):

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!

@riotrah commented on GitHub (Oct 28, 2025): 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!
Author
Owner

@rekram1-node commented on GitHub (Oct 28, 2025):

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

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

No dependencies set.

Reference: anomalyco/opencode#1743