Files
codex/codex-rs/tui/tests/suite
Eric Traut 9ba0ceac1a Wait for foreground terminal ownership before resuming the TUI (#63520)
## 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
2026-11-24 03:27:15 +00:00
..