feat: /undo command — remove last turn from the conversation - #957
Draft
Betterlol wants to merge 1 commit into
Draft
feat: /undo command — remove last turn from the conversation#957Betterlol wants to merge 1 commit into
Betterlol wants to merge 1 commit into
Conversation
Protocol layer:
- Command::Undo(count) — removes N events from the durable session
- Event::SessionUndone(events_removed) — engine confirms the removal
- Wire format: {"command":"undo","count":N} / {"event":"session_undone","events_removed":N}
Session model:
- Session::remove_last(count) — returns new session with last N events removed
Serve engine:
- Undo dispatch: checks idle state, calls session.remove_last + store.create
- Rejects with command_error when work is in flight or no durable session
TUI:
- /undo [count] slash command (default count=1)
- Ui::replace_transcript — scrollback-level rebuild for transcript rollback
- EngineSessionUndone — untagged message that survives stale-run guard
- Only available in Serve mode (oneshot rejected)
Betterlol
force-pushed
the
feat/command/undo
branch
from
August 21, 2026 12:34
2aa4788 to
a558fee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
/undo [count]to the TUI, letting the user remove the last N events from the durable session and rebuild the transcript.Changes
Protocol layer (
protocol/)Command::Undo(count~ : Int = 1)— wire format:{"command":"undo"}or{"command":"undo","count":N}Event::SessionUndone(events_removed~ : Int)—{"event":"session_undone","events_removed":N}Session model (
agent_session/)Session::remove_last(count)— returns new session with last N events removed (immutable, uses@vectorslicing)Serve engine (
cmd/openseek/serve.mbt)Undodispatched in the serve loop: checks idle state, callssession.remove_last(count)+store.create(modified)command_errorwhen work is in flight or no durable sessionTUI (
cmd/tui/)/undo [count]slash command (default count=1, rejects oneshot mode)Ui::replace_transcript— scrollback-level rebuild for transcript rollbackEngineSessionUndone— untagged message that survives stale-run guard, triggers session reload + transcript rebuildDesktop (
desktop/)Verification
moon check: clean (native + js)moon fmt --check: cleanmoon test: protocol 16, cmd/tui 83, agent_session 35, tui all passmoon info: regenerated.mbtifiles