scan.target.snapshotDigest: expected a non-empty string
got this. not sure it's supposed to be like that:
➜ npx codex-security scan <folder> --diff origin/main --head HEAD
[00:00] Preparing scan
[00:00] Authentication: stored Codex credentials.
[00:01] Preparing scan
[00:28] Running scan: committed changes
[00:29] Preflight: worker delegation supported.
[05:17] Running scan: committed changes
[05:18] Worker capacity changed during file review; started 1 of 10 planned workers. Continuing scan.
[05:30] Running scan: reviewing files (committed changes)
[05:30] Worker capacity changed during file review; started 2 of 10 planned workers. Continuing scan.
[05:43] Running scan: reviewing files (committed changes)
[05:44] Worker capacity changed during file review; started 3 of 10 planned workers. Continuing scan.
[05:55] Running scan: reviewing files (committed changes)
[05:56] Worker capacity changed during file review; started 4 of 10 planned workers. Continuing scan.
[06:07] Running scan: reviewing files (committed changes)
[06:08] Worker capacity changed during file review; started 5 of 10 planned workers. Continuing scan.
[06:20] Running scan: reviewing files (committed changes)
[06:20] Worker capacity changed during file review; started 6 of 10 planned workers. Continuing scan.
[06:32] Running scan: reviewing files (committed changes)
[06:33] Worker capacity changed during file review; started 7 of 10 planned workers. Continuing scan.
[11:39] Running scan: reviewing files (committed changes)
[11:40] Worker capacity changed during file review; started 8 of 10 planned workers. Continuing scan.
[12:54] Running scan: reviewing files (committed changes)
[12:54] Worker capacity changed during file review; started 9 of 10 planned workers. Continuing scan.
[13:02] Running scan: reviewing files (committed changes)
[13:02] Scan phase: reviewing files (10 workers).
[29:49] Running scan: reviewing files (committed changes)
[29:50] Worker capacity changed during validation; started 9 of 13 planned workers. Continuing scan.
[29:57] Running scan: validating findings (committed changes)
[29:57] Worker capacity changed during validation; started 10 of 13 planned workers. Continuing scan.
[30:06] Running scan: validating findings (committed changes)
[30:06] Worker capacity changed during validation; started 11 of 13 planned workers. Continuing scan.
[30:14] Running scan: validating findings (committed changes)
[30:15] Worker capacity changed during validation; started 12 of 13 planned workers. Continuing scan.
[30:26] Running scan: validating findings (committed changes)
[30:26] Scan phase: validating findings (13 workers).
[42:49] Running scan: validating findings (committed changes)
[42:49] Scan phase: analyzing attack paths (9 workers).
[91:52] Running scan: analyzing attack paths (committed changes)
codex-security: Could not save the Codex Security scan: scan.target.snapshotDigest: expected a non-empty string
codex-security: Partial output was kept at <redacted>.
``
Same here, but at the first "Runninc scan" step.
[00:00] Preparing scan
[00:00] Authentication: stored Codex credentials.
[00:02] Preparing scan
[58:48] Running scan
codex-security: Could not save the Codex Security scan: scan.target.snapshotDigest: expected a non-empty string
codex-security: Partial output was kept at ...
I can reproduce this error with two clean, detached repositories.
Reproduction 1, linked worktree:
git worktree add --detach <path> <commit>
cd <path>
codex-security scan
Reproduction 2, standalone clone:
git clone --no-hardlinks --no-checkout <repository> <path>
cd <path>
git checkout --detach <commit>
codex-security scan
In both cases:
git status --porcelainwas empty.- The scan completed its analysis before failing during final save.
- The same error appeared:
codex-security: Could not save the Codex Security scan: scan.target.snapshotDigest: expected a non-empty string
codex-security: Partial output was kept at <redacted>.
The partial manifests did not contain a populated target or snapshot digest:
{
"target": null,
"snapshotDigest": null
}
The standalone clone had a normal .git directory, so this does not appear limited to linked-worktree metadata. Detached HEAD may be relevant.
Expected:
- A clean, immutable target should save successfully.
- If detached
HEADis unsupported, preflight should fail before the full scan runs.
Confirmed with @openai/codex-security 0.1.6 and 0.1.7; 0.1.7 bundles Codex Security plugin 0.1.15.
The failure appears to be a contract mismatch in the published package:
- committed
commit/rangediff setup recordsbaseRevisionandheadRevisionbut nocontentDigest; - manifest construction consequently emits a
git_difftarget with base/head and nosnapshotDigest; finalize_scan_contract.pynevertheless listssnapshotDigestas the required coordinate for everygit_diff;scan-manifest.schema.jsonlikewise requiressnapshotDigestforgit_diff;- working-tree diffs separately calculate and validate a content digest.
This makes canonical finalization impossible for a committed base/head diff even when analysis completes.
Should the canonical contract instead require baseRevision and headRevision for git_diff, with snapshotDigest additionally enforced by the workbench for working-tree material?
Is this already corrected in hosted plugin 0.1.16/0.1.17? If so, which upcoming @openai/codex-security npm release will bundle the corrected plugin?
Confirmed again with Codex Security plugin 0.1.18 on a committed base/head range.
The analysis completed, and the failure occurred only during canonical finalization with:
scan.target.snapshotDigest: expected a non-empty string
The preserved partial output was still useful as advisory evidence, but not as an officially sealed scan result.
A safe operational workaround until #241 lands is:
- Preserve the partial-output directory unchanged.
- Hash the emitted artifacts and inspect them read-only.
- Verify that the manifest is bound to the intended base/head revisions.
- Verify coverage mechanically, including that all planned work items are closed and that no areas are deferred or open.
- Evaluate the emitted findings and coverage artifacts for triage.
- Label the result explicitly as unsealed.
Important limitations:
- Do not invent, inject, or manually substitute a
snapshotDigest. - Do not modify the manifest to make schema validation pass.
- Do not represent the partial result as
CODEX_SECURITY_GATE:PASS. - Any release-policy exception for the missing technical seal must be separately authorized and bound to the exact reviewed revisions; it is not a substitute for unknown or incomplete coverage.
For a terminally failed scan, I could not find an exposed in-place recovery path for the same scan ID. Starting/rejoining may therefore create a replacement scan rather than repairing the completed analysis. A supported same-scan recovery/finalization operation would be useful in addition to the digest fix.