Ctrl+C exits via SIGINT (status 130) so TUI skips session summary/resume hint on WSL2

Open 💬 3 comments Opened Jan 18, 2026 by EnvyGithub

What version of Codex is running?

codex-cli 0.87.0

What platform is your computer?

Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 (WSL2 on Windows; Windows Terminal)

What issue are you seeing?

In the interactive TUI, pressing Ctrl+C sometimes terminates the process via SIGINT (exit status 130).
When this happens, Codex does not print the session summary / "To continue this session, run codex resume ..." message.

This makes it look like an abnormal exit and loses the resume hint.

Steps to reproduce

  1. Run codex (interactive TUI) inside WSL2.
  2. Send any prompt so token usage is non-zero.
  3. Press Ctrl+C.
  4. Observe that the process exits immediately and echo $? is 130.
  5. Observe that no session summary/resume hint is printed.

Expected behavior

Ctrl+C should be handled by the TUI input handling (like other Ctrl+C paths) and exit gracefully:

  • print session summary / resume hint (when token usage is non-zero)
  • avoid being killed by SIGINT

Workaround

Use /quit or /exit (or Ctrl+D when composer is empty) to exit cleanly.

Additional context

Other parts of the codebase already handle Ctrl+C via tokio::signal::ctrl_c() (e.g. codex-exec and core exec paths),
but the interactive TUI does not appear to listen for SIGINT/ctrl_c, so the process can be terminated before printing exit info.

View original on GitHub ↗

3 Comments

EnvyGithub · 7 months ago

Related (but not identical) reports I found while searching before filing:\n- #7109 (WSL2): apply_patch hangs; exiting sometimes needs Esc + two Ctrl+C; mentions SIGINT handling.\n- #4721 (closed): exec-mode SIGINT exit-code semantics discussion (not interactive TUI).\n\nThis issue (#9448) is specifically about interactive TUI being terminated by SIGINT (status 130) before it can print session summary/resume hint.

EnvyGithub · 7 months ago

I can reproduce on WSL2 (Windows Terminal) that Ctrl+C sometimes exits via SIGINT (status 130), so the TUI never reaches the normal shutdown path and does not print the session summary / "codex resume ..." hint.

Hypothesis: the TUI handles Ctrl+C only as a crossterm KeyEvent (ChatWidget::handle_key_event -> on_ctrl_c), but App::run\x27s main select! loop does not listen for SIGINT. In some WSL2/terminal states, Ctrl+C may be delivered as SIGINT (instead of / in addition to a key event), which terminates the process before it can emit the exit summary.

Suggested fix: add a tokio::signal::ctrl_c() branch in the TUI main event loop (codex-rs/tui/src/app.rs App::run select!), and route it into the same Ctrl+C path as the KeyEvent (e.g. synthesize a Ctrl+C KeyEvent and call the existing handler). This should unify behavior across "Ctrl+C as key event" vs "Ctrl+C as SIGINT", and preserve the existing double-press quit / interrupt semantics.

Happy to test any patch on WSL2.

oxysoft · 5 months ago

Related broader continuation/resume UX idea: #14041\n\nThis bug is one concrete place where resume/session-summary hints disappear because exit is not graceful. #14041 is the broader request for contextual continuation hints and ephemeral refresh prompts; this ticket feels like a prerequisite seam for that UX to be reliable on all platforms.