Ctrl-Z suspend during active work can leave shell unusable after resume over tsh/Slurm
Open 💬 5 comments Opened Jun 23, 2026 by mvillmow
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
Summary
When Codex is doing work and I press Ctrl+Z to suspend it, then resume it, the shell can be left in a broken state where I cannot submit any commands.
Environment
- Local terminal: iTerm2 on macOS
- Remote access: tsh into a Linux Slurm cluster
- Workload context: Codex running active work on cluster/login nodes
Reproduction
- Open iTerm2 on macOS.
- Connect to a Linux Slurm cluster using tsh.
- Start Codex and let it begin active work.
- Press Ctrl+Z to suspend Codex.
- Bring Codex back with fg.
- Try to enter and submit shell commands.
Expected behavior
After resume, Codex and/or the shell should restore terminal state cleanly. The shell should accept and submit commands normally.
Actual behavior
After Codex comes back up, the shell does not work properly and commands cannot be submitted.
Notes
This looks like it may involve terminal mode or job-control state not being restored correctly after SIGTSTP/SIGCONT, especially through iTerm2 plus tsh on remote Linux machines.
5 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Getting this too,
0.144.1on Linux.in my experience with codex CLI on WSL Linux, it drops out of codex back to command line. I just lost of ton of work as a result. Why can't open ai give us a decent CLI editor?
Additional current Linux/tmux reproduction, with a likely regression/source-level cause.
Environment
0.146.0(standalonex86_64-unknown-linux-musl)TERM=tmux-256color,TERM_PROGRAM=tmuxcodex doctor --summary: 17 ok, 0 warn, 0 failSymptom
After suspending the interactive TUI with Ctrl-Z and returning to the shell, ordinary command output can render as a staircase because each LF starts at the previous output column instead of column zero:
That byte/display pattern is characteristic of output post-processing/newline translation being left disabled (
OPOST/ONLCR).stty sanerecovers the terminal.Relevant source
The previously closed #26564 contains a traced Linux root cause and a tested one-line fix: the TUI runs on a spawned
codex-mainthread, but the suspend path uses process-group-directedkill(0, SIGTSTP). Signal delivery can race onto another thread, allowing the TUI thread to reapply raw terminal modes before the job is actually stopped. The reported fix changes that call to thread-directedraise(SIGTSTP)and checks its return value:https://github.com/kamou/codex/commit/e09ac2f76004ae061d9c99bfce6f87e7072f5dcc
However, both the
rust-v0.146.0tag and currentmainstill containkill(0, SIGTSTP)incodex-rs/tui/src/tui/job_control.rs:This looks like the #26564 fix was never incorporated, or the problematic implementation was restored later. Could the suspend path use
libc::raise(SIGTSTP)as in the validated patch and add a PTY/job-control regression test that asserts canonical mode, echo,OPOST, andONLCRare restored before the shell regains control?Additional reproduction on Codex CLI 0.147.0 (
aarch64-unknown-linux-musl):Ctrl+Zfollowed byfgcorrupts the resumed TUI.TERM=xterm-ghosttyandTERM=xterm-256color.cursor_position=trueandkeyboard_enhancement_supported=Some(true).terminal cursor position unavailable after resume, followed byrestored terminal state after resume event="tui_suspend_resumed"; notui_suspend_failedevent is recorded.Diagnostic feedback was uploaded as thread
01a015a9-1ece-7720-8f66-0da92d448c91.