Skip to content

Windows: command rejected as “blocked by policy”, but /approve finds no denial #54476

Closed as not planned

Description

@paulotars0

What version of Codex CLI is running?

codex-cli 0.163.0

What subscription do you have?

PRO

Which model were you using?

GPT-6.1-SOL

What platform is your computer?

windows x64

What terminal emulator and version are you using (if applicable)?

Windows PowerShell 5.1.26100.9711 (Desktop edition)

Codex doctor report

"schemaVersion": 1,
  "generatedAt": "1792118277s since unix epoch",
  "overallStatus": "warning",
  "codexVersion": "0.163.0",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is running",
      "details": {
        "app-server version": "0.163.0",
        "control socket": "C:\\Users\\Paulo Batista\\.codex\\app-server-control\\app-server-control.sock",
        "daemon state dir": "C:\\Users\\Paulo Batista\\.codex\\app-server-daemon",
        "dedicated pid file": "C:\\Users\\Paulo Batista\\.codex\\app-server-daemon\\daemon.pid (file)",
        "dedicated update-loop pid file": "C:\\Users\\Paulo Batista\\.codex\\app-server-daemon\\daemon-updater.pid (file)",
        "mode": "ephemeral",
        "pid file": "C:\\Users\\Paulo Batista\\.codex\\app-server-daemon\\app-server.pid (missing)",
        "settings": "C:\\Users\\Paulo Batista\\.codex\\app-server-daemon\\settings.json (missing)",
        "status": "running",
        "update-loop pid file": "C:\\Users\\Paulo Batista\\.codex\\app-server-daemon\\app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 2
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "auth is configured",
      "details": {
        "auth file": "C:\\Users\\Paulo Batista\\.codex\\auth.json",
        "auth storage mode": "File",
        "stored API key": "false",
        "stored ChatGPT tokens": "true",
        "stored agent identity": "false",
        "stored auth mode": "chatgpt"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "C:\\Users\\Paulo Batista\\.codex",
        "active thread overrides": "not inspected",
        "config.toml": "C:\\Users\\Paulo Batista\\.codex\\config.toml",
        "config.toml parse": "ok",
        "configuration load ms": "5",
        "configuration scope": "invocation config, including cloud-managed policy",
        "configured TUI mode": "fullscreen",
        "cwd": "C:\\Users\\Paulo Batista",
        "enabled feature flags": "<redacted>",
        "feature flag overrides": "none",
        "feature flags enabled": "60",
        "log dir": "C:\\Users\\Paulo Batista\\.codex\\log",
        "mcp servers": "0",
        "model": "<default>",
        "model provider": "openai",
        "sqlite home": "C:\\Users\\Paulo Batista\\.codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "git.environment": {
      "id": "git.environment",
      "category": "git",
      "status": "ok",
      "summary": "git executable found; execution not verified",
      "details": {
        "PATH git #1": "C:\\Program Files\\Git\\cmd\\git.exe",
        "PATH git entries": "1",
        "git execution": "not inspected (PATH helpers are not executed)",
        "repo detected": "false",
        "selected git": "C:\\Program Files\\Git\\cmd\\git.exe"
      },
      "remediation": null,
      "durationMs": 4
    },
    "git.worktree.dev_drive": {
      "id": "git.worktree.dev_drive",
      "category": "git",
      "status": "ok",
      "summary": "no Git worktree is active",
      "details": {},
      "remediation": null,
      "durationMs": 0
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "C:\\Users\\Paulo Batista\\AppData\\Local\\Programs\\OpenAI\\Codex\\bin\\codex.exe",
        "PATH codex #2": "C:\\Users\\Paulo Batista\\AppData\\Roaming\\npm\\codex.cmd",
        "PATH codex entries": "2",
        "current executable": "C:\\Users\\Paulo Batista\\AppData\\Local\\Programs\\OpenAI\\Codex\\bin\\codex.exe",
        "install context": "standalone (windows, package C:\\Users\\Paulo Batista\\.codex\\packages\\standalone\\releases\\0.163.0-x86_64-pc-windows-msvc, bin C:\\Users\\Paulo Batista\\.codex\\packages\\standalone\\releases\\0.163.0-x86_64-pc-windows-msvc\\bin, resources C:\\Users\\Paulo Batista\\.codex\\packages\\standalone\\releases\\0.163.0-x86_64-pc-windows-msvc\\codex-resources, path C:\\Users\\Paulo Batista\\.codex\\packages\\standalone\\releases\\0.163.0-x86_64-pc-windows-msvc\\codex-path)",
        "managed by Vite+": "false",
        "managed by bun": "false",
        "managed by npm": "false",
        "managed by pnpm": "false",
        "managed package root": "not set"
      },
      "remediation": null,
      "durationMs": 4
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "no MCP servers configured",
      "details": {},
      "remediation": null,
      "durationMs": 0
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "managed proxy": "not configured",
        "proxy env vars": "none",
        "respect system proxy": "disabled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP",
      "details": {
        "ChatGPT inference URL": "https://chatgpt.com/backend-api/<redacted> reachable (HTTP 405)",
        "reachability mode": "ChatGPT auth"
      },
      "remediation": null,
      "durationMs": 193
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "ok",
      "summary": "Responses WebSocket handshake succeeded",
      "details": {
        "DNS": "2 IPv4, 2 IPv6, first IPv4",
        "auth mode": "chatgpt",
        "connect timeout": "15000 ms",
        "endpoint": "wss://chatgpt.com/backend-api/<redacted>",
        "handshake result": "HTTP 101 Switching Protocols",
        "model provider": "openai",
        "provider name": "OpenAI",
        "proxy env vars": "none",
        "reasoning header": "false",
        "server model present": "false",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "remediation": null,
      "durationMs": 667
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running standalone on windows-x86_64",
      "details": {
        "commit": "unknown",
        "current executable": "C:\\Users\\Paulo Batista\\AppData\\Local\\Programs\\OpenAI\\Codex\\bin\\codex.exe",
        "install method": "standalone (windows, package C:\\Users\\Paulo Batista\\.codex\\packages\\standalone\\releases\\0.163.0-x86_64-pc-windows-msvc, bin C:\\Users\\Paulo Batista\\.codex\\packages\\standalone\\releases\\0.163.0-x86_64-pc-windows-msvc\\bin, resources C:\\Users\\Paulo Batista\\.codex\\packages\\standalone\\releases\\0.163.0-x86_64-pc-windows-msvc\\codex-resources, path C:\\Users\\Paulo Batista\\.codex\\packages\\standalone\\releases\\0.163.0-x86_64-pc-windows-msvc\\codex-path)",
        "platform": "windows-x86_64",
        "version": "0.163.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search command found (bundled); execution not verified",
      "details": {
        "search command": "C:\\Users\\Paulo Batista\\.codex\\packages\\standalone\\releases\\0.163.0-x86_64-pc-windows-msvc\\codex-path\\rg.exe",
        "search command readiness": "file exists",
        "search provider": "bundled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "sandbox.filesystem_paths": {
      "id": "sandbox.filesystem_paths",
      "category": "sandbox",
      "status": "ok",
      "summary": "no explicit filesystem paths to probe",
      "details": {},
      "remediation": null,
      "durationMs": 0
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "OnRequest",
        "codex-linux-sandbox helper": "none",
        "denied-read glob rules": "0",
        "denied-read restrictions": "false",
        "denied-read rules": "0",
        "filesystem sandbox": "restricted",
        "glob scan max depth": "unbounded",
        "managed filesystem source": "none",
        "network sandbox": "restricted",
        "sandbox backend": "elevated",
        "sandbox provisioning": "complete"
      },
      "remediation": null,
      "durationMs": 2
    },
    "security.endpoint": {
      "id": "security.endpoint",
      "category": "security",
      "status": "warning",
      "summary": "endpoint protection detected; Codex exclusions are unverified",
      "details": {
        "Codex exclusions": "not verified",
        "endpoint products": "Microsoft Defender",
        "exclusion targets": "signed Codex app; codex.exe; codex-windows-sandbox-setup.exe; codex-command-runner.exe; codex-code-mode-host.exe"
      },
      "issues": [
        {
          "severity": "warning",
          "cause": "Microsoft Defender can interfere with Codex. Verify Codex exclusions.",
          "measured": "not verified",
          "expected": "Codex application and helper exclusions",
          "remedy": "Microsoft Defender: Add a certificate or executable-path exclusion for Codex and its helpers. If Attack Surface Reduction blocks Codex, add a rule exclusion. If Controlled Folder Access blocks Codex, allow the app.",
          "fields": [
            "Codex exclusions"
          ]
        }
      ],
      "remediation": "ask your security administrator to verify Codex exclusions and required helper allowances",
      "durationMs": 41
    },
    "state.paths": {
      "id": "state.paths",
      "category": "state",
      "status": "ok",
      "summary": "state paths and databases are inspectable",
      "details": {
        "CODEX_HOME": "C:\\Users\\Paulo Batista\\.codex (dir)",
        "active rollout files": "9 files, 76274398 total bytes, 8474933 average bytes",
        "archived rollout files": "0 files, 0 total bytes, 0 average bytes",
        "goals DB": "C:\\Users\\Paulo Batista\\.codex\\goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "C:\\Users\\Paulo Batista\\.codex\\logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "C:\\Users\\Paulo Batista\\.codex\\log (missing)",
        "memories DB": "C:\\Users\\Paulo Batista\\.codex\\memories_1.sqlite (file)",
        "memories DB integrity": "ok",
        "memories v2 DB": "C:\\Users\\Paulo Batista\\.codex\\memories_v2_1.sqlite (missing)",
        "memories v2 DB integrity": "skipped (missing)",
        "queue DB": "C:\\Users\\Paulo Batista\\.codex\\queue_1.sqlite (file)",
        "queue DB integrity": "ok",
        "sqlite home": "C:\\Users\\Paulo Batista\\.codex (dir)",
        "standalone release cache": "5 entries in C:\\Users\\Paulo Batista\\.codex\\packages\\standalone\\releases",
        "state DB": "C:\\Users\\Paulo Batista\\.codex\\state_5.sqlite (file)",
        "state DB integrity": "ok",
        "thread history DB": "C:\\Users\\Paulo Batista\\.codex\\thread_history_1.sqlite (file)",
        "thread history DB integrity": "ok"
      },
      "remediation": null,
      "durationMs": 110
    },
    "state.rollout_db_parity": {
      "id": "state.rollout_db_parity",
      "category": "threads",
      "status": "ok",
      "summary": "rollout files and state DB thread inventory agree",
      "details": {
        "default model provider": "openai",
        "rollout DB active files": "9",
        "rollout DB active rows": "9",
        "rollout DB archive mismatches": "0",
        "rollout DB archived files": "0",
        "rollout DB archived rows": "0",
        "rollout DB duplicate DB paths": "0",
        "rollout DB duplicate rollout thread ids": "0",
        "rollout DB malformed file names": "0",
        "rollout DB missing active rows": "0",
        "rollout DB missing archived rows": "0",
        "rollout DB model providers": "openai=9",
        "rollout DB rows": "9",
        "rollout DB scan cap reached": "false",
        "rollout DB scan errors": "0",
        "rollout DB sources": "vscode=6, cli=2, subagent:thread_spawn=1",
        "rollout DB stale rows": "0"
      },
      "remediation": null,
      "durationMs": 18
    },
    "system.disk": {
      "id": "system.disk",
      "category": "disk",
      "status": "ok",
      "summary": "sufficient free disk space (37.0 GiB)",
      "details": {
        "CODEX_HOME available": "37.0 GiB",
        "failure threshold": "1.0 GiB",
        "warning threshold": "5.0 GiB",
        "worktree available": "37.0 GiB"
      },
      "remediation": null,
      "durationMs": 0
    },
    "system.environment": {
      "id": "system.environment",
      "category": "system",
      "status": "ok",
      "summary": "OS language pt-BR",
      "details": {
        "EDITOR": "not set",
        "VISUAL": "not set",
        "os": "Windows 10.0.26200 (Windows 11 Professional) [64-bit]",
        "os language": "pt-BR",
        "os type": "Windows",
        "os version": "10.0.26200"
      },
      "remediation": null,
      "durationMs": 0
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "WT_SESSION": "present",
        "color output": "enabled",
        "console input code page": "850",
        "console output code page": "850",
        "stderr console mode": "0x00000007 (VT processing: true)",
        "stderr is terminal": "true",
        "stdin is terminal": "true",
        "stdout console mode": "0x00000007 (VT processing: true)",
        "stdout is terminal": "true",
        "terminal": "Windows Terminal",
        "terminal size": "156x41"
      },
      "remediation": null,
      "durationMs": 0
    },
    "terminal.title": {
      "id": "terminal.title",
      "category": "title",
      "status": "ok",
      "summary": "terminal title default",
      "details": {
        "terminal title activity": "true",
        "terminal title items": "activity, project-name",
        "terminal title project source": "cwd",
        "terminal title project value": "Paulo Batista",
        "terminal title source": "default"
      },
      "remediation": null,
      "durationMs": 0
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.163.0",
        "check for update on startup": "true",
        "last checked at": "2026-10-15T21:41:36.465757400Z",
        "latest version": "0.163.0",
        "latest version status": "current version is not older",
        "update action": "standalone installer",
        "version cache": "C:\\Users\\Paulo Batista\\.codex\\version.json"
      },
      "remediation": null,
      "durationMs": 760
    }
  }
}

What issue are you seeing?

On Windows, Codex rejected an authorized Android app testing command before starting PowerShell. The error only says “blocked by policy” and provides no explanation.

When I entered /approve in the same thread, Codex responded:
“No recent auto-review denials in this thread”.

Context:

  • Windows PowerShell 5.1.26100.9711, Desktop edition.
  • Two Android test devices are connected by USB.
  • The command explicitly targets only the authorized test phone.
  • The target is our own debug/homologation application.
  • No installation or operational delivery action was executed by the rejected command.

Task requested:
Continue testing our Android homologation app on the designated test phone, preserving the other connected device and existing records.

Rejected command, with the device serial redacted:

adb -s <TEST_DEVICE_SERIAL> shell dumpsys activity activities | Select-String 'mResumedActivity'; Invoke-RestMethod -Uri http://127.0.0.1:19225/json -TimeoutSec 5 | Select-Object type,url; adb -s <TEST_DEVICE_SERIAL> shell am start -n br.com.safetylog.motorista.homolog/.MainActivity

Error:

Script failed
Wall time: 0.0 seconds
Output:
Script error:
exec_command failed: CreateProcess {
message: "Rejected("\"C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -Command \"adb -s <TEST_DEVICE_SERIAL> shell dumpsys activity activities | Select-String 'mResumedActivity'; Invoke-RestMethod -Uri http://127.0.0.1:19225/json -TimeoutSec 5 | Select-Object type,url; adb -s <TEST_DEVICE_SERIAL> shell am start -n br.com.safetylog.motorista.homolog/.MainActivity\"` rejected: blocked by policy")"
}

The call was made through functions.exec wrapping tools.exec_command.

Expected behavior:
Execute the authorized command if permitted, or provide an actionable explanation identifying the policy that denied it and the supported review procedure.

Actual behavior:
Execution was rejected before process creation, with no detailed reason or review ID. /approve could not find a recent auto-review denial.

No attempt was made to bypass the rejection.

Uploaded feedback thread ID:
01a13f4c-cbb2-7da1-adf0-7d833fd5018b

What steps can reproduce the bug?

Uploaded thread: 01a13f4c-cbb2-7da1-adf0-7d833fd5018b

What is the expected behavior?

Codex should execute the explicitly authorized command if permitted by the effective policy.

If the command is denied, it should provide an actionable explanation and identify the supported review procedure.

If the denial is eligible for /approve, that command should find it. If it is not eligible, Codex should clearly explain that distinction.

Additional information

Uploaded feedback thread:
01a13f4c-cbb2-7da1-adf0-7d833fd5018b

Environment:

  • Windows PowerShell 5.1.26100.9711, Desktop edition.
  • Two Android devices connected by USB; the command explicitly targeted only the designated test phone.
  • Our own debug/homologation Android app.
  • CDP endpoint on localhost:19225.

The rejection occurred before PowerShell process creation, with a reported duration of 0.0 seconds. No detailed policy reason or review ID was available.

A prior independent technical review found no blocker in the APK or test instruments; this does not establish why execution policy rejected the command.

The rejected command was not retried, split, or run through another executor. No attempt was made to bypass the policy.

Activity

  1. added
    bug
    on Oct 16, 2026
  2. added
    CLI
    windows-os
    sandbox
    tool-calls
    on Oct 16, 2026
  3. paulotars0 commented on Oct 16, 2026

    @paulotars0
    Author

    The affected session records client version 0.162.1.
    The local background server and current standalone executable are 0.163.0.
    No causal link between this version difference and the rejection was found.

    Both rejected calls were located:

    • 2026-10-16 02:20:32 UTC:
      call_4b6f8c299b3447c69b1daa48d4707cbb
    • 2026-10-16 02:46:04 UTC:
      call_e70b4bae7b344021ab852d083648f48c

    Both returned “rejected: blocked by policy”, without a policy reason
    or review identifier. /status reports Full Access, while /approve reports
    “No recent auto-review denials in this thread”.

    The second call was a later, explicitly requested retry.
    No bypass was attempted.

    Can you identify which mechanism rejected these calls and the supported
    procedure for reviewing the denial?

    Feedback thread: 01a13f4c-cbb2-7da1-adf0-7d833fd5018b

  4. etraut-openai commented on Oct 16, 2026

    @etraut-openai
    Contributor

    (response from codex)

    Thanks for the report. We checked the uploaded logs. At the first rejected call, the session recorded:

    • approvals_reviewer: user
    • approval_policy: never
    • sandbox_policy: danger-full-access

    Auto-approve was therefore not enabled. With Full Access, flagged commands can be rejected immediately because the session is configured never to request approval. That rejection didn’t go through auto-review, so /approve had no denial to show.

    To enable auto-approval, run /permissions and select Approve for me. You can confirm the setting with /status, then retry the task. This uses workspace permissions with automatic review; it does not retroactively change earlier denials.

    The uploaded logs end before the second reported call, so we can’t confirm its settings. The “blocked by policy” message could also be clearer about why /approve doesn’t apply.

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

    CLIbugsandboxtool-callswindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions