Bug: Unable to Revert Code Outside Workspace in OpenCode #9229

Open
opened 2026-02-16 18:11:57 -05:00 by yindo · 2 comments
Owner

Originally created by @satyamkumar420 on GitHub (Feb 12, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

When working with OpenCode, I noticed that the revert functionality does not work for files located outside the current workspace directory.
If I make changes to a file outside the workspace and attempt to revert those changes, nothing happens. The revert action either fails silently or does not trigger at all.

Expected Behavior
The revert feature should:
Either allow reverting changes for files outside the workspace
Or clearly show an error/notification explaining that reverting is restricted to workspace files only

Actual Behavior
Revert does not work for files outside the workspace
No clear error message or feedback is shown

Steps to Reproduce

  1. Open a workspace in OpenCode
  2. Modify a file that is located outside the workspace directory
  3. Try to revert the changes
  4. Observe that revert does not work

Environment
OS: Windows 10
OpenCode Version: and 1.60

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Originally created by @satyamkumar420 on GitHub (Feb 12, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description When working with OpenCode, I noticed that the revert functionality does not work for files located outside the current workspace directory. If I make changes to a file outside the workspace and attempt to revert those changes, nothing happens. The revert action either fails silently or does not trigger at all. Expected Behavior The revert feature should: Either allow reverting changes for files outside the workspace Or clearly show an error/notification explaining that reverting is restricted to workspace files only Actual Behavior Revert does not work for files outside the workspace No clear error message or feedback is shown Steps to Reproduce 1. Open a workspace in OpenCode 2. Modify a file that is located outside the workspace directory 3. Try to revert the changes 4. Observe that revert does not work Environment OS: Windows 10 OpenCode Version: and 1.60 ### Plugins _No response_ ### OpenCode version _No response_ ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal _No response_
yindo added the windowsbug labels 2026-02-16 18:11:57 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 12, 2026):

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

  • #11113: Patch tool should fail fast on paths outside workspace (directly related to workspace boundary handling)
  • #10210: Undo/revert fails for files with non-ASCII filenames on Windows
  • #10287: Critical bug revert undo messages
  • #10589: Snapshot .nothrow() causes silent data loss — /undo and /redo revert files to stale content
  • #7775: Unrevert from subdirectory overwrites files in other directories with stale versions
  • #8607: Revert is incomplete

If your issue is distinct from these, please provide additional context explaining how it differs.

@github-actions[bot] commented on GitHub (Feb 12, 2026): This issue might be a duplicate of existing issues. Please check: - #11113: Patch tool should fail fast on paths outside workspace (directly related to workspace boundary handling) - #10210: Undo/revert fails for files with non-ASCII filenames on Windows - #10287: Critical bug revert undo messages - #10589: Snapshot `.nothrow()` causes silent data loss — `/undo` and `/redo` revert files to stale content - #7775: Unrevert from subdirectory overwrites files in other directories with stale versions - #8607: Revert is incomplete If your issue is distinct from these, please provide additional context explaining how it differs.
Author
Owner

@OpeOginni commented on GitHub (Feb 13, 2026):

I am able to reproduce. The issue also allows cases where if you revert a message that made changes to only external directory, breaks the session summary. Could tinker a fix, to allow tracking of specific external directories where updates were made, but not sure how the team might want to handle this.

@OpeOginni commented on GitHub (Feb 13, 2026): I am able to reproduce. The issue also allows cases where if you revert a message that made changes to only external directory, breaks the session summary. Could tinker a fix, to allow tracking of specific external directories where updates were made, but not sure how the team might want to handle this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9229