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: show deferred validation in cost-limited Deep Scan reports (#2436)

Michael D'Angelocc823c6472fb
diff --git a/plugins/codex-security/scripts/workbench_saved_results.py b/plugins/codex-security/scripts/workbench_saved_results.py
index af4d506d5..de37e6c3d 100644
--- a/plugins/codex-security/scripts/workbench_saved_results.py
+++ b/plugins/codex-security/scripts/workbench_saved_results.py
@@ -1504,11 +1504,15 @@ def budget_exhausted_draft(
"surfaceIds": [surface_id],
}
)
+ deferred_reason = "Validation was deferred because the scan reached its cost limit."
+ limitations = manifest["scan"].setdefault("scope", {}).setdefault("limitations", [])
+ if deferred_reason not in limitations:
+ limitations.append(deferred_reason)
if not any(
isinstance(item, dict)
and isinstance(reason := item.get("reason"), str)
and (
- reason == "Validation was deferred because the scan reached its cost limit."
+ reason == deferred_reason
or reason.startswith(
"Validation was deferred because the scan reached its cost limit: "
)
@@ -1518,7 +1522,7 @@ def budget_exhausted_draft(
coverage["deferred"].append(
{
"id": "scan-cost-limit",
- "reason": "Validation was deferred because the scan reached its cost limit.",
+ "reason": deferred_reason,
}
)
coverage.pop("completeness", None)
diff --git a/plugins/codex-security/tests/test_workbench_db.py b/plugins/codex-security/tests/test_workbench_db.py
index b24b0b68e..e291b84f6 100644
--- a/plugins/codex-security/tests/test_workbench_db.py
+++ b/plugins/codex-security/tests/test_workbench_db.py
@@ -263,6 +263,7 @@ def test_budget_exhaustion_preserves_unvalidated_discovery_as_deferred_work(
assert coverage["surfaces"][0]["disposition"] == "needs_follow_up"
report = (scan_dir / "report.md").read_text()
assert "No findings were reported." in report
+ assert "Validation was deferred because the scan reached its cost limit." in report
def test_budget_exhaustion_preserves_authored_validated_findings(tmp_path: Path) -> None:
@@ -275,6 +276,11 @@ def test_budget_exhaustion_preserves_authored_validated_findings(tmp_path: Path)
coverage_mode="deep_repository",
)
+ manifest_path = scan_dir / "scan-manifest.json"
+ draft = json.loads(manifest_path.read_text())
+ draft["scan"]["scope"]["limitations"] = ["The deployment configuration was unavailable."]
+ manifest_path.write_text(json.dumps(draft))
+
completed = complete_budget_scan(state_dir, scan_id)["scan"]
assert completed["progress"]["status"] == "complete"
@@ -283,6 +289,12 @@ def test_budget_exhaustion_preserves_authored_validated_findings(tmp_path: Path)
coverage = read_review_state(state_dir, scan_dir)
assert coverage["deferred"][0]["id"] == "candidate-1"
+ limitation = "Validation was deferred because the scan reached its cost limit."
+ assert json.loads(manifest_path.read_text())["scan"]["scope"]["limitations"] == [
+ "The deployment configuration was unavailable.",
+ limitation,
+ ]
+ assert limitation in (scan_dir / "report.md").read_text()
@pytest.mark.parametrize(
diff --git a/sdk/typescript/docs/cli.md b/sdk/typescript/docs/cli.md
index f0a0cf0ba..980b9671f 100644
--- a/sdk/typescript/docs/cli.md
+++ b/sdk/typescript/docs/cli.md
@@ -1212,9 +1212,10 @@ Missing or unreadable usage fails budget verification. Without a limit, usage
reporting remains best effort.
When Deep discovery has finished at a cost stop and usage is verified, the scan returns a sealed
-report and lists unvalidated candidates as follow-up work. Reaching a configured
-limit with a valid finalized report returns `0` by default, or `1` if findings
-meet a configured failure threshold.
+report and retains unvalidated candidates as follow-up work. The saved report and
+the manifest's `scan.scope.limitations` record that validation was deferred.
+Reaching a configured limit with a valid finalized report returns `0` by default,
+or `1` if findings meet a configured failure threshold.
When a worker turn fails with a known cybersecurity policy refusal or an
exhausted usage limit, Deep Scan stops retries and replacements, cancels active