Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

fix: allow completion when no draft manifest exists yet (#83)

Onur Tirpan2b2d87c0a057
diff --git a/sdk/typescript/_bundled_plugin/scripts/workbench_db.py b/sdk/typescript/_bundled_plugin/scripts/workbench_db.py
index ebee840c0..b0779226b 100644
--- a/sdk/typescript/_bundled_plugin/scripts/workbench_db.py
+++ b/sdk/typescript/_bundled_plugin/scripts/workbench_db.py
@@ -1414,11 +1414,18 @@ def complete_scan_locked(
completion_timestamp = now()
completion_binding = workbench_completion_binding(scan, completion_timestamp)
if scan["recipe_json"] is not None:
- manifest = read_json_object(artifact_path(scan_dir, ARTIFACTS["manifest"], required=True))
- manifest_scan = manifest.get("scan")
- if isinstance(manifest_scan, dict) and manifest_scan.get("sealedAt") is not None:
- completion_binding["startedAt"] = manifest_scan.get("startedAt")
- completion_binding["completedAt"] = manifest_scan.get("completedAt")
+ # Fresh recipe-driven scans have no prior scan-manifest.json on disk — the
+ # draft is authored later by _write_prepared_scan_finalization. Guard the
+ # read so first-time completion does not fail with "expected a regular
+ # file inside the scan directory" (issue #73). When a prior manifest does
+ # exist (resumed / re-completed scans), preserve the sealed timestamps.
+ manifest_path = artifact_path(scan_dir, ARTIFACTS["manifest"], required=False)
+ if manifest_path is not None:
+ manifest = read_json_object(manifest_path)
+ manifest_scan = manifest.get("scan")
+ if isinstance(manifest_scan, dict) and manifest_scan.get("sealedAt") is not None:
+ completion_binding["startedAt"] = manifest_scan.get("startedAt")
+ completion_binding["completedAt"] = manifest_scan.get("completedAt")
try:
prepared = _prepare_scan_finalization(
scan_dir,