Code-mode kernel respawned 5x for the same session-id; orphaned kernels are never reaped and grow to GBs (Windows desktop)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- node.js, rust
- Domain
- desktop, devtools, operating-systems
Research direction
Start by tracing the codex-command-runner lifecycle and the kernel.js launches recorded in .codex.sandbox\sandbox..log, focusing on session-id reuse and parent-child cleanup on Windows. Reproduce the repeated launches if possible and verify that a prior kernel is terminated before replacement and that kernels do not remain after their runner exits.
Written by the indexing model from the issue text.
Description
What version of the Codex App are you using?
26.803.5235.0 (Microsoft Store package OpenAI.Codex_26.803.5235.0_x64)
What subscription do you have?
Pro
What platform is your computer?
Windows 11, 16 GB RAM
What issue are you seeing?
The code-mode kernel (cua_node node.exe running kernel.js) was respawned 5 times for the same --session-id and same --working-dir within 19 minutes. Four of those kernels were left orphaned (their parent codex-command-runner had exited), and none of them were reaped — they kept running and kept allocating memory for the next 7 hours until I killed them manually.
This is distinct from #34302 (that one is taskkill.exe/conhost.exe orphans and the reporter explicitly notes it is not memory pressure). Here the orphans are the code-mode node kernels, and they do cause severe memory pressure.
Timeline (from .codex\.sandbox\sandbox.<date>.log) — all five lines are the same session id 5bdaf690… and the same working dir:
01:29:49 START node.exe … kernel.js --session-id 5bdaf690… --working-dir …\1-worker-2-api-pdf-cloudflare
01:31:05 START node.exe … kernel.js --session-id 5bdaf690… (same session)
01:44:25 START node.exe … kernel.js --session-id 5bdaf690… (same session)
01:46:28 START node.exe … kernel.js --session-id 5bdaf690… (same session)
01:48:47 START node.exe … kernel.js --session-id 5bdaf690… (same session)
State ~7 hours later (08:46), before I intervened:
| kernel PID | spawned | parent codex-command-runner |
RSS at spawn-time check | RSS when killed |
|---|---|---|---|---|
| 13136 | 01:29:49 | dead (orphan) | 97 MB | 1815 MB |
| 36892 | 01:31:05 | dead (orphan) | 117 MB | 151 MB |
| 39072 | 01:44:25 | dead (orphan) | 117 MB | 464 MB |
| 29308 | 01:46:28 | dead (orphan) | 94 MB | 2036 MB |
| 5660 | 01:48:47 | alive | 3914 MB | 1850 MB, 107% CPU, 2460s CPU accumulated |
The last one was still actively burning >1 core (107%) seven hours after it was spawned, with no user interaction in that window.
System impact:
- Free physical memory down to 1.3 GB / 15.6 GB (8%)
- Pagefile in use 12.3 GB (peak 21.5 GB)
Memory Compressionat 837 MB- The Codex UI itself became unresponsive (window
Responding=True, backendapp-serveridle at 0.5%, but the UI would not react) — I initially misdiagnosed this as a Codex UI hang before finding the memory exhaustion - Killing the 4 orphan pairs + the runaway kernel recovered ~5.6 GB and the UI became usable again
Orphan detection used: for each codex-command-runner, look up ParentProcessId; treat as orphaned if the parent no longer exists, or if the parent's CreationDate is later than the child's (PID reuse guard). Four of five matched.
What I could not determine: the log gives no error explaining why the first kernel needed to be respawned at all. The only recurring warning in that window is the (apparently harmless, always-present) hide users: failed to hide current user profile dir (C:\Users\Default): SetFileAttributesW failed … 5. So the trigger for the respawn loop is unknown to me.
Suggested handling:
- Before spawning a kernel for a
session-idthat already has one, terminate/reap the previous kernel for that same session-id. - When a
codex-command-runnerexits, kill its child kernel rather than leaving it running. - Consider a watchdog for kernels that exceed some CPU-time/wall-clock budget with no attached parent.
Happy to provide the full sandbox log excerpt if useful.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.5k
- Avg merge
- 1m
- Merged PRs (30d)
- 1k
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openai/codex
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug CLI windows-os
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
macOS sandbox blocks hw.optional.arm64 sysctl, causing Flutter to misdetect Apple Silicon as x64 Openbug CLI sandbox
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug CLI TUI
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
CLI config enhancement skills
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
A-linter
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
oxc-project/oxc#26863 ·