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

ci: stabilize campaign executable lookup tests (#2621)

Michael D'Angelo6b6c5251cf2d
diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml
index 32f39fa21..655287700 100644
--- a/.github/workflows/node-ci.yml
+++ b/.github/workflows/node-ci.yml
@@ -221,6 +221,16 @@ jobs:
- name: Install ripgrep
if: matrix.os == 'ubuntu-latest'
run: .github/scripts/install-ripgrep.sh
+ - name: Warm campaign executable lookup
+ if: matrix.os == 'ubuntu-latest'
+ working-directory: sdk/typescript
+ # The first campaign reads tool headers across PATH on a cold runner.
+ # Do that I/O before Bun starts the first campaign test's timeout.
+ run: |
+ bun --eval '
+ import helpers from "./_bundled_plugin/mcp/helpers.mjs";
+ helpers.inventoryToolPath(process.env.PATH, process.cwd(), [], "campaign").cleanup();
+ '
- name: Test
working-directory: sdk/typescript
env:
diff --git a/sdk/typescript/tests-ts/trusted-executable.test.ts b/sdk/typescript/tests-ts/trusted-executable.test.ts
index 9ae614470..72179b33c 100644
--- a/sdk/typescript/tests-ts/trusted-executable.test.ts
+++ b/sdk/typescript/tests-ts/trusted-executable.test.ts
@@ -111,11 +111,21 @@ describe("trusted executable resolution", () => {
// One checkout starts missing, the other replaces a link to a trusted tool.
await symlink("/bin/sh", join(first, "tool"));
await symlink(join(firstAlias, "tool"), join(tools, "git"));
+ const bothInspected = Promise.withResolvers<void>();
+ let pendingInspections = 2;
const environments = await Promise.all(
[first, second].map((root) =>
withProtectedExecutableRoots([root], async () => {
const input = { PATH: tools };
- const command = await inspectTrustedExecutable("git", input, []);
+ // Capture both PATHs before either checkout changes a shared link target.
+ const command = await inspectTrustedExecutable(
+ "git",
+ input,
+ [],
+ ).finally(() => {
+ if (--pendingInspections === 0) bothInspected.resolve();
+ });
+ await bothInspected.promise;
const path = command.environment["PATH"]!;
if (root === first) {
expect(command.executable).toBeNull();