Skip to content

Extend /rewind to optionally roll back file changes, not just the conversation #3697

@tanzhenxin

Description

@tanzhenxin

What would you like to be added?

Today the double-ESC / /rewind selector lets you pick a previous user turn and truncates the conversation back to that point, but the files on disk are left exactly as the model edited them. The result is that the chat says we never had the later turns, while the files still reflect everything those turns wrote.

The follow-up is to let users also roll back the workspace files when rewinding. When confirming a rewind to a chosen turn, the user should be presented with a small set of options, similar to other CLIs in this space:

  • Restore code and conversation
  • Restore conversation only (current behavior)
  • Restore code only

Where "restore code" reverts the files in the project back to the state they were in at the moment of the chosen turn. If no file changes happened after the chosen turn, the option can be hidden or shown as disabled. If file-history / checkpointing is not currently enabled for the project, the dialog should make that visible (and ideally explain in one line how to turn it on) instead of silently offering only "conversation only".

Follow-up to #3058.

Why is this needed?

The original request in #3058 was specifically about undoing what the agent did to the files in the last turn or last few turns ("撤回本轮对话的修改"). The conversation-only rewind that ships today does not address that — after rewinding, the user still has to manually git checkout / undo edits to get the workspace back, which is exactly the pain they were trying to avoid by asking for a rewind feature.

This also brings /rewind in line with how users coming from droid CLI and Claude Code expect rewind to behave: one entry point that can roll back conversation, files, or both, chosen at confirm time.

Additional context

Open questions for discussion (not a proposed solution, just things worth deciding before implementation):

  • Should checkpointing be enabled by default once /rewind depends on it, or stay opt-in with a clear nudge in the dialog when it's off?
  • Granularity: snapshot per turn vs. per tool call — which one matches user expectations when they pick "rewind to turn N"?
  • Untracked files and uncommitted user edits made between turns — restore them, leave them alone, or warn?

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions