Codex Security Deep Scan fails twice on Windows: spawn EPERM, then missing threat_model.md after workaround

Open
#36,588 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
javascript, node.js, rust

Research direction

Start with the deep-scan-mcp/v1 workflow and the resolveCodexPath function shown in the report, then trace the worker artifact validation around threat_model.md. Reproduce the Windows scan with and without CODEX_CLI_PATH and inspect the retry and cancellation paths. Done means the executable is resolved reliably and a missing worker artifact produces actionable handling without discarding usable results.

Written by the indexing model from the issue text.

Description

app bug safety-check skills subagent windows-os

Summary

Codex Security Deep Scan on Windows encounters two sequential terminal failures:

  1. With CODEX_CLI_PATH unset, discovery workers fail with spawn EPERM. This matches #35872.
  2. After applying the documented workaround—pointing CODEX_CLI_PATH at the directly spawnable native npm codex.exe and restarting Codex Desktop—a fresh scan gets past worker launch but fails later because the required threat_model.md artifact is missing.

Both scans terminated during discovery with zero accepted findings and no validation or final report. The second failure happened after multiple worker attempts, so the scan performed substantial work but returned no usable partial result.

Environment

  • Windows 11 Home, x64, version 10.0.26200
  • Codex Desktop
  • Codex Security plugin 0.1.15
  • Native npm Codex CLI binary, currently codex-cli 0.146.0
  • Private local Git repository scanned at a fixed immutable revision
  • Deep Scan workflow: deep-scan-mcp/v1, deterministic mode

Failure 1: bare codex cannot be spawned

Steps
  1. Leave CODEX_CLI_PATH unset.
  2. Start a fresh Codex Security Deep Scan.
  3. Complete setup and allow preflight to pass.
  4. Wait for discovery workers to launch.
Actual result

The selected worker exhausted four attempts with synchronous spawn EPERM. The remaining workers were canceled.

Sanitized result:

{
  "status": "failed",
  "discoveryCount": 0,
  "failure": {
    "phase": "discovery",
    "message": "spawn EPERM",
    "kind": "Error:EPERM"
  }
}

Directly spawning the native npm codex.exe succeeds. The plugin runtime falls back to the bare command when the override is absent:

function resolveCodexPath(env = process.env) {
  return env.CODEX_CLI_PATH?.trim() || "codex";
}

This first failure is already represented by #35872.

Workaround applied

  1. Set the user-level CODEX_CLI_PATH to the direct native npm codex.exe, not the codex.cmd shim.
  2. Verify that the file exists and --version exits successfully.
  3. Restart Codex Desktop so the plugin MCP process inherits the variable.
  4. Start a completely new Deep Scan against the same immutable revision.

The previous spawn EPERM no longer occurred, confirming that the workaround fixed the first launcher failure.

Failure 2: required worker artifact is missing

The new scan completed deterministic setup and successfully launched discovery workers. Its effective configuration was:

{
  "workers": 6,
  "subagents": 3,
  "stopAfterNoNew": 6,
  "maxDiscoveryRuns": 60
}

One discovery worker reached attempt 4 and then failed with:

Codex worker file change failed. Deterministic artifact validation also reported:
ENOENT: no such file or directory, realpath
'<scan-root>\artifacts\deep_discovery\workers\discovery-0004\output\threat_model.md'

The other five workers were canceled. Sanitized terminal manifest:

{
  "workflowVersion": "deep-scan-mcp/v1",
  "status": "failed",
  "dispatchedCount": 6,
  "discoveryCount": 0,
  "acceptedWorkerIds": [],
  "mergedWorkerIds": [],
  "workerThreatModelPaths": [],
  "canonical": null,
  "executions": [
    {
      "label": "discovery-0004",
      "kind": "discovery",
      "status": "failed",
      "attempt": 4,
      "error": "Codex worker file change failed. Deterministic artifact validation also reported: ENOENT: no such file or directory, realpath '<scan-root>\\artifacts\\deep_discovery\\workers\\discovery-0004\\output\\threat_model.md'"
    }
  ],
  "failure": {
    "phase": "discovery",
    "kind": "Error:file_change_failed"
  }
}

No successful discovery manifest was produced, so centralized validation, attack-path analysis, canonical result sealing, and report.md generation never ran.

Expected behavior

  • On Windows, Deep Scan should resolve a directly executable Codex binary without requiring a manual environment override.
  • Once workers launch, the artifact-writing contract should reliably produce every required file.
  • If one worker fails to produce threat_model.md, successful worker output should be preserved or the scan should return a useful partial result instead of canceling every worker.
  • Retries should surface actionable diagnostics and avoid repeating expensive attempts that end in the same deterministic artifact-validation failure.
  • A failed scan should make clear what usage was consumed and whether any completed work can be resumed.

Impact

Deep Scan is currently unusable in this environment even after applying the workaround for #35872. The second failure occurs only after workers have launched and retried, but the all-or-nothing terminal result contains no findings or report. This creates user-visible compute/quota consumption without a usable deliverable.

I searched the issue tracker for both "Codex worker file change failed" and "threat_model.md" ENOENT and did not find an existing report for the second failure.

Dominant language
Rust
Stars
125k
Forks
19.5k
Avg merge
1m
Merged PRs (30d)
1k

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.