Skip to content

scan-manifest.json not generated — scan fails with "expected a regular file inside the scan directory" #60

Closed

Description

@Wuerken1

Environment

  • OS: Windows 10 Education 19045
  • codex-security version: 0.1.1
  • Node: v22+
  • Git Bash terminal

Steps to reproduce

  1. cd D:\sqlmap
  2. codex-security scan .
  3. Or with explicit output: codex-security scan . --output-dir C:\Users\admin\Desktop\sqlmap-scan

Expected

Scan completes and saves results (manifest, findings, etc.) to the output directory.

Actual

Scan runs for ~8 minutes (API calls appear to succeed — "Running scan" phase completes), then fails:

codex-security: Could not save the Codex Security scan: scan-manifest.json: expected a regular file inside the scan directory.
codex-security: Partial output was kept at .

The output directory is completely empty — no files were written at all.

Diagnosis

Tracked the error to _bundled_plugin/scripts/workbench_db.py:3502 (artifact_path function). The function expects scan-manifest.json to already exist as a regular file in the scan directory, but nothing in the scan pipeline writes this file before the finalize step tries to read it. The scan engine completes its work (API credits are consumed) but produces zero local artifacts.

Additional context

  • Reproduced twice: once via Codex Desktop, once via CLI directly with --output-dir
  • Both attempts produced empty output directories
  • Target directory was git-initialized before the second attempt (no change)

Activity

  1. henrykemp1977 commented on Jul 29, 2026

    @henrykemp1977

    I can independently reproduce the same visible failure with @openai/[email protected] on native Windows, Node 22 and Python 3.12. Two full scan attempts ended with an empty output directory and the same scan-manifest.json: expected a regular file inside the scan directory message.

    However, the root cause observed in my reproduction appears different from the diagnosis in the issue description. This may be a distinct earlier failure path that converges on the same final manifest error; I am not claiming to have confirmed that the original reporter's scan reached the same internal state.

    I preserved and inspected the isolated Codex rollout JSONL. In my reproduction, no repository scan or artifact-writing step actually ran. The first required tool call attempted to read the bundled scan skill using a PowerShell command equivalent to:

    $skillPath = Join-Path $env:CODEX_SECURITY_PLUGIN_ROOT 'skills/security-scan/SKILL.md'
    Get-Content -LiteralPath $skillPath -Raw

    The tool result was blocked by policy. The recorded command representation contained POSIX-style quote fragments around the PowerShell arguments (for example '"'"'), although it is unclear whether that is only rendering or part of the policy input.

    The scan thread was started with approvalPolicy: "never", so the blocked command could not be approved or recovered. A later turn.completed event was still treated as successful, and finalization invoked complete-scan even though the canonical artifacts had never been created. That downstream validation then replaced the useful original failure with the missing-manifest error.

    For this specific reproduction, two fixes may be needed:

    1. Ensure the bundled skill can be read on native Windows under the scan permission profile without requesting an unavailable approval (and verify the PowerShell command is not being POSIX-requoted before policy evaluation).
    2. Preserve tool/policy failures and do not invoke complete-scan merely because turn.completed arrived; first require the expected draft artifacts, otherwise report the original failure.

    Likely public locations are sdk/typescript/src/api.ts around thread startup, event completion/finalization, and result collection, with a regression in sdk/typescript/tests-ts/api.test.ts for: policy-blocked tool call -> turn.completed -> no artifacts.

    All paths and repository-specific content have been omitted from this report.

  2. pjlsergeant commented on Jul 29, 2026

    @pjlsergeant

    This is a dupe of #20

  3. nadavkav commented on Jul 29, 2026

    @nadavkav

    I also experience this, on linux/ubuntu

  4. wellnotedhq commented on Jul 29, 2026

    @wellnotedhq

    Root cause and a working workaround posted on #20: #20 (comment)

    Short version: on Windows the SDK combines a managed filesystem permission profile with approvalPolicy: "never", and with WindowsSandboxLevel::Disabled (the default) render_decision_for_unmatched_command in exec_policy.rs returns Forbidden for every unmatched command. The agent's PowerShell helpers are all "rejected: blocked by policy", it writes nothing, and complete-scan still runs - producing the misleading missing-manifest error.

    Workaround: codex-security scan <repo> --output-dir <dir> --codex features.experimental_windows_sandbox=true. Verified A/B on one machine: without the flag, three runs died in preflight at ~7 min with zero files written; with it, the scan ran 49 min and wrote every canonical artifact.

  5. added
    bug
    on Aug 3, 2026
  6. mldangelo-oai commented on Aug 3, 2026

    @mldangelo-oai
    Collaborator

    PR #67 addressed the default Windows sandbox configuration and automatically closed this report. That change does not resolve every path that produces a missing scan-manifest.json; remaining Windows, Linux, and policy-related cases are still tracked in #20, #27, and #73. Thank you to everyone who documented reproductions and workarounds.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions