Ctrl+C exits Codex immediately; request double-press confirmation or non-exit behavior
Title
Ctrl+C exits Codex immediately; request double-press confirmation or non-exit behavior
For analogy, claude code requests a double ctrl-c press to exit from the app, consistency would be nice, and makes switching easier.
Summary
In the Codex CLI, pressing Ctrl+C closes the current session immediately. This is disruptive during normal use and makes the terminal interaction less forgiving than comparable tools.
Claude does not exit on a single Ctrl+C. It requires a double press, which makes accidental termination much less likely.
Also, Ctrl+C is often used by users as a "copy" shortcut in many environments or muscle-memory contexts, so binding immediate session termination to a single press is easy to trigger by mistake.
Current behavior
- A single
Ctrl+Cexits the Codex session. - If the key is pressed reflexively or by mistake, the active conversation is interrupted immediately.
Expected behavior
One of these behaviors would be preferable:
- Ignore a single
Ctrl+Cat the top-level prompt and require a secondCtrl+Cwithin a short timeout to exit. - Show a short message after the first
Ctrl+C, such as "Press Ctrl+C again to exit". - Reserve
Ctrl+Cprimarily for interrupting the currently running child command, not for terminating the whole Codex session immediately.
Why this matters
- It reduces accidental session loss.
- It matches user expectations better, especially for people coming from Claude, where
Ctrl+Cdoes not terminate immediately. Ctrl+Cis commonly associated with copy behavior in many interfaces, so immediate exit on a single press is easy to hit unintentionally.
Reproduction
- Start an interactive Codex session.
- Press
Ctrl+Conce. - Observe that the session closes immediately.
Suggested fix
Implement a two-step interrupt/exit flow for the interactive CLI:
- First
Ctrl+C: warn and keep the session alive. - Second
Ctrl+Cwithin a short interval: exit.
This would be safer and more ergonomic while preserving a fast path for users who intentionally want to quit.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗