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

test(deep-scan): verify a native deadline before worker dispatch (#2300)

Michael D'Angelobf408e145905
diff --git a/docs/agent-workflows.md b/docs/agent-workflows.md
index 9a88917b0..3878e35b0 100644
--- a/docs/agent-workflows.md
+++ b/docs/agent-workflows.md
@@ -49,7 +49,7 @@ does not install the target or require the plugin MCP server.
| ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Find vulnerabilities in a repository or selected paths | [`$security-scan`](../plugins/codex-security/skills/security-scan/SKILL.md): one Standard audit. | `cs scan .`, optionally `--path src`. |
| Review a PR, commit, branch diff, or working-tree patch | [`$security-diff-scan`](../plugins/codex-security/skills/security-diff-scan/SKILL.md): review changes and trace their supporting code. | `cs scan . --diff origin/main` for committed changes, or `cs scan . --working-tree` for local changes. |
-| Investigate a repository or paths deeply | [`$deep-security-scan`](../plugins/codex-security/skills/deep-security-scan/SKILL.md): repeated independent audits; excludes diff reviews. | `cs scan . --mode deep`. |
+| Investigate a repository or paths deeply | [`$deep-security-scan`](../plugins/codex-security/skills/deep-security-scan/SKILL.md): later batches use findings from earlier audits. | `cs scan . --mode deep`. |
| Triage supplied reports or claims | [`$triage-finding`](../plugins/codex-security/skills/triage-finding/SKILL.md): one static-evidence verdict per finding, with proof gaps. | `cs validate findings.json` also assesses supplied claims using static evidence; its output contract differs from plugin triage. See [validation](../sdk/typescript/docs/cli.md#validate-and-patch-findings). |
| Resolve a vulnerable dependency | [`$resolve-dependency-alert`](../plugins/codex-security/skills/resolve-dependency-alert/SKILL.md) traces affected versions and prepares an upgrade or dismissal proposal. | With external imports enabled, read saved alerts with `cs findings imported ./project --format json`. |
| Fix a security finding | Explicitly request [`$fix-finding`](../plugins/codex-security/skills/fix-finding/SKILL.md) with the finding and affected repository. | `cs patch --scan SCAN_ID`; see [patching](../sdk/typescript/docs/cli.md#patch-existing-findings) for individual findings and options. |
diff --git a/plugins/codex-security/mcp-app/tests/test_deep_scan_stdio_lifecycle.ts b/plugins/codex-security/mcp-app/tests/test_deep_scan_stdio_lifecycle.ts
index 9d42586a3..cbaddda8e 100644
--- a/plugins/codex-security/mcp-app/tests/test_deep_scan_stdio_lifecycle.ts
+++ b/plugins/codex-security/mcp-app/tests/test_deep_scan_stdio_lifecycle.ts
@@ -1154,6 +1154,26 @@ service_tier = "ultrafast"
(await readLogLines(startLogPath)).length,
workerCountBeforeRetry,
);
+ const deadlineConfig = path.join(fixtureRoot, "deadline.yaml");
+ await writeFile(deadlineConfig, "scan: {max_time_minutes: 0.000001}\n");
+ const expired = await restartedServer.request(
+ 6,
+ "tools/call",
+ toolCall(
+ "start_codex_security_deep_scan",
+ { targetPath: retryTarget, projectConfigPath: deadlineConfig },
+ "deadline-thread",
+ ),
+ );
+ assertNoError(expired);
+ assert.match(
+ expired.result.structuredContent.instructions,
+ /deadline expired before any Standard scan completed/,
+ );
+ assert.equal(
+ (await readLogLines(startLogPath)).length,
+ workerCountBeforeRetry,
+ );
} catch (error) {
(error as Error).message +=
`\nRestarted MCP stderr:\n${restartedServer.stderrText()}`;