Skip to content

Commit d9fb237

Browse files
committed
Fix persistent code rewind restore
Wire FileHistoryRestore through core, create per-thread file-history checkpoints for user turns, and keep the pre-response Esc rewind path from leaving interrupted history behind. Also bumps Open Codex to 0.133.3 and documents the rewind behavior for the release prompt.
1 parent 7e10bc4 commit d9fb237

16 files changed

Lines changed: 378 additions & 137 deletions

File tree

FEATURES.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ Fast-moving prompt packs, hooks, setup flows, and project policies are better ha
5353
| `/export` | Export the current session transcript to a user-chosen `.md` or `.txt` path. | `/export <path>` | Useful for debugging, archival, and sharing. |
5454
| Renamed session identity | Renamed sessions show `Session: <name>` in the chat composer and use the name in quit guidance while keeping resume commands direct. | `/rename`, chat composer, quit summary | Resume hints use `open-codex resume <thread-id>` / `open-codex-dev resume <thread-id>` instead of picker wording. |
5555
| Agent view session browser (beta) | Users can browse saved sessions, peek transcript content, resume a selected thread, or start a new session from the browser. | `codex agents`, composer Left arrow | Beta surface; useful for local session navigation but still expected to evolve. |
56-
| Claude Code-style rewind UX | Double-Esc rewind supports code + conversation restore and a cleaner picker. | Double-Esc backtrack flow | Recent fixes tightened session scoping and ordering. |
56+
| Claude Code-style rewind UX | Double-Esc rewind supports code + conversation restore and a cleaner picker. | Double-Esc backtrack flow | Recent fixes tightened session scoping, ordering, and pre-response Esc rewind. |
57+
| Persistent code rewind checkpoints | Code restore uses per-thread file-history checkpoints that survive TUI exit/resume. | User turn start, apply_patch tracking, `FileHistoryRestore` | Restores tracked patch edits for the current thread only, not unrelated sessions or untracked global git state. |
5758
| Revoke restore scope fix | Conversation-only restore no longer rolls back files. | Revoke/rewind restore logic | Fixed by `b6f62e4867`. |
5859
| Esc interrupt routing | Single Esc interrupt and double-Esc rewind detection both work without blocking each other. | Composer key handling | Fixed by `0d20c120d8`. |
5960

@@ -94,6 +95,13 @@ Fast-moving prompt packs, hooks, setup flows, and project policies are better ha
9495

9596
## Release Notes
9697

98+
### 0.133.3 - 2026-05-27
99+
100+
- Wire code rewind all the way through core: `FileHistoryRestore` now restores tracked file checkpoints instead of being a no-op.
101+
- Persist file-history checkpoints under the current thread id, so code restore still works after quitting and resuming the same session.
102+
- Start file-history checkpoints when a real user turn begins, matching Claude Code's snapshot-before-edits model while keeping restore scoped to the current Open Codex thread.
103+
- Extend the pre-response Esc rewind path so the submitted prompt returns to the composer, the interrupted turn is rolled back from conversation history, and the transient interrupt notice is not left behind.
104+
97105
### 0.133.2 - 2026-05-25
98106

99107
- Extend Claude-style Esc rollback through the `TurnStarted`-before-first-output window: if the model has not emitted assistant text, reasoning, plan output, or tool/command activity yet, Esc restores the submitted prompt to the composer and interrupts the turn.

README.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,19 @@ From recent fork-specific changes:
127127

128128
This brings a Claude Code-style export flow into the TUI without requiring external scripts or manual transcript scraping.
129129

130-
### 6. Reasoning effort controls and per-turn status visibility
130+
### 6. Claude Code-style rewind and persistent code restore
131+
132+
From recent fork-specific changes:
133+
134+
- double-Esc rewind supports conversation restore, code restore, or both from the same picker
135+
- pre-response Esc rewind treats a just-submitted query as editable again: the prompt returns to the composer, the interrupted turn is removed from conversation history, and no stale interrupt notice is left behind
136+
- code restore records per-thread file-history checkpoints before a real user turn can edit files
137+
- checkpoints are stored under the thread id, so restore still works after quitting and resuming the same session
138+
- code restore is scoped to tracked edits in the current session thread; it does not reset unrelated sessions or global git state
139+
140+
This keeps rewind close to Claude Code's workflow while preserving Open Codex's session/thread boundaries.
141+
142+
### 7. Reasoning effort controls and per-turn status visibility
131143

132144
From recent fork-specific changes:
133145

@@ -141,7 +153,7 @@ From recent fork-specific changes:
141153

142154
This keeps two intent levels separate: `Shift+Tab` is a persistent speed/default switch, while `ulw`/`ultra`/`xhigh` markers stay current-turn-only. The status line describes the active foreground turn without making a temporary marker look like a persistent configuration change.
143155

144-
### 7. Lightweight `/btw` side questions
156+
### 8. Lightweight `/btw` side questions
145157

146158
From recent fork-specific changes:
147159

@@ -151,7 +163,7 @@ From recent fork-specific changes:
151163

152164
This is intended for "by the way" questions that are useful during work but should not become the primary task thread.
153165

154-
### 8. Parallel-first subagent planning policy
166+
### 9. Parallel-first subagent planning policy
155167

156168
Implemented through the user-scope `~/.codex/AGENTS.md` instruction layer, with an extracted repo example in [`docs/open-codex/parallel-first-agent-execution.md`](docs/open-codex/parallel-first-agent-execution.md):
157169

@@ -456,7 +468,19 @@ Codex CLI 是开源的,但上游仓库当前对外部代码贡献采用 invita
456468

457469
这让类似 Claude Code 的会话导出能力直接进入 TUI,而不需要额外脚本或手工抓 transcript。
458470

459-
### 6. Reasoning effort 控制与单 turn 状态可见性
471+
### 6. Claude Code-style rewind 与持久化代码回滚
472+
473+
来自最近几条 fork 自有改动:
474+
475+
- double-Esc rewind 可以从同一个 picker 里选择只恢复 conversation、只恢复 code,或同时恢复两者
476+
- pre-response Esc rewind 会把刚提交但尚未产生输出的 query 当作可继续编辑:prompt 回到 composer,interrupted turn 从 conversation history 中移除,并且不会留下过期的 interrupt notice
477+
- code restore 会在真实 user turn 可能编辑文件前记录 per-thread file-history checkpoint
478+
- checkpoint 按 thread id 落盘,因此退出并 resume 同一个 session 后仍然可以恢复
479+
- code restore 只作用于当前 session thread 中被追踪的文件改动,不会 reset 其他 session 或全局 git 状态
480+
481+
这让 rewind 体验更接近 Claude Code,同时保留 Open Codex 的 session/thread 边界。
482+
483+
### 7. Reasoning effort 控制与单 turn 状态可见性
460484

461485
来自最近几条 fork 自有改动:
462486

@@ -470,7 +494,7 @@ Codex CLI 是开源的,但上游仓库当前对外部代码贡献采用 invita
470494

471495
这里把两层意图区分开:`Shift+Tab` 是持久化 speed/default switch,而 `ulw``ultra``xhigh` marker 仍然只影响当前 turn。status line 会描述当前前台 turn,但不会把一次性的 marker 伪装成持久配置变更。
472496

473-
### 7. 轻量 `/btw` side questions
497+
### 8. 轻量 `/btw` side questions
474498

475499
来自最近几条 fork 自有改动:
476500

@@ -480,7 +504,7 @@ Codex CLI 是开源的,但上游仓库当前对外部代码贡献采用 invita
480504

481505
这个能力适合“顺便问一下”的问题:它对当前工作有帮助,但不应该接管主任务线程。
482506

483-
### 8. Parallel-first subagent planning policy
507+
### 9. Parallel-first subagent planning policy
484508

485509
通过 user-scope `~/.codex/AGENTS.md` 指令层实现,并在 repo 中抽取了示例文件:[`docs/open-codex/parallel-first-agent-execution.md`](docs/open-codex/parallel-first-agent-execution.md)
486510

codex-cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@leonw24/open-codex",
3-
"version": "0.131.6",
3+
"version": "0.133.3",
44
"license": "Apache-2.0",
55
"bin": {
66
"open-codex": "bin/codex.js"

0 commit comments

Comments
 (0)