Skip to content

Background processes started with nohup are killed at turn end in codex-cli 0.97.0–0.98.0; setsid survives #10860

Open

Description

@zdorovie-java-developer

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

Activity

  1. added
    CLIIssues related to the Codex CLI
    windows-osIssues related to Codex on Windows systems
    sandboxIssues related to permissions or sandboxing
    on Feb 6, 2026
  2. zdorovie-java-developer commented on Feb 6, 2026

    @zdorovie-java-developer
    Author

    This also affects live monitoring loops (tail/watch) being moved to background terminal

  3. richardrl commented on Feb 24, 2026

    @richardrl

    this makes agentic hands-free coding very difficult!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingsandboxIssues related to permissions or sandboxingwindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions