You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows Codex Desktop approval rules match "powershell.exe -Command" instead of inner command #19715
appIssues related to the Codex desktop appbugSomething isn't workingsandboxIssues related to permissions or sandboxingwindows-osIssues related to Codex on Windows systems
On Windows Codex Desktop, agent tool commands are executed through PowerShell even when the integrated terminal shell is set to Git Bash. Persisted approval prefix rules therefore match the outer PowerShell invocation instead of the user-meaningful inner command, making it impractical or unsafe to blanket-approve common commands such as git add and git commit -m.
Environment
Product: Codex Desktop app
OS: Windows 11
Shell setting: Integrated terminal shell set to Git Bash
Observed after full Codex app restart
Reproduction
In Codex Desktop on Windows, set Settings -> General -> Integrated terminal shell to Git Bash.
Restart Codex Desktop.
Open a new chat in a repo.
Ask Codex to run a git add or git commit command.
It will ask to blanket accept all commands starting with powershell.
Expected
It should already be running in a shell
I should be able to dictate that shell
the commands running should be "git add" not "powershell.exe -Command "git add ...""
It is not a duplicate, but it is related.
If you fixed #19629 or allow a terminal to be set, so that commands can just be the commands themselves and not prefixed with a shell, then this issue goes away.
But if you only allow another shell via fixing #19629 and continue to force the shell to also launch with each command, then this will not be fixed.
But runtime shell execution can still ask for approval for commands covered by those rules, including:
npm test
npm run build
node --test --version
git config --list
When I select the persistent approval option from the runtime prompt, Codex writes the rule using the PowerShell wrapper. For example, after approving npm test, the persisted line in default.rules is:
One extra detail that may help make the bug clearer: when I select the persistent approval option from the runtime prompt, Codex writes the rule using the PowerShell wrapper, not the inner command.
For example, after approving npm test, the persisted line in default.rules is:
I've just run into this on 0.149.1: I'm using the skill with an executable wrapper, this wrapper is saved into the default.rules, but when actually calling it, Codex for some reason asks for permission on pwsh.exe -c "path/to/wrapper.exe args", which obviously isn't allowed.
appIssues related to the Codex desktop appbugSomething isn't workingsandboxIssues related to permissions or sandboxingwindows-osIssues related to Codex on Windows systems
Activity
github-actions commentedon Apr 26, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
JDoucette commentedon Apr 28, 2026
It is not a duplicate, but it is related.
If you fixed #19629 or allow a terminal to be set, so that commands can just be the commands themselves and not prefixed with a shell, then this issue goes away.
But if you only allow another shell via fixing #19629 and continue to force the shell to also launch with each command, then this will not be fixed.
little-wheat commentedon Apr 28, 2026
This issue also exists in the Cli. The actual command being run is pwsh, which causes the Rules to not match.
ufthygygh commentedon May 2, 2026
I think this is the same issue as #20713, with a slightly different reproduction.
Additional evidence from my environment:
Rules such as these validate successfully with
codex execpolicy check:But runtime shell execution can still ask for approval for commands covered by those rules, including:
When I select the persistent approval option from the runtime prompt, Codex writes the rule using the PowerShell wrapper. For example, after approving
npm test, the persisted line indefault.rulesis:So
codex execpolicy checkreports the inner-command rule as allowed, but the runtime approval path persists the outer PowerShell command instead.I closed #20713 as a duplicate of this issue.
ufthygygh commentedon May 2, 2026
One extra detail that may help make the bug clearer: when I select the persistent approval option from the runtime prompt, Codex writes the rule using the PowerShell wrapper, not the inner command.
For example, after approving
npm test, the persisted line indefault.rulesis:So the persisted rule is tied to
C:\Program Files\PowerShell\7\pwsh.exe -NoProfile -Command ...instead of the documented inner-command form:kraybit commentedon May 4, 2026
Seems this was fixed in PR #20336
Seems
0.129.0-alpha.2contains the fix.Co-Authored-By: GPT-5: )Cerber-Ursi commentedon Aug 25, 2026
I've just run into this on 0.149.1: I'm using the skill with an executable wrapper, this wrapper is saved into the
default.rules, but when actually calling it, Codex for some reason asks for permission onpwsh.exe -c "path/to/wrapper.exe args", which obviously isn't allowed.gakera commentedon Sep 29, 2026
This still occurs on Windows with these installed versions:
0.158.0-alpha.2.126.917.62051, engine0.155.0-alpha.16.3Existing rule:
The agent submits this directly, with the working directory supplied separately:
However, approval is requested for the generated wrapper, effectively:
Selecting
cmd.exeproduces the same problem:“Allow similar commands” saves the wrapper and entire command string, including the spec path. Changing arguments triggers another prompt.
Both installed versions postdate #20336. Is this a regression or a remaining limitation in wrapper normalization?