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(multiscan): surface early supervisor failures in lock recovery (#2520)

Michael D'Angeloc3ae333c6689
diff --git a/sdk/typescript/tests-ts/multiscan-checkout.test.ts b/sdk/typescript/tests-ts/multiscan-checkout.test.ts
index 244bf9787..7cda5af79 100644
--- a/sdk/typescript/tests-ts/multiscan-checkout.test.ts
+++ b/sdk/typescript/tests-ts/multiscan-checkout.test.ts
@@ -908,14 +908,18 @@ describe("multiscan", () => {
active -= 1;
return completedScan(scanOptions.outputDir!);
});
- const contenders = Promise.allSettled([
+ const contenders = [
runMultiscan(options(paths, security)),
runMultiscan(options(paths, security)),
- ]);
+ ];
- await running.promise;
- finish.resolve();
- const outcomes = await contenders;
+ try {
+ // One contender can lose the lock before the winning client starts.
+ await Promise.race([running.promise, Promise.any(contenders)]);
+ } finally {
+ finish.resolve();
+ }
+ const outcomes = await Promise.allSettled(contenders);
expect(maximum).toBe(1);
expect(