Skip to content

v0.8.6 feat: /undo — revert the most recent apply_patch #384

@Hmbown

Description

@Hmbown

Pitch

Codex/opencode parity. The model just made an edit you don't want. Today you'd `/restore` against a snapshot — but that reverts the whole workspace state, not just the last edit. `/undo` is surgical: revert just the most recent `apply_patch` / `edit_file` / `write_file` tool result.

Implementation sketch

  1. Every successful patch tool call records a per-file backup (we already have `snapshot::repo` + the workspace-side git mirror).
  2. `/undo` walks the most recent tool calls back, picks the first patching call, restores the affected files from that snapshot.
  3. Status toast: "Reverted apply_patch from turn N".
  4. `/undo 3` undoes the 3 most recent patching calls in reverse order.

Acceptance

  • `/undo` reverts the last patching tool call.
  • `/undo N` reverts the last N patching calls.
  • No-op with toast when there's nothing to undo.
  • Tests cover apply_patch, edit_file, write_file paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestv0.8.6Targeting v0.8.6

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions