anomalyco / anomalyco/opencode

Running UNDO command deletes a file that was just read

Open
#46,783 1 comment 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Sep 2, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
Avg merge
7h 2m
Merged PRs (30d)
384

Description

Description

OK, this is a bit hard to explain, but hear me out. Running a /undo command deletes a file under very specific circumstances. Seems like strange /undo logic.

I asked LLM to read some file that I downloaded, which failed because I forgot to move it from ~/Downloads into my current working directory. OK I think, no big deal, I move the file over, run /undo in OpenCode and run the prompt again - but it fails again saying. So I got very confused and indeed the file vanished.

It took me a while to figure out what is going on, but it seems to be easily reproducible and reliable bug.

Plugins

None

OpenCode version

1.18.18

Steps to reproduce
  • ask LLM to read a non-existing file (it fails obviously)
  • create the file
  • run /undo so that you can re-run the prompt
  • the file is suddenly gone because of the /undo command
Screenshot and/or share link

No response

Operating System

ArchLinux

Terminal

foot

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.