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(ci): budget for the package Deep Scan retry (#1869)

Michael D'Angelo5f521759e7c6
diff --git a/sdk/typescript/scripts/package-smoke-timeouts.mjs b/sdk/typescript/scripts/package-smoke-timeouts.mjs
index 9726c3de7..cc3428037 100644
--- a/sdk/typescript/scripts/package-smoke-timeouts.mjs
+++ b/sdk/typescript/scripts/package-smoke-timeouts.mjs
@@ -1,11 +1,16 @@
export function packageSmokeTimeouts(platform = process.platform) {
const commandTimeoutMs = platform === "win32" ? 180_000 : 120_000;
const installTimeoutMs = platform === "win32" ? 600_000 : commandTimeoutMs;
+ // The Deep Scan fixture deliberately retries a missing result. Its first
+ // production backoff is 60 seconds with up to 30% jitter.
+ const deepScanTimeoutMs = commandTimeoutMs + 78_000;
return {
commandTimeoutMs,
installTimeoutMs,
- // Installation and verification run sequentially; allow both plus cleanup.
- processTimeoutMs: installTimeoutMs + commandTimeoutMs + 30_000,
+ deepScanTimeoutMs,
+ // Installation, ordinary checks, and the Deep Scan fixture run sequentially.
+ processTimeoutMs:
+ installTimeoutMs + commandTimeoutMs + deepScanTimeoutMs + 30_000,
};
}
diff --git a/sdk/typescript/scripts/smoke-package.mjs b/sdk/typescript/scripts/smoke-package.mjs
index 236dca3ea..9ffd9dd22 100644
--- a/sdk/typescript/scripts/smoke-package.mjs
+++ b/sdk/typescript/scripts/smoke-package.mjs
@@ -21,6 +21,7 @@ import { resolveNpm } from "./package-smoke-npm.mjs";
const {
commandTimeoutMs: PACKAGE_SMOKE_TIMEOUT_MS,
installTimeoutMs: PACKAGE_SMOKE_INSTALL_TIMEOUT_MS,
+ deepScanTimeoutMs: PACKAGE_SMOKE_DEEP_SCAN_TIMEOUT_MS,
} = packageSmokeTimeouts();
const packageRoot = fileURLToPath(new URL("../", import.meta.url));
const packageManifest = JSON.parse(
@@ -849,12 +850,17 @@ try {
join(packageRoot, "scripts", "fixtures", "package-deep-scan.mjs"),
installedRoot,
],
- { cwd: consumer },
+ { cwd: consumer, timeout: PACKAGE_SMOKE_DEEP_SCAN_TIMEOUT_MS },
);
console.log(
`Validated installed ${packageManifest.name}@${packageManifest.version}: public import, NodeNext types, CLI, SDK lifecycle, credential locking, hosted scans, ${expectedPluginFiles.length} bundled plugin files, MCP initialization, bundled Codex version, and a nested worker without global codex.`,
);
+} catch (error) {
+ // A timed-out child can leave Windows handles open. Report the smoke failure
+ // before cleanup so an EBUSY error cannot hide its cause.
+ console.error(error);
+ throw error;
} finally {
await rm(consumer, {
recursive: true,
diff --git a/sdk/typescript/tests-ts/package-smoke-timeouts.test.ts b/sdk/typescript/tests-ts/package-smoke-timeouts.test.ts
index 4af13ae91..01034fe03 100644
--- a/sdk/typescript/tests-ts/package-smoke-timeouts.test.ts
+++ b/sdk/typescript/tests-ts/package-smoke-timeouts.test.ts
@@ -17,13 +17,24 @@ describe("npm package smoke timeouts", () => {
});
test.each(["linux", "darwin", "win32"] as const)(
- "allows installation and verification to each use their budget on %s",
+ "allows verification and the deliberate Deep Scan retry on %s",
(platform) => {
- const { commandTimeoutMs, installTimeoutMs, processTimeoutMs } =
- packageSmokeTimeouts(platform);
+ const {
+ commandTimeoutMs,
+ installTimeoutMs,
+ deepScanTimeoutMs,
+ processTimeoutMs,
+ } = packageSmokeTimeouts(platform);
- const remainingAfterInstallation = processTimeoutMs - installTimeoutMs;
- expect(remainingAfterInstallation).toBeGreaterThan(commandTimeoutMs);
+ expect(deepScanTimeoutMs).toBeGreaterThanOrEqual(
+ commandTimeoutMs + 60_000 * 1.3,
+ );
+ const remainingForCleanup =
+ processTimeoutMs -
+ installTimeoutMs -
+ commandTimeoutMs -
+ deepScanTimeoutMs;
+ expect(remainingForCleanup).toBeGreaterThan(0);
},
);