TUI: Ctrl+C while editing a previous message appends thread_rolled_back and hides the message
Summary
In the interactive Codex CLI TUI, pressing Ctrl+C while editing a previous message appears to be handled as a thread rollback instead of a harmless edit cancellation. The selected previous message disappears from the TUI/resumed conversation, while the original message is still physically present in the session JSONL.
Version
Originally observed while using codex-cli 0.142.0.
After updating, local codex --version currently reports codex-cli 0.142.5; The display bugs still exist, but I have not yet confirmed the bug still reproduces from start on 0.142.5.
Reproduction Steps
- Start or resume an interactive Codex CLI TUI session.
- Press
Escto select a previous user message. - Press
Enterto edit that previous message. - Press
Ctrl+Cto quit/cancel the edit. - Observe the TUI transcript or resume/fork the session.
Actual Behavior
The selected previous message disappears from the TUI transcript / reconstructed conversation.
Expected Behavior
Canceling edit mode should discard only the temporary edit buffer. The original previous message should remain visible and the logical conversation should remain unchanged.
JSONL Investigation
The original message is still physically present in the saved session file under ~/.codex/sessions/.../*.jsonl, so the message content is not deleted from disk.
However, after each reproduction, the JSONL has an appended event like:
{"type":"event_msg","payload":{"type":"thread_rolled_back","num_turns":1}}
In my affected session, each thread_rolled_back event corresponded to one disappeared previous message. Removing those rollback events from a backed-up JSONL session file restored the missing messages when resuming the session.
Hypothesis
Ctrl+C from previous-message edit mode is taking the rollback path instead of the edit-cancel path. This likely affects the reconstructed logical thread, not just the current TUI display, because the rollback event is replayed from JSONL on resume/fork.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗