execpolicy check does not mirror runtime PowerShell wrapper unwrapping

Open 💬 2 comments Opened May 23, 2026 by Alien-AV
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

codex execpolicy check appears not to use the same PowerShell-wrapper normalization as the runtime approval path on Windows.

Observed behavior:

  • Runtime approval is expected to unwrap top-level PowerShell commands such as pwsh.exe -Command "gh issue view ..." and evaluate rules against the inner command, following the behavior added in PR #20336.
  • codex execpolicy check, however, appears to match the raw command tokens directly.
  • A rule such as prefix_rule(pattern=["gh", "issue"], decision="allow") reports allow for direct gh issue ....
  • The same rule does not match when checking a wrapped command shaped like C:\Program Files\PowerShell\7\pwsh.exe -Command "gh issue view ...".
  • This makes execpolicy check unreliable as a way to validate whether a user rule will suppress runtime approval prompts on Windows.

The source seems to explain the difference: runtime approval goes through core/src/exec_policy.rs and commands_for_exec_policy(), while execpolicy check appears to call policy matching directly over the provided command tokens.

Expected: codex execpolicy check should either use the same command normalization path as runtime approval, or the docs/help should clearly say it only validates raw policy matching and does not model runtime shell-wrapper normalization.

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 3 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #24198

Powered by Codex Action

Alien-AV · 3 months ago

Not a duplicate of #24198, separate issue.