Skip to content

Windows CLI 0.153.4: read-only Get-Content rejected by policy without rule attribution #43881

Open

Description

@Patdolitse

Windows CLI 0.153.4: read-only Get-Content denied before execution with no policy rule attribution

Environment

  • Native Windows, Codex CLI 0.153.4, gpt-6-astra / low.
  • CLI launched with an isolated CODEX_HOME, existing Git worktree as cwd, exec --ignore-user-config --sandbox read-only -c approval_policy="never" --json.
  • No sandbox/approval/hook bypass flags. Authentication succeeded before this invocation.
  • The intended task was read-only source review, not implementation.

Observed failure

The first shell tool request was a single command:

Get-Content -LiteralPath '<control-repository>/AGENTS.md'

The absolute project path is redacted here. The requested file was in a sibling repository, outside the current worktree. The effective turn-context permission snapshot recorded root filesystem read access, not just current-worktree read access.

The tool wrapped this in the installed bundled runtime's pwsh.exe -Command ... and returned:

exec_command failed: CreateProcess { message: "Rejected(... rejected: blocked by policy)" }

The original tool request did not request escalation. The agent stopped after this one failed read. CLI subsequently exited 0 because it delivered a TOOL_BLOCKED report; no source review was completed. We did not retry the command with another shell/tool or expand sandbox permissions.

Available diagnostic evidence

  • Invocation date: 2026-09-09 Asia/Shanghai; tool call recorded at 2026-09-08T18:05:46.757Z, result at 18:05:49.824Z.
  • Actual session turn context: approval_policy=never, sandbox_policy.type=read-only.
  • Actual permission profile: type=managed; filesystem type=restricted with special root entry access=read; network restricted. The term managed is the recorded profile type, not evidence of enterprise administrator policy provenance.
  • The complete original tool call and rejection are preserved locally. No full session, source code, account data, credentials, environment values or private reasoning is included in this report.
  • No *.rules files were found in this isolated home's rules directory or the checked project/ancestor .codex/rules locations. This does not prove that no other active policy source exists.
  • This isolated home's .sandbox/sandbox.log is absent.
  • Installed codex execpolicy check --help is available, but it requires explicit rule files. We have not invented an empty/allow rule file to obtain a misleading allow result.

Expected behavior / requested diagnosis

Please identify which layer rejected this exact read-only invocation and how to obtain a policy decision with rule/source attribution:

  1. Was rejection from command classification, an effective rule, Windows sandbox initialization, or another enforcement layer? Does this error guarantee no OS child was created, or is additional evidence needed?
  2. How can an operator safely inspect the actual applicable policy sources for this invocation without dumping secrets or changing the policy?
  3. What supported repair/validation procedure restores the intended read-only capability while keeping the sandbox boundary and approval policy? We are not asking to use full access, alternate-shell retries or a broad allow rule.

There is a related Windows review report at openai/codex-plugin-cc#57 . It uses a different invocation path/version; it does not establish this report's root cause. We have not adopted its full-access workaround.

The observed symptom is one blocked Get-Content call. We do not claim that all Windows read-only commands fail, that the file contents caused the rejection, or that a third-party code-scanning plugin was involved.

Activity

  1. added
    bug
    CLI
    windows-os
    exec
    sandbox
    tool-calls
    on Sep 8, 2026
  2. github-actions commented on Sep 8, 2026

    @github-actions
    Contributor
  3. Patdolitse commented on Sep 8, 2026

    @Patdolitse
    Author

    Follow-up with a version-pinned explanation and a successful bounded read:

    • The launcher used --ignore-user-config --sandbox read-only -c approval_policy="never", without a Windows backend selector.
    • In rust-v0.153.4, core/src/config/mod.rs:3161-3165 maps an absent effective backend to Disabled. core/src/exec_policy.rs:746-766 rejects managed restricted filesystem commands when the Windows backend is disabled and approval is Never.
    • Adding the documented -c windows.sandbox="elevated", while retaining read-only, never and ignore-user-config, allowed the original Get-Content command to return exit 0. No allow rules, unelevated/full-access fallback, or command substitution was used.
    • This strongly supports the same configuration omission described in 0.152.0 Windows: --ignore-user-config leaves exec with no usable sandbox — every command "rejected: blocked by policy" (regression from 0.147.0) #42172. We did not capture the old effective backend directly, so this is not a definitive internal trace of the old decision.
    • A later attempt by the agent to set Console.OutputEncoding was separately refused by PowerShell ConstrainedLanguage. Reads still executed. We preserve that restriction and do not classify it as the original blanket command-policy refusal.

    A startup diagnostic naming the missing Windows sandbox backend would have prevented misdiagnosing this as a file-specific read permission failure. The earlier exit-0/TOOL_BLOCKED reporting concern also remains useful for automation.

  4. rza255 commented on Sep 28, 2026

    @rza255

    I reproduced this on native Windows with codex-cli 0.153.4 and was able to narrow it down with controlled A/B/D probes.

    Hermetic baseline:

    • --ignore-user-config
    • --ignore-rules
    • --ephemeral
    • --strict-config
    • --sandbox read-only
    • shell_environment_policy.inherit="none"

    A) No explicit Windows sandbox selector:
    Result: CreateProcess ... rejected: blocked by policy; child shell process was not created.

    The normal user config contained:

    [windows]
    sandbox = "elevated"

    so --ignore-user-config also removed that selector.

    B) Same invocation + explicit:

    windows.sandbox="elevated"
    

    The policy rejection disappeared and PowerShell was created, but pwsh then failed before the requested command ran:

    InitialSessionState
      -> SecuritySupport.GetSaferPolicy
      -> Win32Exception (126): The specified module could not be found
    

    Native cmd.exe and where.exe worked inside the same elevated read-only sandbox, and the exact same bundled pwsh worked outside the sandbox.

    The sanitized sandbox environment showed SystemRoot was absent.

    D) Same hermetic invocation as B, adding only:

    shell_environment_policy.set={SystemRoot='C:\Windows'}
    

    Result:

    • Codex exit 0
    • PowerShell startup succeeds
    • no error 126
    • exactly one read-only command executes
    • scratch file is read successfully

    So on this machine the minimum working combination was:

    windows.sandbox="elevated"
    SystemRoot=C:\Windows
    

    No Full Access, workspace-write, approval bypass, or user-config loading was required.

    This is one-machine evidence, not a claim of a universal fix, but the A/B/D difference was controlled and reproducible. It also explains how the apparent symptoms can stack: fixing the missing sandbox selector exposes a second missing-SystemRoot failure underneath it.

  5. Mad-Max8063 commented on Oct 1, 2026

    @Mad-Max8063

    Adding a deterministic, no-model reproduction on Codex CLI 0.159.3, native Windows 11, with an in-workspace read and :workspace.

    This appears equivalent to the symptom reported here, so I am adding evidence rather than opening a duplicate. The follow-up about the omitted Windows sandbox backend is relevant: our runner also uses --ignore-user-config and supplies no windows.sandbox override. We have not tested that proposed correction on 0.159.3, so the shared root cause remains unconfirmed. Please use this reproduction to confirm the diagnosis and the supported sandbox-preserving resolution; a specific startup/denial diagnostic would help avoid repeated failed runs.

    Summary

    On Windows 11, Codex CLI 0.159.3 rejects an in-workspace PowerShell read through functions.exec -> tools.exec_command before starting the command:

    exec_command failed: CreateProcess ... rejected: blocked by policy
    

    This blocks a local file-handoff workflow before its first read or test. We reproduced the same rejection with dummy files and a deterministic loopback Responses stub, with no model, OAuth credentials or API key. Please triage the tool execution policy path and provide a sandbox-preserving fix or a documented explanation of the intended restriction.

    Environment and effective settings

    • Windows 11, version 10.0.26200, AMD64; diagnostic host Python 3.14.3.
    • Codex CLI 0.159.3, isolated official npm Windows x64 package.
    • SHA-256 of observed codex.exe: 57e1bdab42c0559a74558ca17e85d5c7893caa5f1e582f67e9ddd6d97fa705a7.
    • Native execution, launched as a child process from the Codex desktop task. A separate ordinary-terminal reproduction has not been tested.
    • Explicit default_permissions=":workspace"; trace shows workspace-write with read access and workspace/temp writes, network restricted.
    • Runtime trace: approval_policy: Never, approvals_reviewer: User.
    • Trace: loaded exec policies policy_paths=[], loaded rules from 0 files, empty rule table.
    • Config-only app-server inspection of the isolated live-run home reported no managed requirements, empty user/system config layers and no project config layer. Approval was unset there; never is the non-interactive exec default measured separately.
    • --ephemeral --ignore-user-config --skip-git-repo-check; model flag gpt-6-astra, effort high; project_doc_max_bytes=0; memory use/generation=false.

    Observed command

    The synthetic call uses the CLI's advertised functions.exec custom tool and calls tools.exec_command with:

    {"cmd":"Get-Content -LiteralPath PROJECT_MEMORY.md, iso_dates.py, test_iso_dates.py, recovery.json, handoff.md, evidence/session_a_tests.txt","workdir":"<fixture workspace>","yield_time_ms":1000,"max_output_tokens":1500}

    The resolved shell was the installed native pwsh.exe. No escalation parameter was requested. All five existing files contain only PMP_LOCAL_TOOL_PROBE. recovery.json intentionally does not exist, matching the original workflow; it should produce a normal file-not-found result if the shell starts, not a pre-execution policy rejection.

    Reproduction without inference

    1. Use a Windows installation of CLI 0.159.3 and Python 3.10+ (observed with 3.14.3).
    2. Save the reproduce.py source included below. Use a new output directory and an absolute path to the installed CLI:
    python -B .\reproduce.py --codex 'C:\path\to\codex.exe' --output 'C:\path\to\new-probe-output'
    1. The script creates dummy fixtures and an isolated CODEX_HOME. It binds only to 127.0.0.1, sets a credential-free local provider, supplies one fixed tool call, captures its result, and returns a fixed final message. No live model is called. The CLI is bounded by a 60-second timeout; there is no automatic tool retry.
    2. Inspect result-call.json, especially tool_outputs and stderr.

    The executed source reproducer was verified on the reporting machine. The portable adaptation below changes only binary/output path selection to command-line arguments and was syntax-checked, not rerun. Observed evidence is from the original run. An installation exposing different tool schemas may stop before emitting a call; that is not a reproduction of the rejection.

    Expected vs actual

    Expected: start a read-only command inside the allowed workspace and return its stdout/normal file error; if intentionally denied, expose the specific policy reason.

    Actual: CreateProcess ... blocked by policy before command execution. One synthetic tool call; two local HTTP requests; no Authorization header or auth.json. Files unchanged. The CLI eventually exits 0 because the stub supplies a terminal assistant message; this is not evidence that the tool succeeded.

    Control and limitations

    • A separate direct codex sandbox --permission-profile :workspace --include-managed-config ... pwsh.exe ... Get-Content preflight read a local fixture successfully. That is a different execution path, not an identical control for all command arguments.
    • The rejection also occurred in a real authenticated model session before this diagnostic. Its private transcript and credentials are excluded.
    • The deterministic reproduction uses a local provider and fresh home/workspace, so it does not establish that every launch environment or hosted provider is affected.
    • No automatic reviewer was active in the reproduction. Do not attribute the denial to auto-review solely based on wording from an earlier model answer.
    • We have not proven that approval=never is itself the defect or located the rejecting internal condition.
    • There were three protocol-preparation initializations with zero tool calls, followed by one actual synthetic tool call. No model inference occurred in any of them.

    Requested investigation

    Please identify which internal policy rejects this local read, why its decision differs from the direct sandbox path, and whether this is a CLI/runtime integration defect or an intended restriction. Please provide a fixed version or supported bounded configuration, and improve the denial reason if the behavior is intentional. We have not disabled the sandbox, broadened permission rules, or retried the live workflow again.

    Included below: portable reproducer and sanitized observed evidence. No account data, credentials, private project files or full conversation transcript are included.

    reproduce.py — portable adaptation, syntax-checked only
    """One deterministic local exec_command probe. No model or credentials used."""
    import hashlib
    import http.server
    import json
    import os
    from pathlib import Path
    import re
    import subprocess
    import threading
    
    import argparse
    parser = argparse.ArgumentParser(description="Local deterministic Codex tool-route probe; no model inference")
    parser.add_argument("--codex", type=Path, required=True, help="Full path to codex.exe")
    parser.add_argument("--output", type=Path, required=True, help="New, nonexistent output directory")
    options = parser.parse_args()
    BINARY = options.codex.resolve()
    if not BINARY.is_file():
        raise SystemExit("codex.exe not found")
    ROOT = options.output.resolve()
    ROOT.mkdir(parents=True, exist_ok=False)
    HOME = ROOT / "home"
    WORK = ROOT / "workspace"
    COMMAND = "Get-Content -LiteralPath PROJECT_MEMORY.md, iso_dates.py, test_iso_dates.py, recovery.json, handoff.md, evidence/session_a_tests.txt"
    
    
    def main():
        for prior in ROOT.glob("result*.json"):
            if json.loads(prior.read_text(encoding="utf-8")).get("tool_calls_emitted", 0):
                raise RuntimeError("The single diagnostic call has already been emitted; stop.")
        HOME.mkdir(exist_ok=True)
        WORK.mkdir(exist_ok=True)
        (WORK / "evidence").mkdir(exist_ok=True)
        # Same five file names as B. recovery.json is absent, as it was in B.
        for name in ["PROJECT_MEMORY.md", "iso_dates.py", "test_iso_dates.py", "handoff.md", "evidence/session_a_tests.txt"]:
            (WORK / name).write_text("PMP_LOCAL_TOOL_PROBE\n", encoding="utf-8")
        state = {"requests": [], "tool_calls_emitted": 0, "tool_outputs": [], "permission_fragments": []}
    
        class Handler(http.server.BaseHTTPRequestHandler):
            def log_message(self, *_):
                pass
    
            def emit(self, output):
                self.send_response(200)
                self.send_header("Content-Type", "text/event-stream")
                self.send_header("Connection", "close")
                self.end_headers()
                response = {"id": "resp_local_probe", "object": "response", "status": "completed", "output": output}
                events = [{"type": "response.created", "response": {**response, "status": "in_progress", "output": []}}]
                for i, item in enumerate(output):
                    events += [{"type": "response.output_item.added", "output_index": i, "item": item},
                               {"type": "response.output_item.done", "output_index": i, "item": item}]
                events.append({"type": "response.completed", "response": response})
                for seq, event in enumerate(events):
                    event["sequence_number"] = seq
                    self.wfile.write(("event: " + event["type"] + "\ndata: " + json.dumps(event) + "\n\n").encode())
                self.wfile.flush()
    
            def do_POST(self):
                body = json.loads(self.rfile.read(int(self.headers.get("Content-Length", 0))))
                def shape(x, depth=0):
                    if depth > 5:
                        return type(x).__name__
                    if isinstance(x, dict):
                        return {k: shape(v, depth+1) for k, v in x.items()}
                    if isinstance(x, list):
                        return [shape(v, depth+1) for v in x[:2]]
                    return type(x).__name__
                state["request_shape"] = shape(body)
                def envelope(x):
                    if isinstance(x, dict):
                        if "model" in x and "input" in x:
                            return x
                        for v in x.values():
                            candidate = envelope(v)
                            if candidate is not None:
                                return candidate
                    if isinstance(x, list):
                        for v in x:
                            candidate = envelope(v)
                            if candidate is not None:
                                return candidate
                    return None
                body = envelope(body) or body
                state["requests"].append({"path": self.path, "auth_header_present": "Authorization" in self.headers})
                for item in body.get("input", []):
                    if item.get("type") in ("function_call_output", "custom_tool_call_output"):
                        state["tool_outputs"].append(item)
                if len(state["requests"]) == 1:
                    def visit(x):
                        if isinstance(x, str):
                            state["permission_fragments"].extend(re.findall(r"<permissions instructions>(.*?)</permissions instructions>", x, re.S))
                        elif isinstance(x, list):
                            for v in x:
                                visit(v)
                        elif isinstance(x, dict):
                            for v in x.values():
                                visit(v)
                    visit(body.get("input", []))
                    def find_tool(items, namespace=None):
                        for t in items:
                            if t.get("type") == "namespace":
                                result = find_tool(t.get("tools", []), t.get("name"))
                                if result:
                                    return result
                            if t.get("name") in ("exec_command", "exec"):
                                return t, namespace
                        return None
                    exposed = list(body.get("tools", []))
                    for item in body.get("input", []):
                        exposed.extend(item.get("tools", []))
                    found = find_tool(exposed)
                    state["top_tool_names"] = [t.get("name", t.get("type")) for t in exposed]
                    if found is None:
                        self.send_error(400, "LOCAL_STOP_EXEC_TOOL_NOT_EXPOSED")
                        return
                    schema, namespace = found
                    state["exec_tool_schema"] = schema
                    call = {"type": "function_call", "id": "fc_local_read", "call_id": "call_local_read", "name": "exec_command",
                            "arguments": json.dumps({"cmd": COMMAND, "workdir": str(WORK), "yield_time_ms": 1000, "max_output_tokens": 1500})}
                    if schema.get("name") == "exec":
                        call = {"type": "custom_tool_call", "id": "ctc_local_read", "call_id": "call_local_read", "name": "exec",
                                "input": "text(await tools.exec_command(" + call["arguments"] + "));"}
                    if namespace:
                        call["namespace"] = namespace
                    state["injected_call"] = call
                    state["tool_calls_emitted"] += 1
                    self.emit([call])
                elif len(state["requests"]) == 2:
                    self.emit([{"type": "message", "id": "msg_local_end", "role": "assistant", "status": "completed",
                                "content": [{"type": "output_text", "text": "LOCAL_DIAGNOSTIC_COMPLETE_NO_MODEL", "annotations": []}]}])
                else:
                    self.send_error(400, "LOCAL_STOP_REQUEST_LIMIT")
    
        server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), Handler)
        threading.Thread(target=server.serve_forever, daemon=True).start()
        env = {k: v for k, v in os.environ.items() if k.upper() in {"SYSTEMROOT", "WINDIR", "COMSPEC", "PATH", "PATHEXT", "TEMP", "TMP", "LOCALAPPDATA", "APPDATA", "USERPROFILE"}}
        env.update(CODEX_HOME=str(HOME), PYTHONUTF8="1", PYTHONDONTWRITEBYTECODE="1",
                   RUST_LOG="codex_core::exec_policy=trace,codex_core::tools::orchestrator=trace,codex_core::tools::sandboxing=trace,codex_core::tools::router=debug,codex_core::exec=debug,codex_exec=info")
        provider = '{ name="Local deterministic diagnostic", base_url="http://127.0.0.1:' + str(server.server_port) + '/v1", wire_api="responses", requires_openai_auth=false, request_max_retries=0, stream_max_retries=0 }'
        args = [str(BINARY), "exec", "--ephemeral", "--ignore-user-config", "--skip-git-repo-check", "--json", "-c", 'default_permissions=":workspace"', "-m", "gpt-6-astra", "-c", 'model_reasoning_effort="high"', "-c", "project_doc_max_bytes=0", "-c", "memories.use_memories=false", "-c", "memories.generate_memories=false", "-c", 'model_provider="pmp_local_probe"', "-c", "model_providers.pmp_local_probe=" + provider, "-"]
        try:
            proc = subprocess.run(args, input="Local deterministic tool-route diagnostic; one read only.", cwd=WORK, env=env, capture_output=True, text=True, encoding="utf-8", timeout=60)
            state.update(exit_code=proc.returncode, stdout=proc.stdout, stderr=proc.stderr, timed_out=False)
        except subprocess.TimeoutExpired as exc:
            state.update(exit_code=None, stdout=(exc.stdout or b"").decode() if isinstance(exc.stdout, bytes) else exc.stdout, stderr=(exc.stderr or b"").decode() if isinstance(exc.stderr, bytes) else exc.stderr, timed_out=True)
        finally:
            server.shutdown()
            server.server_close()
        state.update(no_model_inference=True, binary_sha256=hashlib.sha256(BINARY.read_bytes()).hexdigest(), cwd=str(WORK), credential_files_present=(HOME / "auth.json").exists())
        (ROOT / "result-call.json").write_text(json.dumps(state, indent=2), encoding="utf-8")
        print(json.dumps({k: v for k, v in state.items() if k not in {"exec_tool_schema", "permission_fragments", "request_shape"}}, indent=2))
    
    
    if __name__ == "__main__":
        main()
    Sanitized observed evidence — original local reproduction
    {
      "kind": "Sanitized excerpts of observed deterministic local reproduction",
      "observed_local_date": "2026-09-30",
      "platform": {
        "windows": [
          "11",
          "10.0.26200",
          "SP0",
          "Multiprocessor Free"
        ],
        "architecture": "AMD64",
        "python": "3.14.3"
      },
      "cli_version": "0.159.3",
      "binary_sha256": "57e1bdab42c0559a74558ca17e85d5c7893caa5f1e582f67e9ddd6d97fa705a7",
      "model_inference": false,
      "auth_header_present": false,
      "credential_files_present": false,
      "tool_calls_emitted": 1,
      "local_requests": [
        {
          "path": "/v1/responses",
          "auth_header_present": false
        },
        {
          "path": "/v1/responses",
          "auth_header_present": false
        }
      ],
      "tool_call": {
        "type": "custom_tool_call",
        "namespace": "functions",
        "name": "exec",
        "input": "text(await tools.exec_command({\"cmd\": \"Get-Content -LiteralPath PROJECT_MEMORY.md, iso_dates.py, test_iso_dates.py, recovery.json, handoff.md, evidence/session_a_tests.txt\", \"workdir\": \"<LAB>\\\\hermes-local-state\\\\tool-route-probe-01\\\\workspace\", \"yield_time_ms\": 1000, \"max_output_tokens\": 1500}));"
      },
      "tool_outputs": [
        {
          "type": "custom_tool_call_output",
          "id": "ctco_<DIAGNOSTIC_SESSION>",
          "call_id": "call_local_read",
          "output": [
            {
              "type": "input_text",
              "text": "Script failed\nWall time 0.4 seconds\nOutput:\n"
            },
            {
              "type": "input_text",
              "text": "Script error:\nexec_command failed: CreateProcess { message: \"Rejected(\\\"`\\\\\\\"<USER_HOME>\\\\\\\\\\\\\\\\.cache\\\\\\\\\\\\\\\\codex-runtimes\\\\\\\\\\\\\\\\codex-primary-runtime\\\\\\\\\\\\\\\\dependencies\\\\\\\\\\\\\\\\native\\\\\\\\\\\\\\\\powershell\\\\\\\\\\\\\\\\pwsh.exe\\\\\\\" -Command 'Get-Content -LiteralPath PROJECT_MEMORY.md, iso_dates.py, test_iso_dates.py, recovery.json, handoff.md, evidence/session_a_tests.txt'` rejected: blocked by policy\\\")\" }"
            }
          ]
        }
      ],
      "trace": "2026-10-01T02:23:00.285682Z TRACE codex.exec{otel.kind=\"internal\"}: codex_core::exec_policy: loaded exec policies policy_paths=[]\n2026-10-01T02:23:00.285829Z DEBUG codex.exec{otel.kind=\"internal\"}: codex_core::exec_policy: loaded rules from 0 files\n2026-10-01T02:23:00.285836Z TRACE codex.exec{otel.kind=\"internal\"}: codex_core::exec_policy: exec policy rules loaded rules=Policy { rules_by_program: {}, network_rules: [], host_executables_by_name: {} }\n2026-10-01T02:23:00.314487Z TRACE codex_core::exec_policy: loaded exec policies policy_paths=[]\n2026-10-01T02:23:00.314529Z DEBUG codex_core::exec_policy: loaded rules from 0 files\n2026-10-01T02:23:00.314533Z TRACE codex_core::exec_policy: exec policy rules loaded rules=Policy { rules_by_program: {}, network_rules: [], host_executables_by_name: {} }\n2026-10-01T02:23:00.315848Z TRACE load: codex_core::exec_policy: loaded exec policies policy_paths=[]\n2026-10-01T02:23:00.315921Z DEBUG load: codex_core::exec_policy: loaded rules from 0 files\n2026-10-01T02:23:00.315928Z TRACE load: codex_core::exec_policy: exec policy rules loaded rules=Policy { rules_by_program: {}, network_rules: [], host_executables_by_name: {} }\n2026-10-01T02:23:00.380770Z  INFO codex.exec{otel.kind=\"internal\" thread.id=\"<DIAGNOSTIC_SESSION>\"}: codex_exec: Codex initialized with event: SessionConfiguredEvent { session_id: SessionId { uuid: <DIAGNOSTIC_SESSION> }, thread_id: ThreadId { uuid: <DIAGNOSTIC_SESSION> }, forked_from_id: None, parent_thread_id: None, thread_source: Some(User), thread_name: None, model: \"gpt-6-astra\", model_provider_id: \"pmp_local_probe\", service_tier: None, approval_policy: Never, approvals_reviewer: User, permission_profile: Managed { file_system: Restricted { entries: [FileSystemSandboxEntry { path: Special { value: Root }, access: Read, missing_path_behavior: None }, FileSystemSandboxEntry { path: Path { path: PathUri(Url { scheme: \"file\", cannot_be_a_base: false, username: \"\", password: None, host: None, port: None, path: \"/<LAB>/hermes-local-state/tool-route-probe-01/workspace\", query: None, fragment: None }) }, access: Write, missing_path_behavior: None }, FileSystemSandboxEntry { path: Special { value: SlashTmp }, access: Write, missing_path_behavior: None }, FileSystemSandboxEntry { path: Special { value: Tmpdir }, access: Write, missing_path_behavior: None }, FileSystemSandboxEntry { path: Path { path: PathUri(Url { scheme: \"file\", cannot_be_a_base: false, username: \"\", password: None, host: None, port: None, path: \"/<LAB>/hermes-local-state/tool-route-probe-01/workspace/.git\", query: None, fragment: None }) }, access: Read, missing_path_behavior: Some(Skip) }, FileSystemSandboxEntry { path: Path { path: PathUri(Url { scheme: \"file\", cannot_be_a_base: false, username: \"\", password: None, host: None, port: None, path: \"/<LAB>/hermes-local-state/tool-route-probe-01/workspace/.agents\", query: None, fragment: None }) }, access: Read, missing_path_behavior: Some(Skip) }, FileSystemSandboxEntry { path: Path { path: PathUri(Url { scheme: \"file\", cannot_be_a_base: false, username: \"\", password: None, host: None, port: None, path: \"/<LAB>/hermes-local-state/tool-route-probe-01/workspace/.codex\", query: None, fragment: None }) }, access: Read, missing_path_behavior: Some(Skip) }, FileSystemSandboxEntry { path: Path { path: PathUri(Url { scheme: \"file\", cannot_be_a_base: false, username: \"\", password: None, host: None, port: None, path: \"/<LAB>/hermes-local-state/tool-route-probe-01/workspace/.aws\", query: None, fragment: None }) }, access: Read, missing_path_behavior: Some(Skip) }], glob_scan_max_depth: None }, network: Restricted }, active_permission_profile: Some(ActivePermissionProfile { id: \":workspace\", extends: None }), cwd: AbsolutePathBuf(\"<LAB>\\\\hermes-local-state\\\\tool-route-probe-01\\\\workspace\"), reasoning_effort: Some(High), initial_messages: None, network_proxy: None, rollout_path: None }\n2026-10-01T02:23:00.559522Z  INFO codex.exec{otel.kind=\"internal\" thread.id=\"<DIAGNOSTIC_SESSION>\"}: codex_exec: Sent prompt with event ID: <DIAGNOSTIC_SESSION>\n2026-10-01T02:23:02.321201Z ERROR codex_core::tools::router: error=exec_command failed: CreateProcess { message: \"Rejected(\\\"`\\\\\\\"<USER_HOME>\\\\\\\\\\\\\\\\.cache\\\\\\\\\\\\\\\\codex-runtimes\\\\\\\\\\\\\\\\codex-primary-runtime\\\\\\\\\\\\\\\\dependencies\\\\\\\\\\\\\\\\native\\\\\\\\\\\\\\\\powershell\\\\\\\\\\\\\\\\pwsh.exe\\\\\\\" -Command 'Get-Content -LiteralPath PROJECT_MEMORY.md, iso_dates.py, test_iso_dates.py, recovery.json, handoff.md, evidence/session_a_tests.txt'` rejected: blocked by policy\\\")\" }\n",
      "stdout": "{\"type\":\"thread.started\",\"thread_id\":\"<DIAGNOSTIC_SESSION>\"}\n{\"type\":\"turn.started\"}\n{\"type\":\"item.completed\",\"item\":{\"id\":\"item_0\",\"type\":\"agent_message\",\"text\":\"LOCAL_DIAGNOSTIC_COMPLETE_NO_MODEL\"}}\n{\"type\":\"turn.completed\",\"usage\":{\"input_tokens\":0,\"cached_input_tokens\":0,\"cache_write_input_tokens\":0,\"output_tokens\":0,\"reasoning_output_tokens\":0}}\n",
      "expected_exit_note": "CLI exit 0 follows a synthetic terminal message, not successful tool execution."
    }
  6. Mad-Max8063 commented on Oct 2, 2026

    @Mad-Max8063

    Follow-up: explicit Windows backend exposed two further execution blockers (CLI 0.159.3)

    Follow-up to our deterministic no-model reproduction. We have now tested -c windows.sandbox="elevated". This updates the earlier statement that this selector had not been tested.

    Impact: our local file-handoff workflow still cannot execute its first read or run its tests. After enabling the documented backend and approving Windows setup prompts, the failures moved from a generic policy rejection to helper path handling and then runtime access validation. This is a substantial blocker for sandboxed local automation on this machine. We cannot claim that all failures share one cause or affect all Windows installations.

    Controlled observations

    The follow-up probes used the same isolated Codex CLI 0.159.3, native Windows 11, a deterministic loopback provider, dummy files, and one read command per attempt. No model inference, OAuth credentials, API key, or Authorization header was used in these probes. The CLI executable SHA-256 remained:

    57e1bdab42c0559a74558ca17e85d5c7893caa5f1e582f67e9ddd6d97fa705a7

    Relevant invocation settings: exec --ephemeral --ignore-user-config --skip-git-repo-check --json -c default_permissions=":workspace" -c windows.sandbox="elevated"; approval resolved to Never, network remained restricted. The local provider configuration and dummy read are described in the linked reproduction. Each attempt had a fresh isolated home/workspace; setup was therefore not a perfectly identical environment across attempts. Windows setup prompts were approved by the human.

    Stage Observed result
    Explicit backend, initial collection Pending tool cell; 60-second timeout. The initial stub ended before collecting the asynchronous result. Inconclusive.
    Bounded asynchronous collection Four functions.wait replies still pending with no output; 90-second watchdog. Inconclusive, not a successful read.
    After human setup approvals Terminal error: orchestrator_helper_launch_failed, Windows os error 3 while launching the setup helper.
    Identical vendor runtime copied to shorter path Helper launches; terminal error becomes helper_unknown_error: setup refresh had errors, with a specific runtime read/execute validation failure in the log.

    1. Helper path handling

    The setup helper's original absolute path was 271 characters long. The exact helper file was found with a Windows extended-path prefix (\\?\) but not through the normal path check. The workspace existed. The log reported:

    setup refresh failed to launch helper:
    helper=<LONG_VENDOR_ROOT>\codex-resources\codex-windows-sandbox-setup.exe
    error=El sistema no puede encontrar la ruta especificada. (os error 3)
    

    We copied the complete vendor directory to a shorter location, preserving the relative layout. All 45 files matched SHA-256 hashes. The helper path became 169 characters, the normal path check succeeded, and the helper launched in the next single probe. This strongly supports a long-path launch limitation as the immediate error at that stage. It does not establish that shortening paths resolves the whole workflow.

    2. Installed runtime access validation

    With the shorter vendor path, setup provisioning completed and the refresh helper launched, but the sandbox log then reported:

    runtime read/execute validation failed: validate runtime read/execute access on
    <LOCALAPPDATA>\OpenAI\Codex\runtimes\cua_node\b63ee7ee40c23b77\bin\node_repl.exe:
    CreateFileW failed for <same file>
    setup refresh completed with errors
    setup error: setup refresh had errors
    

    The referenced file is present (directory enumeration reports an ordinary file, 33,971,040 bytes). Read-only checks of this exact file returned:

    • Get-Acl: unauthorized operation / access denied.
    • icacls inspection: access denied; zero files successfully processed.
    • CreateFileW, allowing read/write/delete sharing: Windows error 5 separately for FILE_READ_ATTRIBUTES, FILE_READ_DATA, and READ_CONTROL.
    • A separate UAC-elevated PowerShell Get-Acl inspection: access denied. The diagnostic verified that its token was elevated.

    The parent directories' ACLs were readable. They contain inherited allow entries granting the user, SYSTEM, and Administrators full access, and CodexSandboxUsers read/execute access. This does not reveal the file's own ACL or prove the sandbox token's effective access. We have not established whether the enforcement source is a file ACL, security software, or another OS/runtime condition. The standalone error-5 checks are additional observations; the setup log itself did not include that Win32 error number.

    Setup side effects and limits

    The native setup log records sandbox-user provisioning checks, sandbox firewall/WFP configuration, write ACEs for the temporary directory and dummy workspace, and a read-ACL pass. We are not claiming these probes left all system state unchanged. We made no manual ownership/ACL changes, disabled no protection, and used no full-access or unelevated fallback.

    No follow-up probe successfully read the dummy files. CLI exit 0 after the fixed stub final message is not tool success. The dummy command intentionally includes a missing recovery.json; a normal missing-file result would indicate that execution had started, but these failures occur before the requested read. The runtime access error should not be retroactively presented as the proven cause of the original generic policy rejection.

    Requested triage

    Could maintainers please:

    1. Confirm expected long-path support for launching codex-windows-sandbox-setup.exe, or document a supported runtime location/path-length limit.
    2. Identify a supported recovery for this installed node_repl.exe access-validation failure, including what safe diagnostic can distinguish its cause when even an elevated ACL read is denied.
    3. Surface the failing path, stage, and underlying Windows error directly in the tool result, and make outstanding interactive setup requirements explicit before automated work begins.

    We have stopped retries and preserved the receipts. We can provide further sanitized, targeted diagnostics if requested. Please avoid a blanket permission grant or disabling the sandbox as the proposed resolution. If the two downstream failures should be tracked separately, please advise how best to split/link them; this follow-up documents the progression of the already reported blocker.

    Evidence dates: local 2026-10-01 (America/Argentina/Buenos_Aires); some sandbox log filenames/timestamps use 2026-10-02 UTC. Paths, account names, machine names and SIDs are redacted above. No credentials, complete user profile, or private project source is included.

  7. tayapro commented on Oct 9, 2026

    @tayapro

    Following up on the Sep 28 report in this thread about SystemRoot being absent from the native Windows elevated sandbox environment.

    I can reproduce the same missing-SystemRoot behavior on a current Windows Codex build, with a slightly different visible failure: Node starts successfully for --version, but aborts as soon as it initializes enough runtime state to execute JavaScript.

    Environment:

    • Windows
    • ChatGPT / Codex & OWL version: 26.1007.21434
    • Codex sandbox configuration:
    [windows]
    sandbox = "elevated"
    • Node.js: v24.21.0

    This is after updating Codex. A previous broader Windows sandbox failure (helper_unknown_error: setup refresh had errors) is no longer occurring on this machine: ordinary sandboxed commands now execute normally.

    However, Node-based commands still fail inside the sandbox.

    I ran the following diagnostics entirely inside the sandbox, with no outside-sandbox retries, no elevation, and no persistent environment changes.

    1. Basic sandbox execution

    cmd /c echo CODEX_SANDBOX_OK
    

    Result:

    CODEX_SANDBOX_OK
    

    Exit code: 0.

    So the elevated sandbox itself is now able to launch ordinary commands.

    2. Check SystemRoot

    cmd /c echo SYSTEMROOT=%SystemRoot%
    

    Result:

    SYSTEMROOT=%SystemRoot%
    

    Exit code: 0.

    cmd.exe therefore receives an environment where SystemRoot is not defined.

    3. Check Node startup

    node --version
    

    Result:

    v24.21.0
    

    Exit code: 0.

    So node.exe can start far enough to print its version.

    4. Execute JavaScript

    node -e "console.log('NODE_SANDBOX_OK')"
    

    Result: exit code 1.

    #  C:\Program Files\nodejs\node.exe[31208]: std::shared_ptr<InitializationResultImpl> __cdecl node::InitializeOncePerProcessInternal(const std::vector<std::string> &, ProcessInitializationFlags::Flags) at src\node.cc:1266
    #  Assertion failed: ncrypto::CSPRNG(nullptr, 0)
    
    ----- Native stack trace -----
    
    1: 00007FF6B67690C6 node::SetAbortHandler+54
    2: 00007FF6B6768C77 node::MultiIsolatePlatform::DisposeIsolate+770039
    3: 00007FF6B67CB00E node::InitializeOncePerProcess+2974
    4: 00007FF6B67CB3CD node::Start+445
    5: 00007FF6B688D312 node::AsyncResource::CallbackScope::CallbackScope+610
    6: 00007FF6B6A9D3C4 node::AsyncResource::CallbackScope::CallbackScope+2163476
    7: 00007FFF8DFE259D BaseThreadInitThunk+29
    8: 00007FFF8EE8AF78 RtlUserThreadStart+40
    

    5. A/B test: restore only SystemRoot

    In the same sandbox:

    cmd /c "set SystemRoot=C:\Windows&& node -p 1+1"
    

    Result:

    2
    

    Exit code: 0.

    No persistent environment variable was created. SystemRoot was supplied only to this child command.

    This gives a reproducible A/B result on this machine:

    elevated sandbox + missing SystemRoot
        -> Node JavaScript execution aborts with ncrypto::CSPRNG assertion
    
    same elevated sandbox + SystemRoot=C:\Windows
        -> Node JavaScript execution succeeds
    

    This appears consistent with the missing-SystemRoot behavior reported in the Sep 28 comment above.

    One useful detail is that:

    node --version
    

    is not sufficient as a sandbox health check in this case. It succeeds even though actual JavaScript execution fails during Node initialization.

    The practical impact is that project-local Node tooling cannot run normally inside the sandbox. For example, a command such as:

    node .agents/skills/impeccable/scripts/detect.mjs --json
    

    cannot currently be used normally even though ordinary cmd.exe commands work.

    There are also newer reports involving missing SystemRoot and the same ncrypto::CSPRNG(nullptr, 0) failure in other Windows Codex execution paths:

    Those use different executor/MCP paths, so I am not claiming they are exact duplicates, but the SystemRoot / Node initialization behavior appears closely related.

    On this machine, restoring only SystemRoot is sufficient to make sandboxed Node JavaScript execution work.

  8. Mad-Max8063 commented on Oct 9, 2026

    @Mad-Max8063

    Follow-up: SystemRoot comparison blocked before shell execution (Windows error 32)

    Following the SystemRoot report in comment 6083930724, our bounded diagnostic
    still stops before executing the shell. On our machine the current blocker is
    runtime setup validation with Windows os error 32, so we cannot yet test
    whether SystemRoot fixes Node initialization.

    Current desktop CLI: 0.162.0-alpha.2, binary SHA-256
    3553cd6e7df5a093d8cb8301cd8088a57e0971aba71ddbe0e67f7f44a15cdf68.
    Native Windows build 26300.9457, Node v24.14.0 (host version inventory only).
    GetWindowsDirectoryW and registry independently identify C:\Windows.

    We reused the credential-free loopback Responses stub and dummy fixture,
    through functions.exec -> tools.exec_command. The launcher ran as the normal
    Windows user (administrator-token check: false). Explicit settings:
    --ignore-user-config, windows.sandbox="elevated", default_permissions=":workspace",
    approval_policy="never", features.prefer_mxc=false. Trace confirms Never/User
    approvals, :workspace permissions and restricted network. No full-access,
    rules bypass or unsandboxed command fallback.

    The native helper launched from the existing installed short path, then logged:

    runtime read/execute validation failed: validate runtime read/execute access on
    <LOCALAPPDATA>\OpenAI\Codex\runtimes\cua_node\3dd31cfff853001c\bin\node_repl.exe:
    open ACL target for root-only update: El proceso no tiene acceso al archivo
    porque está siendo utilizado por otro proceso. (os error 32)
    setup error: setup refresh had errors
    

    The tool returned helper_unknown_error: setup refresh had errors before
    creating the shell (command event exit -1). CLI exit 0 only reflects the stub's
    terminal message. One synthetic command request, two loopback requests, no
    Authorization header, auth.json, model inference or changed fixture bytes.

    We stopped on this first helper/runtime failure. The SystemRoot-injected B
    condition was NOT RUN; neither Get-Content nor actual JavaScript ran, and the
    inner SystemRoot value remains unobserved. An earlier nested-launch attempt
    failed resolving its isolated CODEX_HOME; normal-host launch passed that stage.

    Native setup logged firewall/WFP configuration and read/write ACE updates.
    We issued no manual ownership/ACL repairs, protection changes, runtime
    replacement or process termination. Our historical error was os error 5 on a
    different runtime path; we are not claiming one cause or a verified fix.

    What supported procedure can diagnose/recover this runtime setup sharing
    failure without weakening sandbox protections? Does setup account for an
    already-running runtime holding this file open, and how should operators
    distinguish that case safely? We have not identified the locking process.

    Sanitized receipts: evidence/systemroot-normal-host-20261009.json. The full
    local log is preserved; private paths/SIDs are redacted from the export.

    Read-only source review on 2026-10-09 found related reports #52328 (commands
    work while Desktop is closed) and #51971 (MAXIMUM_ALLOWED access-mask comparison).
    Tagged rust-v0.162.0-alpha.2 acl.rs contains that access mode and the exact
    root-only error context. This supports an investigation direction, not a
    verified local cause or an official fix. We have not applied the ACL workaround.
    The official Windows troubleshooting recommends restarting Codex and collecting
    logs. The single manual external continuation then completed on
    2026-10-09T23:43:39Z with the same CLI hash and exact harness snapshot. Its
    Windows token was non-admin (verified by both terminal output and inventory).
    It again failed in A with the same node_repl.exe sharing violation, before
    shell creation; B was automatically NOT RUN. Elevated/never/workspace and
    restricted network are recorded in the effective trace. Six receipt-assessment
    tests passed, separately from the failed sandbox execution.

    We requested normal Desktop exit before that run, but the harness did not
    instrument app/helper process closure or identify the conflicting handle.
    This does not establish that the app and all helpers were closed, or disprove
    the other user's closed-app recovery. No further retries or ACL workarounds.
    Sanitized external receipts: evidence/systemroot-external-20261009.json.

    The receipt filenames above identify preserved local artifacts, not public attachments; they have not been pushed. We can provide targeted sanitized excerpts if requested.

  9. huajunsun273-hub commented on Oct 17, 2026

    @huajunsun273-hub

    Additional Windows CLI reproduction: in-worktree read-only Get-Content rejected before PowerShell launch (0.153.3)

    I am adding a separate, sanitized occurrence of the same error class to this open issue. In contrast to the original report here, the Markdown file in this occurrence was inside the selected Git worktree, not in a sibling repository. We do not know whether both occurrences share the same denying policy.

    Environment / exact CLI shape

    • Windows 11; Codex CLI 0.153.3 at the time of the incident; existing ChatGPT sign-in; model gpt-6-astra.
    • A single ephemeral, read-only run with no new account or API key:
      codex.exe exec --json --ephemeral --sandbox read-only --ignore-user-config --config approval_policy=never --model gpt-6-astra -
      
    • Worktree was a pinned, isolated Git checkout. The intended input was one approved, nonsensitive, Git-tracked Markdown file. The requested shell command was:
      Get-Content -LiteralPath 'tools/supervisor-v3/README.md'
      This is a relative path within the worktree. Local absolute paths, account identifiers and raw session logs are withheld.

    Observed result and separately retained evidence

    At 2026-10-17 12:05:56.785403 UTC, retained Codex stderr contains this tool-router failure (machine-specific executable path removed):

    codex_core::tools::router:
    exec_command failed: CreateProcess ... pwsh.exe -Command
    "Get-Content -LiteralPath 'tools/supervisor-v3/README.md'"
    ... rejected: blocked by policy
    

    The tool request reached codex_core::tools::router, but the requested PowerShell subprocess did not demonstrably start and no file read was proved.

    • Exactly one Codex CLI/model turn; no retry, no changed sandbox/approval flags, and no automatic fallback.
    • CLI process exit code: 0 (a terminal model response, not a successful tool execution).
    • Captured JSONL event sequence: thread.started, turn.started, item.completed(agent_message), item.completed(agent_message), turn.completed.
    • Zero command_execution JSONL events; the agent reported that the command was blocked. The independent stderr trace supports a tool request and pre-spawn rejection, but does not identify the policy layer or rule.
    • Retained raw JSONL SHA-256: 5669d506e53bb36309326ebb67958434eb304fd7639182cc9906c95e54ac21fb.
    • Retained stderr SHA-256: 0ef37ab93a4686ab0e0c805e5a6183e883b6ab54c820e816409f93579cf8138e.
    • Both file hashes were reported stable on local readback. No raw private files or source content are attached.
    • Subsequent installation reported a different CLI version (0.162.0-alpha.17.2), which was not used for this incident; current help/config cannot establish the effective policy of the earlier run. Other unrelated local warnings were seen but not proved causal.

    Could maintainers please clarify:

    1. Which enforcement component can generate exec_command failed: CreateProcess ... rejected: blocked by policy before pwsh.exe launches under these precise read-only, no-approval flags? Is it possible to retrieve an actionable policy source/rule ID, denial reason or correlation ID for this particular request?
    2. Is rejection of an in-worktree Get-Content -LiteralPath <relative-file> an expected restriction, or a possible false positive? Does this message definitively mean Windows never created the child process?
    3. What is the supported, least-privilege remedy or diagnostic procedure for permitted read-only Markdown inspection on Windows without disabling the sandbox, switching to unrestricted access, bypassing policy or repeatedly executing the rejected command?
    4. If specific nonsecret, privacy-safe diagnostics are needed, which exact fields should be collected, and from which supported logs/commands?

    This report establishes a pre-spawn policy rejection, not the identity of its owner/rule, successful repository reading or a root cause shared with other reports. Thank you.

  10. ushakovfinance-commits commented on Nov 6, 2026

    @ushakovfinance-commits

    Additional version-pinned incident for the Windows pre-CreateProcess denial described here (request for a maintainer's policy attribution; not a claim of a confirmed root cause).

    • Native Windows Codex CLI: 0.166.0-alpha.6.
    • A one-shot, noninteractive, sandboxed invocation used codex exec --ignore-user-config --ephemeral --sandbox read-only -c approval_policy="never" --json ..., with no explicit windows.sandbox override. The ordinary user config (not loaded by this invocation) had [windows] sandbox = "elevated".
    • Both a combined read-only metadata/Git operation and a subsequent simple Get-Content read were rejected by CreateProcess ... rejected: blocked by policy before PowerShell started. There were zero completed command/tool executions. The CLI process nevertheless exited 0.
    • The saved ephemeral JSON/host output does not include effective Windows backend, reviewer, or a policy decision identifier. The historical effective CODEX_HOME was not retained. No config, sandbox, approval policy, OS permissions or runner was modified, and no repeat execution was attempted.
    • Source inspection of the exact tagged version rust-v0.166.0-alpha.6: codex-rs/core/src/exec_policy.rs around lines 792–811 returns Decision::Forbidden under WindowsSandboxLevel::Disabled + managed filesystem restrictions + AskForApproval::Never. windows_sandbox.rs around lines 126–151 derives selection from config/features and can yield Disabled. This is a strong candidate, not proof of the historical effective state. Also related: 0.152.0 Windows: --ignore-user-config leaves exec with no usable sandbox — every command "rejected: blocked by policy" (regression from 0.147.0) #42172, Windows CLI 0.166.0: exec_command blocked by policy in read-only and split writable-root failure in workspace-write #59314.

    OpenAI maintainers: Can you confirm whether this specific configuration on 0.166.0-alpha.6 would use the disabled-backend policy branch, or identify another enforcing layer capable of producing the same refusal? What supported read-only diagnostic can recover the effective policy/decision from the original ephemeral invocation, and what is the sandbox-preserving remediation when user config is intentionally ignored? We are not requesting Full Access, an approval bypass, changing Windows ACLs, or running unsandboxed.

    No proprietary paths, source filenames, account details, credentials, full command transcripts, or private logs are included.

  11. removed
    exec
    on Nov 29, 2026
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