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(sdk): release native provider probe pipes on cleanup (#2393)

Michael D'Angelo24527f3b0edd
diff --git a/sdk/typescript/tests-ts/api-provider-isolation.test.ts b/sdk/typescript/tests-ts/api-provider-isolation.test.ts
index f7790143d..ca099c8e5 100644
--- a/sdk/typescript/tests-ts/api-provider-isolation.test.ts
+++ b/sdk/typescript/tests-ts/api-provider-isolation.test.ts
@@ -65,7 +65,8 @@ async function nativeRequest(
let timedOut = false;
const timer = setTimeout(() => {
timedOut = true;
- child.kill();
+ // A descendant may retain stdout, so EOF cannot be the signal to stop reading.
+ lines.close();
}, probeTimeoutMs);
const send = (message: unknown) =>
child.stdin.write(JSON.stringify(message) + "\n");
@@ -94,6 +95,9 @@ async function nativeRequest(
} finally {
clearTimeout(timer);
lines.close();
+ // Bun on Windows can keep these pipes open after the app-server process exits.
+ child.stdout.destroy();
+ child.stderr.destroy();
child.kill();
await closed;
}