openai / openai/codex

Bring back rewind: restore code and conversation to an earlier prompt

Open
#44,852 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

CLI enhancement session
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What variant of Codex are you using?

CLI

What feature would you like to see?

A /rewind command like the one in Claude Code. You pick an earlier prompt and restore the code, the conversation, or both to that point.

I know #9203 and #11626 already ask for this, so I'll keep it short. I wanted to connect those requests to something you can actually try, so I went ahead and built it. The code is here: https://github.com/georgekhananaev/codex/tree/rewind/checkpoints

I tried to open a pull request first, but this repo doesn't allow pull requests from outside accounts, so a link to the branch is the best I can do.

Honestly, rewind is the main thing that makes Claude Code feel smoother than Codex for me right now. Being able to undo a wrong turn in a couple of keystrokes makes long sessions a lot less stressful.

Additional information

How it works for the user: type /rewind, or press Esc twice with an empty composer, pick an earlier prompt, and then choose to restore the code and the conversation, just the conversation, or just the code. After a code restore there's also an option to undo it.

I read why the old /undo was removed, so this version is built differently:

  • It never touches git. Each thread keeps a small file history under CODEX_HOME/file-history, and history that hasn't been used for 30 days gets cleaned up.
  • It only records what apply_patch actually wrote, after approval, using the delta the runtime already has. Rejected patches and remote environments record nothing.
  • It's off by default behind a new experimental checkpoints feature. With the feature off, nothing is stored and no file contents get copied.
  • Restores skip symlinks, hard links, .git and anything outside the workspace roots. The current contents are saved first, so a restore can be undone.
  • Restoring the conversation reuses the existing backtrack fork, so there are no protocol or rollout changes.

The branch sits on top of current main and has unit tests for the store and the extension, plus an integration test through test_codex that covers both apply_patch routes. Edits made through shell commands aren't tracked, same as in Claude Code.

Happy to change the design, split it up, or hand it over if you'd rather build it your own way. Thanks for taking a look!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the linked checkpoints branch and its unit tests for the store and extension. Run the integration test through test_codex, which covers both apply_patch routes. Done means the described /rewind and double-Esc flows can restore code, conversation, or both, with the stated checkpoint safeguards.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.