anomalyco / anomalyco/opencode
Undo should expose a completed compaction boundary in TUI and Desktop/Web
@nexxeln is already working on this.
Since Aug 8, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
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
- Use a session and send a prompt; wait for the assistant to finish work.
- Run
/compactand wait for compaction to complete. - Let the agent produce more work after compaction.
- 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 compactionaction 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.