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

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

Thanks for reporting.

I see you already checked the current Codex issues and found several related ones :+1:

You are welcome to discuss the Codex issue here, however the official place to report and track it is the OpenAI Codex issues tab.

Great investigation, @kperry. I wanted to add that I’m experiencing the exact same CPU spikes on Windows.

Whenever Codex executes a task, my CPU usage jumps to nearly 100%. It feels like the application isn’t just running the code, but is struggling with the same subprocess management overhead you described. The “orphaned” nature of these processes seems to be a cross-platform issue rather than being limited to macOS.

It’s definitely hitting the performance hard. Thanks for bringing visibility to this!

Thanks for reporting this and for sharing the details around the possible orphaned Python subprocess behavior in Codex Desktop on Apple Silicon.

We’re sending your findings to our team for review and logging. We’ll keep the case pending in case you have any additional details or observations to share.

We appreciate you taking the time to document this for the team.