Background processes started with nohup are killed at turn end in codex-cli 0.97.0–0.98.0; setsid survives
What version of Codex CLI is running?
codex-cli 0.98.0
What subscription do you have?
ChatGPT Plus
Which model were you using?
gpt-5.2-codex
What platform is your computer?
Microsoft Windows NT 10.0.19045.0 x64
What terminal emulator and version are you using (if applicable)?
WSL
What issue are you seeing?
In codex-cli versions 0.97.0 and 0.98.0, background processes started using "nohup ... &" do not survive the end of a command turn.
These processes are terminated before completion, even though:
- nohup is used
- stdout and stderr are redirected
- no interactive TTY is required
The same command started with "setsid ... &" runs to completion reliably.
This behavior indicates that Codex CLI performs aggressive cleanup of processes spawned from the exec/PTY context at turn end. Since nohup does not create a new session, the process remains attached and is killed.
Steps to reproduce and logs are provided below.
What steps can reproduce the bug?
Run via Codex CLI:
bash -lc '
nohup case
nohup bash -c "echo START; sleep 10; echo END" > /tmp/nohup.out 2>&1 &
setsid case
setsid bash -c "echo START; sleep 10; echo END" > /tmp/setsid.out 2>&1 < /dev/null &
'
Then check:
cat /tmp/nohup.out
cat /tmp/setsid.out
What is the expected behavior?
The nohup utility should allow background processes to continue running after the Codex CLI command turn ends, consistent with standard Unix behavior. If Codex CLI does not support this, the limitation should be explicitly documented and an officially supported mechanism for running detached background jobs should be provided.
Additional information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗