WSL: codex-core safe-command test fails when Windows PowerShell is on PATH
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- powershell, rust
- Domain
- cli, operating-systems, testing-qa
Research direction
Start with core/src/tools/handlers/shell_tests.rs and the named commands_generated_by_shell_command_handler_can_be_matched_by_is_known_safe_command test. Read try_find_powershell_executable_blocking(), try_find_pwsh_executable_blocking(), and the non-Windows is_known_safe_command path, then reproduce with the provided just test command under WSL2. Done means the upstream test suite passes in WSL without requiring non-Windows safety classification to accept discovered Windows PowerShell executables.
Written by the indexing model from the issue text.
Description
What version of Codex CLI is running?
codex-cli 0.145.0; also reproduced from openai/codex main at 44d76c6a6dd04fa2efc302b906ac8774267a1272.
What subscription do you have?
ChatGPT Pro.
Which model were you using?
Not applicable; this is a repository test failure.
What platform is your computer?
Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 x86_64
What terminal emulator and version are you using?
Windows Terminal with WSL2.
Codex doctor report
Not applicable; the failure reproduces in the Rust test suite on a clean upstream checkout.
What issue are you seeing?
just test -p codex-core commands_generated_by_shell_command_handler_can_be_matched_by_is_known_safe_command fails on WSL when Windows PowerShell executables are inherited through PATH:
thread 'tools::handlers::shell::tests::commands_generated_by_shell_command_handler_can_be_matched_by_is_known_safe_command' panicked at core/src/tools/handlers/shell_tests.rs:68:5:
assertion failed: is_known_safe_command(&shell.derive_exec_args(command, true))
The test conditionally exercises every PowerShell executable returned by try_find_powershell_executable_blocking() and try_find_pwsh_executable_blocking(). On WSL those functions find the Windows executables under /mnt/c, but the non-Windows implementation of is_known_safe_command intentionally does not accept PowerShell commands. The resulting expectations are contradictory on WSL.
What steps can reproduce the bug?
-
Use WSL2 with Windows interop paths present in
PATH. -
Confirm both commands resolve:
command -v powershell.exe command -v pwsh.exeIn this environment they resolve to:
/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe /mnt/c/Program Files/PowerShell/7/pwsh.exe -
Check out upstream commit
44d76c6a6dd04fa2efc302b906ac8774267a1272. -
Run:
just test -p codex-core commands_generated_by_shell_command_handler_can_be_matched_by_is_known_safe_command
The test fails on both nextest attempts.
What is the expected behavior?
The upstream test suite should pass in a normal WSL environment. The test should not require non-Windows safety classification to accept Windows PowerShell executables merely because WSL can discover them.
Additional information
No fork-owned code is needed to reproduce this. The same exact test fails from detached upstream main at the commit above.
- 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 ·