diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index a402ef3f58..70c78d8f9b 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -723,6 +723,7 @@ impl Session { user_explicitly_approved_this_action, changes, }) => { + self.clear_last_undo_patch(); turn_diff_tracker.on_patch_begin(&changes); EventMsg::PatchApplyBegin(PatchApplyBeginEvent { diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs index 60678b7427..aac87949d6 100644 --- a/codex-rs/tui/src/chatwidget.rs +++ b/codex-rs/tui/src/chatwidget.rs @@ -1268,20 +1268,21 @@ impl ChatWidget { })]; let items = vec![ - SelectionItem { - name: "Undo last turn diff".to_string(), - description: Some( - "Revert files that Codex changed during the most recent turn.".to_string(), - ), - is_current: false, - actions: undo_actions, - }, - SelectionItem { - name: "Cancel".to_string(), - description: Some("Close without undoing any files.".to_string()), - is_current: false, - actions: Vec::new(), - }]; + SelectionItem { + name: "Undo last turn diff".to_string(), + description: Some( + "Revert files that Codex changed during the most recent turn.".to_string(), + ), + is_current: false, + actions: undo_actions, + }, + SelectionItem { + name: "Cancel".to_string(), + description: Some("Close without undoing any files.".to_string()), + is_current: false, + actions: Vec::new(), + }, + ]; self.bottom_pane.show_selection_view( "Undo last Codex turn?".to_string(),