mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
## Why After Ctrl-Z suspends Codex, `bg` continues the process while the shell still owns the terminal. Restoring the TUI at that point can interfere with the shell's terminal settings. A later `fg` can return the terminal without sending another `SIGCONT`. ## What changed Wait until the Codex process group owns the foreground before restoring terminal modes, reading input, or redrawing. Preserve the TUI when standard input has no controlling terminal at suspension time, and exit if the controlling terminal disappears while waiting. ## Testing Add PTY regression tests that check for unchanged shell terminal modes and no TUI output during background continuation, then exercise foreground handoff without a second `SIGCONT` and terminal detachment on Linux. GitOrigin-RevId: 4ee601a35c84a3e0aee984246b40bc3119c923f0