Skip to content

Windows: PowerShell SHELL causes codex.ps1 policy rejection to be reported as missing CLI #832

Open

Description

@jworks-hq

Summary

On Windows, Codex plugin 1.0.6 reports that Codex is missing even though the installed CLI works independently. The availability check inherits a PowerShell SHELL, resolves the npm codex.ps1 shim, and encounters PSSecurityException / UnauthorizedAccess because script execution is disabled.

Observed environment

  • Plugin: codex@openai-codex 1.0.6
  • Codex CLI: 0.165.0, npm installation
  • Windows; SHELL points to Windows PowerShell
  • npm provides both codex.ps1 and codex.cmd
  • The exact execution-policy scope/value was not inspected. No claim is made about whether this is a local or centrally managed policy.

Reproduction / observed path

In an environment with the above existing conditions:

  1. Invoke the installed plugin's getCodexAvailability(cwd).
  2. It calls binaryAvailable("codex", ["--version"], { cwd }).
  3. scripts/lib/process.mjs selects process.env.SHELL for Windows runCommand.
  4. PowerShell selects codex.ps1 and rejects it. The sanitized error is: codex.ps1 cannot be loaded because running scripts is disabled, PSSecurityException, UnauthorizedAccess.
  5. A task attempt reports Codex CLI is not installed or is missing required runtime support before dispatching a turn.

The availability function was checked directly and returned available: false with that policy error. In contrast, an earlier explicit codex.cmd --version invocation returned codex-cli 0.165.0; a standalone CLI smoke test also succeeded. This does not establish that plugin task execution succeeds.

Relevant source: https://github.com/openai/codex-plugin-cc/blob/main/plugins/codex/scripts/lib/process.mjs

Expected behavior

Distinguish a shell/policy launch rejection from a missing CLI and provide a documented, policy-compatible Windows launch mechanism. Do not require users to weaken execution policy or sandbox/approval controls.

No execution-policy changes, shell substitution, or installed-plugin patches were used to bypass this rejection.

Related reports checked

#287 and #337 concern spawn codex ENOENT / shim resolution without a shell. This report concerns a shell-based availability check selecting the PowerShell shim and being rejected by policy, rather than ENOENT.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions