codex - 💡(How to fix) Fix Windows desktop shell resolves user PATH rg.exe before Codex-bundled rg.exe

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…

Root Cause

Codex should prefer its own bundled tool binaries for tools it relies on, especially short names like rg, rather than resolving arbitrary executables from the user's PATH first.

This is both a reliability issue and a security hardening issue. If a user has another rg.exe earlier on PATH, intentionally or accidentally, Codex may execute that instead of the expected bundled ripgrep. A malicious or broken executable named rg.exe could cause unexpected side effects.

The user should be able to install ripgrep, or any other program named rg.exe on their computer without worrying about it breaking Codex or producing undesired side effects.

Fix Action

Workaround

Using the bundled binary directly works:

C:\Users\jim\AppData\Local\OpenAI\Codex\bin\rg.exe --files

RAW_BUFFERClick to expand / collapse

What version of the Codex App are you using

Codex desktop app on Windows. Version: 26.506.31421

What subscription do you have?

  • Plus

What platform is your computer?

Windows 11 / Windows 10.0.26100 x64 / PowerShell 7.6.1

What issue are you seeing?

Codex shell commands resolve rg from the user PATH before using the Codex-bundled ripgrep binary. This is both an annoyance in that ripgrep fails, but if rg.exe had resolved to an unexpected program then it could be a potential destructive or security issue.

In my Codex session, Get-Command rg resolved to:

C:\Users\jim\AppData\Local\Microsoft\WinGet\Links\rg.exe

A command using rg --files failed in the Codex shell with:

No application is associated with the specified file for this operation

However, the Codex-bundled ripgrep binary works:

C:\Users\jim\AppData\Local\OpenAI\Codex\bin\rg.exe --version

returns:

ripgrep 15.1.0

Why this matters

Codex should prefer its own bundled tool binaries for tools it relies on, especially short names like rg, rather than resolving arbitrary executables from the user's PATH first.

This is both a reliability issue and a security hardening issue. If a user has another rg.exe earlier on PATH, intentionally or accidentally, Codex may execute that instead of the expected bundled ripgrep. A malicious or broken executable named rg.exe could cause unexpected side effects.

The user should be able to install ripgrep, or any other program named rg.exe on their computer without worrying about it breaking Codex or producing undesired side effects.

What steps can reproduce the bug?

  1. On Windows, install Codex desktop.
  2. Ensure another rg.exe is available earlier on PATH, such as the WinGet Links shim:
  • install with winget install -e --id BurntSushi.ripgrep.MSVC
  • places the following on the path
  • C:\Users\<user>\AppData\Local\Microsoft\WinGet\Links\rg.exe
  • Better yet, add another program called rg.exe to your path.
  1. Start a Codex desktop session.
  2. Run: Get-Command rg
  3. Run: rg --files
  4. Or anything that triggers a call to rg.exe

Workaround

Using the bundled binary directly works:

C:\Users\jim\AppData\Local\OpenAI\Codex\bin\rg.exe --files

What is the expected behavior?

For bundled operational dependencies, Codex should either invoke absolute paths or prepend its managed tool directory ahead of user-controlled PATH entries in agent shell sessions.

Additional information

Realistically it should never assume a program is trustable just based on the name. Obviously there are some valid dependencies, but adopting a external dependency requires consideration.

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

codex - 💡(How to fix) Fix Windows desktop shell resolves user PATH rg.exe before Codex-bundled rg.exe