Repository navigation
Preserve inline PowerShell commands in Codex rollouts - #306
Loop (Loop3373) wants to merge 2 commits into
Conversation
|
@microsoft-github-policy-service agree |
|
Thanks for this! It works for powershell.exe -Command ... and pwsh.exe -Command .... A few common forms still come out garbled, though: plain pwsh or powershell (no .exe, e.g. on macOS or Linux) Could you cover these and add a test for each? Then this is good to merge. |
|
Thanks for the feedback! The follow-up commit supports extensionless All 58 trace and envfacts tests passed on Windows, including the existing Bash and PowerShell Thanks for reviewing! |
Summary
Codex CLI on Windows records shell commands as an argv array, for example
[pwsh.exe, -NoProfile, -Command, "python -m pytest -q"]. Rollout conversioncurrently joins these arguments with POSIX shell quoting. The resulting
PowerShell invocation hides the inner command from the envfacts classifier,
so it misses repeated command repairs in Windows sessions.
Extract the final script argument for
pwsh.exeandpowershell.exewhen itfollows
-Commandand the preceding arguments are limited to the standalonestartup switches
-NoLogo,-NoProfile, and-NonInteractive. Match theexecutable basename and flags case-insensitively and preserve the script
verbatim. Keep the existing conversion for Bash and other input forms,
including a PowerShell
-Fileinvocation whose script accepts a parameternamed
-Command.Validation
existing
/bin/bash -lccommand. Both exercise rollout conversion, exitstatus, and the envfacts candidate created when
pytest -qfails andpython -m pytest -qsucceeds.matching,
-Filewith and without a script parameter named-Command,empty argv, and string input.
mainat1bfeccdcecf48333b22762ad1dd9e36c6dc065dfon November 22, 2026 (JST). The patch passed
git apply --check --whitespace=errorand applied unchanged in a freshcheckout.
git diff --checkpassed after application.tests/test_trace.pyandtests/test_envfacts.pypassed after applying the patch to that checkout.AI assistance and review scope
OpenAI Codex was used to prepare the patch, regression tests, and this PR
description. The final diff was checked for unrelated changes and local
identifiers. Validation covered patch application to the upstream commit
listed above and the two offline test modules on Windows. The Windows
Codex rollout observed during the investigation informed the test fixtures.
The final regression tests replay synthetic records and do not invoke
Codex CLI or a model. Bash compatibility was tested with a synthetic
/bin/bash -lcrecord on Windows.Related pull requests
request counting in
trace/codex.py. This patch changes the separatecommand conversion path.
PowerShell tool calls from Claude Code. This patch handles argv recorded
by Codex CLI.
pixi runin Micro-skills command classification. This patch makes theinline PowerShell script available to that classification stage.