Windows branch shell.rs frequently and incorrectly handles pwsh, causing command execution failures.

Resolved 💬 6 comments Opened Sep 11, 2025 by zheli1119 Closed Jan 24, 2026

What version of Codex is running?

0.34.0

Which model were you using?

GPT-5-high

What platform is your computer?

Microsoft Windows 10 10.0.19045 x64-based PC

What steps can reproduce the bug?

  1. Run a command containing quotes or Windows paths on a Windows environment.
  1. The program incorrectly triggers Unix commands or fails due to escaping issues.

What is the expected behavior?

  • Prioritize pwsh in the Windows branch.
  • If pwsh fails, fallback should be Windows PowerShell, not bash.
  • Optionally perform a self-check at program startup:
  • If Unix tools are required, inform the user clearly to install them instead of silently failing.
  • Avoid repeated failures (currently a single execution may fail 5–6 times), as this makes logs noisy and user interaction confusing.
  • Use ScriptBlock execution for pwsh commands to ensure proper escaping.

What do you see instead?

<img width="727" height="439" alt="Image" src="https://github.com/user-attachments/assets/c1b1d7ae-e47a-48c8-b1c4-c861f1a6ae05" />

<img width="973" height="102" alt="Image" src="https://github.com/user-attachments/assets/b9219a4f-7a5f-4874-b21b-59273074c5aa" />

<img width="1085" height="174" alt="Image" src="https://github.com/user-attachments/assets/fb54877a-1ed9-484c-bd68-9c7a3b3915d2" />

<img width="1051" height="266" alt="Image" src="https://github.com/user-attachments/assets/b2de9762-0510-415b-8e21-95e39a15d982" />

Additional information

I previously submitted a PR (#3253
) that attempted to improve this behavior. While the implementation might not have been perfect, in practice it significantly reduced command execution errors and ensured that pwsh was consistently prioritized.

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗