Ctrl+C exits Codex immediately; request double-press confirmation or non-exit behavior

Resolved 💬 4 comments Opened Mar 14, 2026 by g-i-o-r-g-i-o Closed May 16, 2026

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+C exits 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+C at the top-level prompt and require a second Ctrl+C within a short timeout to exit.
  • Show a short message after the first Ctrl+C, such as "Press Ctrl+C again to exit".
  • Reserve Ctrl+C primarily 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+C does not terminate immediately.
  • Ctrl+C is commonly associated with copy behavior in many interfaces, so immediate exit on a single press is easy to hit unintentionally.

Reproduction

  1. Start an interactive Codex session.
  2. Press Ctrl+C once.
  3. 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+C within a short interval: exit.

This would be safer and more ergonomic while preserving a fast path for users who intentionally want to quit.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗