Skip to content

Undo should expose a completed compaction boundary in TUI and Desktop/Web #41266

Closed as not planned

Description

@WhiteGiverMa

Description

A completed compaction must be undoable as its own history boundary. With this sequence:

user prompt → assistant work → completed compaction → later agent work

Current rollback can fall back to the preceding user message rather than the compaction. That rewinds past assistant output that existed before the compaction, so there is no way to restore the exact pre-compaction state.

This is related to #8689, but is the compaction-specific consequence: compaction is now a durable request, yet it is not consistently exposed as an undo target. It also regresses the practical resolution of #32368, where /undo could remove the compaction marker while keeping the preceding assistant turn.

Steps to reproduce

  1. Use a session and send a prompt; wait for the assistant to finish work.
  2. Run /compact and wait for compaction to complete.
  3. Let the agent produce more work after compaction.
  4. Invoke Undo or use the client's revert UI.

Expected behavior

Undoing a completed compaction should remove the compaction and subsequent work, while retaining all messages before the compaction, including the preceding assistant turn, and restore that history to active context.

This must be discoverable in every client:

  • Desktop/Web: a clickable Undo compaction action on or next to the completed compaction marker.
  • TUI: a named command-palette/slash-command or keybinding action; where mouse actions are available, the same action should be clickable at the compaction marker.

All entry points must target the compaction boundary itself, not silently fall back to the preceding user message.

Actual behavior

The nearest undo target can be the preceding user message. Undoing from there discards the assistant messages between that user message and the compaction point, so the pre-compaction state cannot be restored exactly.

OpenCode version

1.18.15

Operating System

Linux (WSL2) & Windows 11

Terminal

windows terminal / wezterm

Activity

  1. changed the title [-]V2 undo cannot revert a completed compaction without discarding pre-compaction assistant turns[/-] [+]Undo should expose a completed compaction boundary in TUI and Desktop/Web[/+] on Aug 8, 2026
  2. andreasntr commented on Sep 26, 2026

    @andreasntr

    adding that interrupting a compaction and sending a user message should not rerun compaction before the new user message: if the user wants to redo compaction, then the / command is there, otherwise the chat should resume from the previous agent message.

    This is related to this issue because /undo undoes the previous agent message instead of the compaction block

    Image
  3. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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