-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Description
What version of the VS Code extension are you using?
v.0.4.46
What subscription do you have?
Plus
Which IDE are you using?
VS Code
What platform is your computer?
Windows 11 25H2 ARM64
What issue are you seeing?
Codex takes an unnecessarily long and fragile execution path when trying to run Python on Windows. Even though Python is installed system-wide and works normally, Codex chooses a chain like:
Git Bash → PowerShell → Python → (sometimes WindowsApps/python.exe)
…instead of simply using Windows PowerShell directly.
This results in:
- failed retries,
- “Fixing quoting style” auto-mutations,
- Codex introspection texts like
I’m working through complex quoting and encoding issues to insert a UTF-8 text block containing backticks and Unicode arrows into a file via a Python script called from PowerShell. I'm exploring using single-quoted here-strings in PowerShell to avoid backtick escapes, switching Unicode arrows to ASCII "->" for compatibility, and writing the script to a file before execution to simplify the command. This careful juggling aims to avoid byte boundary errors and quoting headaches while preserving the insert’s formatting.
- unnecessary escaping gymnastics and here-string workarounds,
- and, critically, a Windows error popup:
python.exe - Application Error
The application was unable to start correctly (0xc0000142). Click OK to close the application.
This popup appears almost every time Python is involved in a Codex-triggered operation.
It does not happen when running the same Python commands manually in PowerShell — only when Codex triggers them through the Git Bash → pwsh → python pipeline.
The behavior is impressive in how much effort it puts into multi-shell quoting, but also inefficient and fragile. No instruction in AGENTS.md explains why Codex must run through Git Bash first when a native PowerShell environment is fully available and stable.
Attached screenshots show the error dialogs and the shell output Codex produces.
What steps can reproduce the bug?
- Install Python on Windows (system-wide).
- (Optional) Install Git for Windows — not confirmed, but may influence shell selection.
- In VSCode with Codex enabled, activate Sandbox mode.
- Open a chat with Codex and ask it to run a Python script or apply an auto-fix that generates Python code.
What is the expected behavior?
- PowerShell must be the primary shell on Windows when WSL is not enabled.
- Git Bash should only be used if the user has explicitly requested it.
- Python execution should follow the native Windows execution path, without invoking Git Bash unless explicitly requested.
- No python.exe 0xC0000142 errors thrown.
Additional information
Python 3.14.0
PowerShell 7.5.4
git 2.52.0.windows.1
This happens even when my default VSCode terminal profile is set to PowerShell — Codex still launches the command through Git Bash.