Repository navigation
Description
Summary
Some scans finish model work but cannot save a report because the required draft artifacts were never written. The original Linux/container report ended with a missing scan-manifest.json and an empty output directory. Later comments describe additional Windows and Linux sandbox cases; the shared error does not establish a single cause.
Current status — 19 October 2026
Several fixes have shipped since the original 0.1.0 report:
| Change | What it addresses |
|---|---|
| #67 | Windows sandbox defaults |
| #83 | An early read of a manifest that had not been created yet |
| #167 | More useful diagnostics when the agent produces no drafts |
| #1084 | A Linux/macOS sandbox-startup check before billed model work |
Some participants reported recovery after environment changes; others did not confirm a fix. This issue remains open for the unresolved environment-specific cases. #73 tracks the broader missing-artifact problem, and #191 covers the GitHub-hosted runner report.
Original reproduction
Reported with Codex Security 0.1.0, Codex 0.145.0, Node 22.23.1, Python 3.11.2, and Linux x86_64 in a container. Host identifiers and output paths below are placeholders.
codex login --device-auth
npx codex-security scan .Authentication succeeded. After approximately 3 minutes 35 seconds:
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-output-directory>.
Listing that directory returned no files. The report therefore concerned missing output, not a malformed manifest that was present on disk.
Expected behavior
- Detect supported runtime/sandbox setup failures before starting model work where possible.
- Persist the required scan artifacts when analysis succeeds.
- When artifact production fails, report the underlying execution/write error and accurately describe any output that remains.
Evidence still needed
For a remaining case on a current release, record the CLI/plugin/runtime versions, OS/container setup, exact error, and whether any draft files exist. Existing logs or a synthetic, model-free fixture are preferable to repeating an expensive scan just to reproduce the terminal message. Windows, Linux-host, and nested-container failures should be tracked by their actual cause.
Activity
daneschneider-oai commentedon Jul 29, 2026
Thanks for these details @pjlsergeant, looking into it!
daneschneider-oai commentedon Jul 29, 2026
Could you please try upgrading to 0.1.1 and see if that resolves it @pjlsergeant
hegargarcia commentedon Jul 29, 2026
Getting the same error with 0.1.1, takes 2-3 minutes before failing.
smixs commentedon Jul 29, 2026
same error
radesjardins commentedon Jul 29, 2026
Same issue for me, first after about 60 second, then after updating to 0.1.1 failure after six minutes, same result.
ElectronicPapers commentedon Jul 29, 2026
Confirmed reproducible on Windows with
@openai/[email protected].Environment:
v24.16.03.11.14Sanitized command shape:
The dry run completed successfully. The real scan ran for several minutes and then failed with:
After failure, the stated partial-output directory existed but was empty, including hidden entries. This confirms that the issue is not Linux-only and still reproduces in version 0.1.1 with an explicitly supplied external output directory.
sinanganiz commentedon Jul 29, 2026
Same issue for me
Environment:
nadavkav commentedon Jul 29, 2026
Same issue on linux/ubuntu
wellnotedhq commentedon Jul 29, 2026
Root cause identified and worked around on Windows 11 / PowerShell 7.5.5,
@openai/[email protected].The manifest error is a downstream symptom. The scan agent never gets to write anything, because every PowerShell helper call it makes is refused:
The mechanism is in
codex-rs/core/src/exec_policy.rs,render_decision_for_unmatched_command:scan()insdk/typescript/src/api.tsstarts the thread with a managed filesystem profile (default_permissions: "codex_security_scan"with:root/:workspace_rootsrestrictions) andapprovalPolicy: "never". On Windows,WindowsSandboxLeveldefaults toDisabled, so that combination is precisely theForbiddenbranch: managed FS restrictions, no sandbox backend to enforce them, no approval path available. Every unmatched command is forbidden, the turn still completes,complete-scanruns anyway, and the missing-manifest error replaces the real failure.Workaround that works today - enable the Windows sandbox backend so the profile is actually enforced:
Controlled A/B on the same repo, same machine, same version:
preflightafter ~7 min, zero files written, missing-manifest errorscan-manifest.json,findings.json,coverage.jsonand the fullartifacts/tree, produced 10 real findingsRun 4 failed at the very end only because repo HEAD moved mid-scan (a separate, correct check).
This is Windows-only.
windows_managed_fs_restrictions_without_sandbox_backendis gated oncfg!(windows), so on Linux and macOS it is always false and an unmatched non-dangerous command underNeverreachesDecision::Allow. The Linux reports in this thread have a different cause; see @ferbiy's comment below.The same function allows a known-safe PowerShell command even when that flag is true, so the remaining question is why the plugin's read-only helpers do not match
is_safe_powershell_words. On #60 @henrykemp1977 recorded the command carrying POSIX quote fragments ('"'"'), which would explain it.Suggested fixes
complete-scanmerely becauseturn.completedarrived - require the draft artifacts first, and surface the underlying policy rejections. Right now a fully-blocked scan is indistinguishable from a write failure. (Overlaps Scan is recorded as complete-scan before the SDK validates the scan contract #34/A failed turn is reported as a successful scan when turn.failed has an unexpected error payload #37/Cleanup failure in the scan finally block replaces the real scan error #38.)Edited: an earlier version of this comment said the same branch could be reached on other platforms. That was wrong; corrected above.
ferbiy commentedon Jul 29, 2026
The Windows root cause is posted above. This is the Linux counterpart, and it explains why 0.1.1 changed nothing for the Ubuntu reports in this thread.
On Ubuntu 24.04+ the default
kernel.apparmor_restrict_unprivileged_userns=1blocks the unprivileged user namespaces bubblewrap needs. The Codex sandbox backend therefore cannot start, so every command the scan agent issues fails. The agent authors none of its artifacts,complete-scanruns regardless, and the missing-manifest error is what surfaces.Three commands to confirm it, no tokens spent
Worth ruling out explicitly:
bubblewrappackage (0.9.0) does not help — the restriction applies to it too.What it costs to find out
Two attempts here, both ending with an empty output directory and the missing-manifest error:
.solfiles,--path-scopedProbing the backend before the thread starts returns the true cause in 37 ms for $0. I patched a local build to do exactly that:
Two suggestions
complete-scan—scan-manifest.json,findings.jsonandcoverage.json, but notreport.md, which finalization generates. Scan is recorded as complete-scan before the SDK validates the scan contract #34 states this ordering problem precisely. Reordering alone is not sufficient on Linux, though: without a probe, users still pay roughly two minutes and $0.90 to reach the now-correct error.Workaround for anyone blocked right now
Either grant
usernsto/usr/bin/bwrapthrough a targeted AppArmor profile, or runsudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0(global, resets on reboot). I have confirmed the diagnosis on this host but have not applied either remedy here, so treat the remedy as unverified by me.Environment: Ubuntu, kernel 6.17.0-1019-aws · node v22.23.1 · Python 3.12.3 ·
@openai/codex-security0.1.1 (bundled plugin 0.1.14, Codex runtime 0.144.6) · stored ChatGPT credentials · explicit--output-diroutside the repository.CorieW commentedon Jul 30, 2026
I can reproduce this on Windows using
@openai/[email protected].Environment
10.0.190455.1.19041.7417v24.3.0origin/mainCommand
The scan ran for 51 minutes 2 seconds 😢, before failing with:
The saved scan state contained this underlying failure:
The reported partial-output directory was empty. The scan did not finalize coverage or produce a valid findings result.
I also retried with:
TEMPandTMPpaths (A:\cs-t)gpt-5.6-solwithxhigheffortgpt-5.6-terrawithhigheffortThe same pattern remained: discovery workers retried but did not create the required
output\finding_discovery_report.mdfiles. Changing the path length and model did not resolve it.The observed behavior is consistent with workers failing to write their required artifacts, followed by
complete-scansurfacing the missing-manifest error. I did not find ablocked by policymessage in the retained logs, so I cannot confirm that the Windows sandbox-policy problem discussed above is the root cause in this case.I have not yet tested
--codex features.experimental_windows_sandbox=true.pjlsergeant commentedon Jul 30, 2026
Following up on the Linux root cause above with the container case (using byre on Docker), which that comment explicitly left out of scope. Same missing-manifest failure observed at full scan cost, inside a Docker container, on Ubuntu (kernel 7.0.0-28-generic); the partial scan directory was empty, consistent with the worker producing no artifacts and the manifest error surfacing downstream.
Probing each layer with stock
debian:bookwormcontainers ($0):unshare -U -r true)unshare -U -r -m sh -c "mount -t tmpfs none /mnt")apparmor=unconfinedonlyseccomp=unconfinedonly10Attribution: userns creation is blocked by Docker's default seccomp filter (the
docker-defaultAppArmor profile on this engine grantsuserns); the mount step is blocked bydocker-default's mount denial; and underkernel.apparmor_restrict_unprivileged_userns=1, going unconfined makes things worse, not better — the restriction targets unconfined processes, so the uid map fails even though namespace creation succeeds (which makes bareunshare -U truea misleading probe).Isolation note: the failing scan ran in a container already configured with
seccomp=unconfinedandapparmor=unconfined(/proc/self/attr/currentconfirmedunconfined). With the host sysctl at1, the uid-map probe failed with EPERM. Changing only that sysctl to0— no container restart or recreation — took the uid-map probe from failing to passing, andcodex sandbox truepassed after the change (it was not run before it).Working container recipe:
--security-opt seccomp=unconfined --security-opt apparmor=unconfinedplus hostkernel.apparmor_restrict_unprivileged_userns=0. Neither security option alone sufficed, and using both still failed while the host sysctl remained 1. Note that this sysctl is a host-wide hardening rollback: it disables AppArmor’s unprivileged-user-namespace restriction for unconfined processes across the host, not only inside this container. Other controls may still restrict user namespaces. Treat this as a deliberate diagnostic/workaround, not a generally safe recommendation.Also +1 to the pre-scan probe suggestion above:
codex sandbox trueexercises exactly this stack in milliseconds for $0.Environment: Docker
Docker version 29.6.2, build dfc4efb·@openai/codex-security0.1.4· Codex runtimecodex-cli 0.146.0· host Ubuntu, kernel 7.0.0-28-generic · container image debian:bookworm (probe matrix) and a Debian-bookworm-based dev container (scan).Final result: the sandbox failure no longer reproduces here (uid-map and
codex sandbox trueprobes pass).A full scan is not yet confirmed from this environment — my scans now fail on unrelated account-side errors (trusted-programme entitlement) while writing a fair chunk of LLM-output.Full scan workedIlyaPvd commentedon Jul 30, 2026
Still reproduces on 0.1.4 (latest) and in the official Docker image, with ChatGPT‑subscription auth (
--auth chatgpt). Looks like the Linux analogue of @wellnotedhq's Windows finding: the scan agent never writesscan-manifest.json, so finalization fails.Environment
@openai/codex-security0.1.1 and 0.1.4 vianpx, and a locally built official image (docker build .from this repo, run through the shipped entrypoint with--init)node:22and the official image), Python 3.11login --device-auth→Authentication: stored Codex credentials.Minimal repro — two‑commit git repo, then:
The model runs 1–4 min (cost accrues), then:
/out/csis empty afterwards — nothing was ever written.Ruled out (each varied independently; all fail identically):
node:22vs the official built image (entrypoint,--init)gpt-5.6-lunavs defaultgpt-5.6-sol/xhigh--security-opt seccomp=unconfined --cap-add ALL--output-dirinside vs outsideCODEX_HOME, and on a container‑local fsCODEX_SECURITY_STATE_DIRat an external path (default); pointing it inside the repo is rejected by design:Scan output directory must be outside the scanned directory ... Protected root: /src/sys/kernel/security/lsm = lockdown,capability,landlock,yama,apparmorLikely Linux mechanism (mirrors the Windows exec‑policy block): the scan agent runs under codex
--sandbox workspace-write(hardcoded in the invocation; a--codex sandbox_mode=...override is stripped). The bundled plugin'sfinalize_scan_contract.py --scan-dir <dir>requires<scan_dir>to be outside the scanned worktree ("Protected root"), yet aworkspace-writeagent can only write inside the workspace. So the agent's writes to the external scan directory are denied,scan-manifest.jsonis never created, and finalization fails. That would explain why it's independent of image, model, seccomp/caps, and output location.Happy to run any diagnostic — I have a reliable minimal repro.
stanleys12 commentedon Sep 28, 2026
Opened #1084 for the fail-fast half of this. It runs
codex sandbox -- trueright before the scan would start its first billed Codex thread, and if that can't run you get the real error (the bwrap/userns one from @ferbiy's comment, or the nested sandbox one) plus the sysctl/README pointer, in well under a second and for $0, instead of finding out after a few minutes and a couple of dollars. Linux/macOS only, the Windows policy case is a different animal so I left it alone. Would appreciate anyone here on Ubuntu 24.04 or in Docker giving it a try.mldangelo-oai commentedon Oct 8, 2026
Related merged fixes: #67 enables the Windows sandbox by default, #83 avoids an early missing-manifest read, and #167 improves missing-draft diagnostics. They address different parts of this thread; they don’t establish that every reported case is fixed.
[-]Could not save the Codex Security scan: scan-manifest.json[/-][+]Missing scan artifacts after model work in Linux, container, and Windows environments[/+]mldangelo-oai commentedon Oct 19, 2026
Moving this to P2 while we narrow down any remaining failure. The Windows sandbox default and Unix startup probe are in 0.4.0. In the SDK checks, simulated Linux/container and nested macOS sandbox failures stopped before a model thread started and preserved the underlying error.
Keeping this open for reports on 0.4.0 or later. A small reproduction, exact package version, OS/container setup, and error text would help establish which failure still needs a fix.
mldangelo-oai commentedon Oct 25, 2026
For the official container, #997 added and tested the Bubblewrap and AppArmor setup. That gives us a known configuration for the container case. It doesn’t establish what happened in the separate Windows or Linux reports. If this still happens with a current release, the useful detail is the first command or write that failed; the missing-manifest message by itself doesn’t tell us the cause.