Repository navigation
Description
Summary
This issue tracks scans that perform model work but fail to save because required draft artifacts are missing. The original 0.1.1 reports reproduced the symptom on Windows and in a Linux container, including a small synthetic repository. Several underlying causes have since been fixed; the error alone does not identify which cause applies.
Current status — 19 October 2026
| Area | Status / related work |
|---|---|
| Windows sandbox defaults | #67 shipped. |
| Early missing-manifest read | #83 shipped. |
| Missing-draft diagnostics | #167 shipped. |
| Linux/macOS sandbox-startup check before billed work | #1084 shipped. |
| Empty-directory message claiming partial output was kept | #359 remains open; also discussed in #191. |
| Structured Standard-scan draft completion | #1680 remains open. |
| Remaining Linux/container and CI reports | Preserve the distinct evidence in #20 and #191; current-version confirmation is still needed. |
This is an umbrella for remaining cases, not a claim that every current scan or every platform fails.
Original minimal reproduction
Reported on CLI 0.1.1, bundled plugin 0.1.14, with Windows Server 2025/Node 24.18.0 and Ubuntu 24.04 in Docker/Node 22.23.1.
mkdir C:\tmp\repro\empty
cd C:\tmp\repro\empty
git init
"print('hi')" > hello.py
git add .
git commit -m init
codex-security scanThe reported failure was:
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>.
Historical evidence
- Six failed attempts across Windows and Linux used repositories from 3 to 656 files and consumed an estimated $13.79 in total.
- The output directories were empty, including hidden files.
- The workbench recorded
status: failed,phase: preflight, and a null seal digest, with no registered findings/artifacts.
Those observations demonstrate missing durable output. They do not, by themselves, prove that analysis completed successfully or identify the first failed write. Stale phase counters are separately tracked in #70.
Expected behavior and remaining triage
Detect known runtime/sandbox setup failures before paid work, save required artifacts when analysis succeeds, and preserve the actual execution/write error when it does not. The CLI should accurately describe the output that remains.
For a current unresolved case, identify the version/platform, the earliest relevant execution error, and which draft artifacts exist. Reuse existing diagnostics or a deterministic fixture before requesting another paid reproduction. The old request for a 0.1.2 release is superseded by subsequent releases.
Activity
onurtirpan commentedon Jul 29, 2026
Code-level trace pinpointing the failure
Cloned
openai/codex-security@ currentmainand traced the throw site:Failure point:
sdk/typescript/_bundled_plugin/scripts/workbench_db.pyline 1499artifact_path(..., required=True)at that line calls intoworkbench_db.py:3492which raises:when
candidate.resolve(strict=True)raisesFileNotFoundErrorbecausescan-manifest.jsondoesn't exist yet on disk.Why it doesn't exist yet
On a fresh scan (no prior run),
scan-manifest.jsonis written by_write_prepared_scan_finalizationinfinalize_scan_contract.py:2146— which is called atworkbench_db.py:1512, 13 lines after the failing read at line 1499. The read happens BEFORE the write.The DB row for a failed scan confirms this exact configuration triggers it:
Every scan started via the CLI has
recipe_jsonset (the--mode standard/deepconfig), so the failing branch fires unconditionally on fresh scans.Suggested fix
Two candidate patches, pick whichever fits the intended lifecycle:
Option A — treat the file as optional on this pre-completion read (
workbench_db.py:1498-1503):Option B — gate on scan state — only attempt the read when the scan was previously sealed:
Option A is safer (idempotent for both fresh and resumed scans). Option B is semantically clearer if the read is only meant for resumed/re-completed scans.
Cost note (please consider)
Because the failure happens AT completion, the entire model run is billed before the crash. Six failed scans across two OSes racked up $13.79 on a user's OpenAI account with zero findings persisted. A cheap short-term mitigation is to move this read (and any other similar validators) BEFORE the model invocation in the scan lifecycle, so fresh-scan bugs fail fast at $0.
onurtirpan commentedon Jul 29, 2026
Follow-up: patched fix validated, deeper root cause uncovered
Applied the suggested patch (Option A from the earlier comment) to
workbench_db.py:1499locally on both Windows and Linux (Docker) installs. Ran the SDK's existingbun testsuite — 355 pass, 0 fail (no regression). Then executed a real scan end-to-end on both platforms with the patched plugin.Result: the patch fixes the immediate throw at
workbench_db.py:1499cleanly. The scan advances past that read into the_prepare_scan_finalizationphase — where it now hits a second reader of the same missing file:This second error originates from
finalize_scan_contract.py:2017:_prepare_scan_finalizationunconditionally readsscan-manifest.jsonas its first step, then decideswas_sealedfrom what it read. The function has no path where the file legitimately doesn't exist — it assumes an upstream step has already produced a draft.Where is scan-manifest.json supposed to come from?
sdk/typescript/_bundled_plugin/skills/security-scan/SKILL.mdline 14:And line 28:
So the draft manifest is supposed to be authored by the agent (gpt-5.6-sol per
codex-security info) during the scan work, before completion reads it. In all 7 reproduced failures now — including a fresh Linux Docker run — the agent completes its work (models are billed,scan.statustransitions in DB) but the scan-manifest.json draft is never written to disk.Where the actual upstream bug likely lives
The failing symptom is universal:
scan_diron disk stays empty after completion (nofindings.json, nocoverage.json, noreport.md, noscan-manifest.json, noreport.html)scan_artifactstable has 0 rowsscans.phase = 'preflight'(never advances)max_concurrent_threads_per_session=9at xhigh reasoning runs to completion and is billedrecipe_jsonhas"multi_agent_v2":{"enabled":true}Suspects (best guesses without source access to the agent runtime):
complete_codex_security_scanMCP tool is being invoked with a scan_dir that was cleaned/rotated between the agent's writes and the completion call.scan_dirthe completion step reads from.Cost update
Total spend across 8 attempts on this bug now:
Every attempt costs money. Please add a preflight check that verifies the recipe can actually produce the required draft artifacts before invoking any models, so bugs of this shape fail at $0 instead of $3.
No PR possible
Confirming what
CONTRIBUTING.mdstates: "External pull requests cannot be imported into the canonical source." This comment is offered as diagnostic context for the maintainers rather than as a proposed patch path.onurtirpan commentedon Jul 29, 2026
Opened PR #83 with the guard for workbench_db.complete_scan referenced above. Public SDK test suite passes on the patched main (367 pass, 23 expected skips, 0 fail). Submitted as a diff artifact — happy to close it if the change lands via the canonical mirror instead.
mldangelo-oai commentedon Jul 30, 2026
Maintainer reproduction on the current public release, @openai/[email protected]:
This confirms the issue is still present in 0.1.4 and is not Windows-specific. PR #83 bypasses the first missing-manifest read but, as noted above, does not solve the deeper problem that the scan agent never writes the required draft artifacts. The fix should restore authoritative artifact production and fail before model execution whenever that capability is unavailable.
mldangelo-oai commentedon Jul 30, 2026
Correction to my reproduction above after inspecting the Codex rollout: this particular macOS run was launched inside an already-sandboxed Codex desktop command. The inner scan agent failed every shell command before execution with
sandbox-exec: sandbox_apply: Operation not permitted, so it could not produce any draft artifacts. Rerunning the CLI outside that outer sandbox allowed it to create discovery artifacts; that second attempt was intentionally stopped by a low scan-cost limit before finalization.Therefore my first run reproduces the same missing-manifest symptom but has a confirmed nested-sandbox environmental cause and does not independently establish that issue #73 has the same underlying root cause. It does reinforce the need to verify scan-agent shell/write capability before incurring model spend and to surface the actual sandbox failure rather than only the downstream missing-manifest error.
fix: allow completion when no draft manifest exists yet (#83)
fix: make missing scan artifact failures actionable (#167)
mldangelo-oai commentedon Aug 3, 2026
Maintainer cross-reference: using this issue as the umbrella for the missing-scan-artifact symptom, while keeping distinct root causes separate. #20 contains Linux/container reproductions; #27 documents native Windows behavior; and #191 isolates GitHub-hosted runners. The older #51, #60, and #66 were automatically closed after #67 addressed one Windows sandbox-disabled path, not every missing-manifest failure. #181 is the closed duplicate that documents CI billing and the private-repository SARIF prerequisite. Please keep platform-specific evidence on its respective report rather than assuming one fix resolves all of these paths.
mldangelo-oai commentedon Oct 8, 2026
Related: merged #1084 checks Unix sandbox startup before billed work begins. That addresses the sandbox-failure cases here, but doesn’t establish that every missing-manifest cause is fixed.
[-]Scan always fails at seal step: `scan-manifest.json: expected a regular file inside the scan directory` — reproducible on Windows AND Linux[/-][+]Track remaining missing-artifact failures during scan completion[/+]mldangelo-oai commentedon Oct 19, 2026
Moving the umbrella to P2 and keeping it open. #83 fixed the premature manifest read, and #1084 catches Unix sandbox startup failures before billed work begins. Both changes are in 0.4.0; the startup check passed with simulated sandbox failures.
We still need a current case where the scan can run commands and write output but fails to produce its drafts. A small reproduction and exact diagnostic would let us narrow this down to a specific remaining cause.
mldangelo-oai commentedon Oct 25, 2026
One update to the list above: #1680 closed without merging, so it didn’t change how Standard scans complete on
main. #359 is still open for the message about an empty output directory. To narrow the underlying failure, the useful case is a current run where shell and file writes worked but the required draft never appeared.mldangelo-oai commentedon Nov 15, 2026
Since the last update, #359 merged. On main, a simulated
turn.failedpreserved the write error in both the CLI and saved scan status. A simulatedturn.completedwith missing drafts instead namedscan-manifest.jsonandfindings.json.If you have a retained trace from a current release where the agent could write to the scan directory, could you share the first failed draft-tool or write operation and its error, the terminal event (
turn.completedorturn.failed), and which of those two files were present? A short excerpt with the CLI/plugin versions and platform is enough. Please omit credentials and private paths or content. There’s no need to rerun a paid scan.