Skip to content

/undo only reverts conversation, not code changes across repositories #26488

Closed as not planned

Description

@lightrao

Description

I encountered an issue with /undo when using opencode across multiple Git repositories.

My opencode session was started inside repository A, but during the session I modified files inside repository B.

When I executed:

/undo

only the conversation history was reverted.

The code changes inside repository B were NOT reverted.

Expected Behavior

/undo should either:

  1. Revert all file changes made during the last assistant turn, including cross-repository edits

OR

  1. Clearly warn/document that /undo only tracks changes inside the current session repository.

Actual Behavior

  • Conversation rollback works
  • Changes in repository A may rollback
  • Changes in repository B remain unchanged

This can be dangerous because users may assume /undo restores all AI-generated modifications.

Reproduction Steps

  1. Start opencode inside repository A
  2. Ask the assistant to modify files in repository B
  3. Execute /undo
  4. Observe that repository B changes are not reverted

Environment

  • macOS Apple Silicon (M2)
  • opencode latest version
  • multiple Git repositories

Suggestion

Possible improvements:

  • Track all modified repositories during a session
  • Extend /undo to support cross-repository rollback
  • Or explicitly limit/document /undo scope in the UI/docs

Activity

  1. changed the title [-] only reverts conversation, not code changes across repositories[/-] [+]`/undo` only reverts conversation, not code changes across repositories[/+] on May 9, 2026
  2. github-actions commented on May 9, 2026

    @github-actions
    Contributor

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

    Your report adds a specific cross-repository scenario (changes in repo B not reverted when session is started in repo A), which may be a distinct edge case worth tracking separately. Please review the above issues and comment there if your situation is covered, or clarify how your case differs.

  3. lightrao commented on May 9, 2026

    @lightrao
    Author

    Thanks for checking and linking those issues.

    I reviewed #5474 and #4704. They cover the more general case where /undo does not revert file edits, including cases within the active project/repository.

    The distinction in this report is the repository boundary:

    • opencode is started from Git repository A
    • the assistant edits files in a separate Git repository B
    • running /undo rolls back the conversation, but the changes in repository B remain

    So this may be related to the same undo/snapshot mechanism, but the specific edge case is cross-repository edits made from a single session. If /undo is intentionally scoped only to the session's initial repository/worktree, then a warning or documentation note would address the safety issue. If it is intended to revert the last assistant turn regardless of which repository was modified, then repo B should probably be tracked as part of the undo state too.

  4. github-actions commented on Jul 9, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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