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): exercise installed worker retries once per PR platform (#1940)

Michael D'Angeloa9bb1fb6d96f
diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml
index aee89a0f2..006468079 100644
--- a/.github/workflows/node-ci.yml
+++ b/.github/workflows/node-ci.yml
@@ -242,6 +242,9 @@ jobs:
- *download-package-for-this-commit
- name: Inspect installed package
working-directory: sdk/typescript
+ env: &package-deep-retry
+ # On PRs, exercise the real retry delay on each OS's floor or only runtime.
+ PACKAGE_DEEP_RETRY: ${{ github.event_name != 'pull_request' || matrix.node == '22.13.0' || strategy.job-total == 1 }}
run: node scripts/check-package.mjs ../../dist/*.tgz
- name: Check Action against the release candidate
@@ -573,4 +576,5 @@ jobs:
- name: Inspect installed package
working-directory: sdk/typescript
shell: bash
+ env: *package-deep-retry
run: node scripts/check-package.mjs ../../dist/*.tgz
diff --git a/sdk/typescript/scripts/fixtures/package-deep-scan.mjs b/sdk/typescript/scripts/fixtures/package-deep-scan.mjs
index 3e60a7d2e..3f502ceee 100644
--- a/sdk/typescript/scripts/fixtures/package-deep-scan.mjs
+++ b/sdk/typescript/scripts/fixtures/package-deep-scan.mjs
@@ -29,6 +29,7 @@ const root = await realpath(
await mkdtemp(join(tmpdir(), "package deep % fixture-")),
);
const installedPlugin = join(installedRoot, "_bundled_plugin");
+const retryMissingResult = process.env.PACKAGE_DEEP_RETRY !== "false";
let restoreSpawn;
try {
const detachedPlugin = join(root, "standalone plugin %", "codex-security");
@@ -76,7 +77,9 @@ try {
const checks = await Promise.allSettled([
runInstalledSdk(installedPlugin, executable).then(() =>
- console.log("Validated installed SDK direct Deep Scan and worker retry."),
+ console.log(
+ `Validated installed SDK direct Deep Scan${retryMissingResult ? " and worker retry" : ""}.`,
+ ),
),
runDetachedPlugin(detachedPlugin, executable).then(() =>
console.log("Validated detached plugin restart and finalization."),
@@ -362,7 +365,7 @@ async function runDetachedPlugin(pluginRoot, executable) {
} finally {
await rpc.close();
}
- await assertExecutions(f, scanId, 4);
+ await assertExecutions(f, scanId);
}
async function workbench(f, args) {
@@ -380,10 +383,12 @@ async function workbench(f, args) {
async function runInstalledSdk(pluginRoot, executable) {
const f = await fixture("installed", pluginRoot, executable);
- f.env.PACKAGE_DEEP_EMPTY_ONCE = join(
- f.directory,
- "missing-result-completion",
- );
+ if (retryMissingResult) {
+ f.env.PACKAGE_DEEP_EMPTY_ONCE = join(
+ f.directory,
+ "missing-result-completion",
+ );
+ }
const sdk = await import(
pathToFileURL(join(installedRoot, "dist", "index.js")).href
);
@@ -452,7 +457,7 @@ async function runInstalledSdk(pluginRoot, executable) {
} finally {
await client.close();
}
- await assertExecutions(f, scanId, 5);
+ await assertExecutions(f, scanId);
}
async function assertDraft(path) {
@@ -477,7 +482,7 @@ async function readExecutions(f) {
}
}
-async function assertExecutions(f, scanId, preflights = 3) {
+async function assertExecutions(f, scanId) {
const executions = await readExecutions(f);
for (const execution of executions) {
assert.equal(
@@ -494,7 +499,7 @@ async function assertExecutions(f, scanId, preflights = 3) {
assert.equal(reducers.length, 1);
assert.equal(
executions.filter((entry) => entry.phase === "preflight").length,
- preflights,
+ 4 + incomplete,
);
for (const execution of [...workers, ...reducers]) {
assert.equal(execution.scanId, scanId);