Skip to content

Add file undo option to backtrack mode (Ctrl+Enter) #9344

@huynhbaoking112

Description

@huynhbaoking112

I have a working implementation ready that modifies app_backtrack.rs in both codex-tui and codex-tui2.

Currently, the backtrack feature (Esc → Esc → Enter) only rolls back the conversation history but does not revert file changes made by the agent. This means users have to manually undo file modifications after backtracking, which breaks the workflow.

I propose adding a new keybinding Ctrl+Enter in backtrack preview mode that:

  1. Rolls back the conversation history (existing behavior)
  2. Also reverts file changes by triggering Op::Undo (using the existing ghost commit/undo infrastructure)

This gives users two options when backtracking:

  • Enter - Rollback conversation only (keep file changes)
  • Ctrl+Enter - Rollback conversation AND revert file changes

This feature leverages the existing undo feature (ghost commits) that's already implemented in codex-core, making the implementation minimal and non-invasive.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displayenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions