openai / openai/codex

Codex Desktop leaves high-CPU grep and Python child processes after an interrupted task on macOS

Open
#41,009 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app bug performance tool-calls
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

Summary

A Codex Desktop task that performed broad local CSV searches was interrupted, but its shell child processes were not cleaned up. Four grep processes and one Python process remained running after the task was interrupted, each consuming approximately one CPU core.

Environment

  • macOS on Apple Silicon
  • Codex Desktop
  • Large local CSV archive

Related Codex task

  • Task: Assess zinc coulombic register
  • Task reference: 01a040b8-9e96-7dc3-9882-b51155163f99
  • Task state: interrupted

What happened

The task launched several long-running searches and a Python CSV-analysis script. After the Codex task was interrupted, the descendant processes continued running in the background.

Observed remaining workload:

  • Four recursive grep searches across large CSV and project directories
  • One Python process loading and profiling a large collection of CSV files
  • Each active process used approximately 80–95% CPU
  • The processes continued for several minutes until manually terminated

Expected behavior

When a Codex task is interrupted, completed, cancelled, or its parent process exits, all shell descendants started for that task should be terminated as a process group after a short graceful shutdown period.

Actual behavior

The owning Codex task ended, but its descendant grep and Python processes remained active and continued their scans.

Impact

  • High sustained CPU use
  • Fan activity and reduced system responsiveness
  • Orphaned work can accumulate across interrupted tasks
  • The user must inspect Activity Monitor and manually terminate the processes

Suggested fix

Launch each shell command in a tracked process group or job. On task completion, cancellation, interruption, crash, or app shutdown:

  1. Send graceful termination to the complete child process group.
  2. Wait briefly for cleanup.
  3. Force-terminate any remaining descendants.
  4. Surface a visible warning if cleanup fails.

Related reports

This appears related to existing reports of Codex child-process cleanup failures and high-CPU orphaned processes, especially #37770 and #21994.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing an interrupted task with broad searches, then read the process-spawning and task-cancellation paths for how child processes are tracked. Done means descendants receive graceful and forced cleanup on interruption or parent exit, with a visible warning when cleanup fails.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, python, rust, shell
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.