Skip to content

Scan always fails at seal step: scan-manifest.json: expected a regular file inside the scan directory — reproducible on Windows AND Linux #73

Description

@onurtirpan

Summary

codex-security scan fails deterministically at the seal step. The scan runs to completion (models are invoked, tokens billed), preflight reports zero issues, then the tool errors trying to save the manifest and leaves the scan output directory completely empty on disk. Failure is independent of repo size, platform, and path length. Reproduced on both Windows and Linux.

Repro

mkdir C:\tmp\repro\empty
cd C:\tmp\repro\empty
git init
"print('hi')" > hello.py
git add . ; git commit -m init
codex-security scan

Same failure occurs on real repos of any size.

Error output

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 <scan-dir>.

Post-failure filesystem state

The "partial output" directory is completely empty — verified via dir /a /s on Windows and find -type f on Linux. No files, hidden or otherwise. The tool never persisted findings, coverage, or the manifest to disk.

Meanwhile the state DB (workbench.sqlite3) DOES record the scan:

  • scans.status = 'failed'
  • scans.phase = 'preflight' (never advanced per DB, even though 3–5 min of model work occurred and was billed)
  • scans.seal_manifest_digest = NULL
  • scan_artifacts, findings, finding_occurrences tables all have 0 rows

Environment

  • Windows: Server 2025 Datacenter 10.0.26100 on an AWS EC2 developer workstation (accessed via RDP), Node v24.18.0, LongPathsEnabled=1 (not a MAX_PATH issue)
  • Linux (Docker repro): Ubuntu 24.04.4 LTS, kernel 6.17.0-1017-aws, Node v22.23.1, running as root in a container with a bind-mounted repo + credentials dir
  • codex-security CLI: 0.1.1
  • codexSdkVersion: 0.144.6
  • bundledPluginVersion: 0.1.14
  • Model: gpt-5.6-sol at xhigh reasoning, multi_agent_v2 (9 concurrent threads)

Cross-platform confirmation

# Platform Node Repo size Cost Error
1 Windows Server 2025 24.18.0 656 files $2.96 same
2 Windows Server 2025 24.18.0 656 files (retry) $2.64 same
3 Windows Server 2025 24.18.0 77 files $0.86 same
4 Windows Server 2025 24.18.0 3 files $1.82 same
5 Windows Server 2025 24.18.0 3 files (--output-dir <short-path>) $2.42 same
6 Ubuntu 24.04 (Docker) 22.23.1 3 files $3.09 same

Total burned across 6 failed scans: $13.79. Zero findings persisted to disk. Every attempt calls the model and throws at the seal step regardless.

Likely root cause (guess)

The seal step calls fs.statSync('scan-manifest.json') in the scan output directory and rejects if !stat.isFile(). When the file was never written, the error gets rewrapped into "expected a regular file". Some prior write to that path silently failed, so the seal step tries to stat a file that was never created.

Impact

Blocks all usage (both Windows and Linux). Every retry burns real money against the user's OpenAI account. No way to recover any of the billed findings after failure — the scan runs to completion but nothing is persisted.

Requested fix

Version 0.1.1 is currently the only usable version on npm (0.1.0 was initial). Please cut a 0.1.2 that either:

  1. Fails fast at preflight before invoking models (no charge for known-broken save path), OR
  2. Actually fixes the seal step so findings persist

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions