codex - 💡(How to fix) Fix VS Code extension spawns runaway R child processes (R --file=- / R -e) that pin CPU on macOS

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

PID    PPID   %CPU   ELAPSED   COMMAND
26097  62427  98.5   09:00     /Library/Frameworks/R.framework/Resources/bin/exec/R --no-echo --no-restore --file=-
26373  62427  98.8   06:55     /Library/Frameworks/R.framework/Resources/bin/exec/R --no-echo --no-restore --file=-
26374  62427  98.8   06:55     /Library/Frameworks/R.framework/Resources/bin/exec/R --no-echo --no-restore --file=-
26462  62427  98.8   06:22     /Library/Frameworks/R.framework/Resources/bin/exec/R --no-echo --no-restore --file=-
and later:

text

PID    PPID   %CPU   ELAPSED   COMMAND
28399  62427  99.3   51:18     /Library/Frameworks/R.framework/Resources/bin/exec/R --no-echo --no-restore --file=-
28400  62427  99.2   51:18     /Library/Frameworks/R.framework/Resources/bin/exec/R --no-echo --no-restore --file=-
Parent process:

text

/Users/usr/.vscode/extensions/openai.chatgpt-26.415.20818-darwin-arm64/bin/macos-aarch64/codex app-server --analytics-default-enabled
So these are not user-started R sessions. They are child processes of the Codex extension.

In the same VS Code session, the Codex extension logs also showed repeated internal errors and cleanup/state issues, including:

local-environments is not supported in the extension
dropping turn-scoped item for unknown turn id
failed shell snapshot deletion
failed MCP process-group cleanup
The practical problem is that Codex leaves behind hot R subprocesses that continue running indefinitely, causing high CPU usage, fan noise, and requiring manual cleanup.

### What steps can reproduce the bug?

I do not yet have a 100% minimal reproduction, but this happens repeatedly in an R-heavy project when using the Codex VS Code extension normally.

Observed pattern:

1. Open an R project in VS Code that uses `renv`.
2. Use the OpenAI/Codex extension in that workspace.
3. Ask Codex to inspect or reason about R scripts, package usage, or data-import functions.
4. After some interaction, check Activity Monitor or inspect processes from the terminal.

In my case, Codex appears to launch helper R subprocesses for inspection. Earlier examples included commands of the form:
RAW_BUFFERClick to expand / collapse

What version of the IDE extension are you using?

openai.chatgpt-26.415.20818-darwin-arm64

What subscription do you have?

Plus

Which IDE are you using?

VS Code 1.116.0

What platform is your computer?

Darwin 25.3.0 arm64 arm

What issue are you seeing?

The VS Code OpenAI/Codex extension intermittently spawns runaway R subprocesses on macOS that pin one or more CPU cores for long periods.

I observed two subprocess patterns:

  1. R --no-echo --no-restore -e ...
  2. R --no-echo --no-restore --file=-

The second pattern is the more concerning one. Those R --file=- processes are direct children of the Codex app server and appear to be fed multiline R scripts over stdin. They can continue running at ~95-99% CPU for tens of minutes until manually killed.

Representative examples I observed:

PID    PPID   %CPU   ELAPSED   COMMAND
26097  62427  98.5   09:00     /Library/Frameworks/R.framework/Resources/bin/exec/R --no-echo --no-restore --file=-
26373  62427  98.8   06:55     /Library/Frameworks/R.framework/Resources/bin/exec/R --no-echo --no-restore --file=-
26374  62427  98.8   06:55     /Library/Frameworks/R.framework/Resources/bin/exec/R --no-echo --no-restore --file=-
26462  62427  98.8   06:22     /Library/Frameworks/R.framework/Resources/bin/exec/R --no-echo --no-restore --file=-
and later:

text

PID    PPID   %CPU   ELAPSED   COMMAND
28399  62427  99.3   51:18     /Library/Frameworks/R.framework/Resources/bin/exec/R --no-echo --no-restore --file=-
28400  62427  99.2   51:18     /Library/Frameworks/R.framework/Resources/bin/exec/R --no-echo --no-restore --file=-
Parent process:

text

/Users/usr/.vscode/extensions/openai.chatgpt-26.415.20818-darwin-arm64/bin/macos-aarch64/codex app-server --analytics-default-enabled
So these are not user-started R sessions. They are child processes of the Codex extension.

In the same VS Code session, the Codex extension logs also showed repeated internal errors and cleanup/state issues, including:

local-environments is not supported in the extension
dropping turn-scoped item for unknown turn id
failed shell snapshot deletion
failed MCP process-group cleanup
The practical problem is that Codex leaves behind hot R subprocesses that continue running indefinitely, causing high CPU usage, fan noise, and requiring manual cleanup.

### What steps can reproduce the bug?

I do not yet have a 100% minimal reproduction, but this happens repeatedly in an R-heavy project when using the Codex VS Code extension normally.

Observed pattern:

1. Open an R project in VS Code that uses `renv`.
2. Use the OpenAI/Codex extension in that workspace.
3. Ask Codex to inspect or reason about R scripts, package usage, or data-import functions.
4. After some interaction, check Activity Monitor or inspect processes from the terminal.

In my case, Codex appears to launch helper R subprocesses for inspection. Earlier examples included commands of the form:

```text
R -e "library(zellkonverter); print(args(readH5AD))"
R -e "tf <- utils:::.getHelpFile(help('readH5AD', package='zellkonverter')); cat(tools::Rd2txt(tf))"
R -e "ns <- loadNamespace('zellkonverter'); f <- get('readH5AD', envir=ns); print(formals(f))"
The worse cases are:

text

R --no-echo --no-restore --file=-
These are direct children of the Codex app server and can stay at ~95-99% CPU for long periods.

A useful diagnostic command has been:

bash

ps -axo pid,ppid,%cpu,%mem,etime,time,stat,command | sort -k3 -nr | head -n 20
In every bad case I checked, the hot R jobs were children of the Codex extension app server.

### What is the expected behavior?

Codex may inspect the R environment or packages, but any helper `R` subprocesses should finish quickly or be terminated promptly.

Expected behavior:
- read-only R inspection should complete quickly
- failed internal requests should not leave long-running child processes behind
- Codex should clean up any subprocesses associated with failed/dropped turns
- normal Codex usage in an R-heavy project should not leave background R jobs pegging CPU indefinitely


### Additional information

This report was drafted with help from Codex itself, based on local process inspection and local VS Code/Codex log review.

I am happy to help investigate further and provide more diagnostics, process listings, or logs if useful. However, I have limited understanding of the extension internals, so some of the interpretation here is based on observable process behavior and log patterns rather than deep knowledge of the Codex implementation.

I also locally mitigated part of an earlier issue by making project startup lighter for obvious Codex/VS Code `R -e` probes, but the more serious `R --file=-` cases still appear to be extension-driven.

extent analysis

TL;DR

The Codex VS Code extension may be leaving behind long-running R subprocesses, causing high CPU usage, which can be mitigated by investigating and potentially fixing the extension's subprocess management.

Guidance

  • Investigate the Codex extension's logs and process listings to understand why the R --no-echo --no-restore --file=- subprocesses are being spawned and not terminated properly.
  • Use the diagnostic command ps -axo pid,ppid,%cpu,%mem,etime,time,stat,command | sort -k3 -nr | head -n 20 to identify and monitor the problematic subprocesses.
  • Consider reaching out to the Codex extension developers or maintainers to report the issue and request assistance with fixing the subprocess management.
  • As a temporary workaround, manually killing the long-running R subprocesses may help alleviate the CPU usage issue.

Example

No code snippet is provided as the issue is related to the Codex extension's internal behavior and subprocess management.

Notes

The root cause of the issue is unclear, but it appears to be related to the Codex extension's handling of R subprocesses. Further investigation and debugging are needed to determine the exact cause and develop a permanent fix.

Recommendation

Apply workaround: Manually killing the long-running R subprocesses may help alleviate the CPU usage issue, but a permanent fix will require investigation and updates to the Codex extension's subprocess management.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING