You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Make compaction revertible (undo / explicit dialog) #32368
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Today compaction (auto on overflow, or manual /compact) collapses earlier turns into a summary and the original messages are filtered out of the active context with no way back.
My use case: after finishing a design discussion I often compact on purpose to hand the model a clean state. But then the model needs concrete implementation details and has to re-grep the codebase. When that happens I want to drop the compaction and continue from the full pre-compaction conversation instead of re-explaining everything.
Proposal: treat compaction as an explicit, reversible step. Keep the pre-compaction history recoverable (it already is in storage — filterCompacted only hides it) and surface an action to revert a compaction and its summary so the session resumes from the uncompacted view. A confirmation/preview dialog before compaction would also make the decision deliberate.
Why it belongs in opencode: compaction is already lossless on disk — the data isn't deleted, only filtered. Revert is mostly a history-selection / presentation concern, not a new storage model. This would make compaction safe to use as a deliberate workflow tool instead of a one-way door.
What I'm specifically after: after compaction runs (manual or auto), an action to undo that compaction and resume from the full pre-compaction conversation in the same session — useful when you compacted deliberately but then need the dropped details back without re-explaining or branching. Since the data is already lossless on disk, this is a history-selection concern rather than a storage change.
Happy to close as a duplicate of #17802 if the maintainers consider in-place revert in scope there; otherwise I think it's complementary.
Thanks for the pointer — confirmed /undo does restore the pre-compaction context. I missed earlier that it sets a revert marker at the user message before the compaction marker, and the next prompt's cleanup deletes the compaction message so the full context is sent to the model again.
So the feature already exists. For anyone else landing here from the TUI: the actual slash command is /undo (paired with /redo), not /revert — "revert" is just the internal service/API name. It wasn't obvious to me that /undo also un-compacts.
Does this still work for you in 2.x? In my testing, /undo doesn't just revert the compaction operation itself but all history that came before it up until my last message. This is largely defeating the purpose for me, since that's often the part where the agent has independently been running for a while until auto-compaction kicked in.
Was this the desired behavior for you, or is this a change from 1.x?
Activity
github-actions commentedon Jun 15, 2026
This issue might be a duplicate of existing issues. Please check:
/compactwith options to continue or branch — overlaps with the "explicit dialog before/after compaction" part of this requestgzb1128 commentedon Jun 15, 2026
Thanks for the pointers — checked all three. My core ask is distinct from each:
/compactprompt to branch into a new session. The "explicit dialog" piece of mine overlaps here, but the revert I'm asking for stays in the same session and restores the uncompacted history, instead of forking.What I'm specifically after: after compaction runs (manual or auto), an action to undo that compaction and resume from the full pre-compaction conversation in the same session — useful when you compacted deliberately but then need the dropped details back without re-explaining or branching. Since the data is already lossless on disk, this is a history-selection concern rather than a storage change.
Happy to close as a duplicate of #17802 if the maintainers consider in-place revert in scope there; otherwise I think it's complementary.
rekram1-node commentedon Jun 15, 2026
u can use /revert for this
gzb1128 commentedon Jun 15, 2026
Thanks for the pointer — confirmed
/undodoes restore the pre-compaction context. I missed earlier that it sets a revert marker at the user message before the compaction marker, and the next prompt's cleanup deletes the compaction message so the full context is sent to the model again.So the feature already exists. For anyone else landing here from the TUI: the actual slash command is
/undo(paired with/redo), not/revert— "revert" is just the internal service/API name. It wasn't obvious to me that/undoalso un-compacts.neobrain commentedon Oct 24, 2026
Does this still work for you in 2.x? In my testing,
/undodoesn't just revert the compaction operation itself but all history that came before it up until my last message. This is largely defeating the purpose for me, since that's often the part where the agent has independently been running for a while until auto-compaction kicked in.Was this the desired behavior for you, or is this a change from 1.x?