External Publication
Visit Post

Possible orphaned Python subprocess leak in Codex Desktop on macOS (Apple Silicon)

OpenAI Developer Community May 12, 2026
Source

Environment

  • Platform: macOS Apple Silicon
  • App: Codex Desktop
  • Python installed via Homebrew
  • Observed date: May 2026

Observed behavior

After using Codex Desktop, I found a Python process continuing to run indefinitely even after the originating terminal/session appeared closed.

The process:

  • remained alive with PPID = 1
  • consumed ~99% CPU continuously
  • persisted independently from the original shell session
  • appeared to be reading from stdin rather than executing a normal .py file

Evidence

Process list:

bash ps -Ao pid,ppid,pcpu,pmem,comm | sort -k3 -nr | head -20

Relevant output:

text 65600 1 98.8 0.0 …/Python

Command inspection:

bash ps -wwp 65600 -o command=

Output:

text /opt/homebrew/…/Python -

The trailing - suggests Python was launched using stdin piping/heredoc style execution rather than a standalone script.

Open files:

bash lsof -p 65600 | head -50

Relevant findings:

text cwd: /Users/…/Education/Physics/Nanoscience/Assignments stdin: /private/tmp/zshfhR7eo

This suggests:

  • stdin-fed shell execution
  • temporary zsh-backed input
  • orphaned subprocess after parent shell exited

Why this looks Codex-related

I found several existing reports describing similar process lifecycle issues:

  • orphaned child processes
  • subprocesses surviving terminal closure
  • PPID reassignment to 1
  • lingering high CPU usage
  • pipe deadlocks / process-group cleanup failures

Examples:

  • #14962
  • #7846
  • #7932
  • #13928

Suspected root cause

This appears consistent with:

  • subprocess group cleanup failure
  • missing signal propagation
  • or child processes not being reaped correctly after Codex task execution

Potentially related to:

  • stdin-fed execution wrappers
  • temporary shell pipes
  • sandbox or process-group handling

Impact

Effects observed:

  • sustained high CPU usage
  • orphaned processes surviving session exit
  • difficult-to-identify background execution
  • potential battery/thermal drain on laptops

Recommendation

Possible mitigations:

  • ensure subprocesses are attached to process groups
  • propagate termination signals to descendants
  • explicit child reaping on session/task completion
  • cleanup of stdin-fed helper interpreters

Would be useful if Codex exposed:

  • task → subprocess mapping
  • cleanup logs
  • process lifecycle diagnostics
  • automatic orphan detection

Discussion in the ATmosphere

Loading comments...