From e7017a9ce2d5aba0ba97d337da3fb55b1eeda448 Mon Sep 17 00:00:00 2001 From: JUN <243035832+lidge-jun@users.noreply.github.com> Date: Thu, 29 Oct 2026 15:23:40 +0900 Subject: [PATCH] test(windows): use a never-allocated PID for the pending-child recovery fixture A reused exited-child PID made the recovery parent look alive, so recovery fenced before the publication stage the failure-fence cases inject into (dev batch 40824593871). --- .../codex-cli-update-windows-pending.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/codex-integration/codex-cli-update-windows-pending.test.ts b/tests/codex-integration/codex-cli-update-windows-pending.test.ts index b38c7347855..8e783c50996 100644 --- a/tests/codex-integration/codex-cli-update-windows-pending.test.ts +++ b/tests/codex-integration/codex-cli-update-windows-pending.test.ts @@ -1,5 +1,4 @@ import { afterEach, beforeAll, beforeEach, expect, spyOn, test } from "bun:test"; -import { spawnSync } from "node:child_process"; import { existsSync, mkdirSync, statSync, writeFileSync } from "node:fs"; import { join } from "node:path"; import * as ffi from "bun:ffi"; @@ -23,9 +22,12 @@ type RecordBody = { version: number; token: string; parentPid: number; phase: st windows: { jobName: string; creationTime: string | null } }; beforeAll(() => { if (!native) return; - const child = spawnSync(process.execPath, ["-e", "console.log(process.pid)"], { encoding: "utf8", windowsHide: true }); - expect(child.status).toBe(0); deadPid = Number(child.stdout.trim()); - expect(() => process.kill(deadPid, 0)).toThrow(); + // A PID that must stay dead for the whole file. The PID of an exited child is not: hosted Windows + // reuses PIDs quickly, and a reused parent PID made recovery fence before the publication step + // these cases inject into (dev batch 40824593871). Windows PIDs are multiples of 4 and are never + // allocated this high, so the value stays dead while remaining a valid in-range record PID. + deadPid = 0x7ffffffc; + expect(() => process.kill(deadPid, 0)).toThrow(expect.objectContaining({ code: "ESRCH" })); }); beforeEach(async () => { if (!native) return;