From 592ba16dba74aa906153c4b60a7aba546deb8f55 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Thu, 17 Sep 2026 01:22:12 -0700 Subject: [PATCH] test(codex): expect the neutral JSON reply in the Windows hook test The managed Codex hook now answers with `{}` on every path, POSIX and Windows alike. The POSIX test was updated with that change; this one was not, because it is skipped off Windows and only runs inside the packaging job, so a local suite run stays green either way. Expect the neutral reply where the script actually runs. The script-removed case keeps an empty stdout: the echo cannot run when the script is gone. --- src/main/codex/windows-hook-command.test.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/codex/windows-hook-command.test.ts b/src/main/codex/windows-hook-command.test.ts index d1fc2c8b098..e3c3daa9c47 100644 --- a/src/main/codex/windows-hook-command.test.ts +++ b/src/main/codex/windows-hook-command.test.ts @@ -111,7 +111,10 @@ describe.skipIf(process.platform !== 'win32')('Codex hook delivery through Power .map((payload) => invoke(getManagedCommand(scriptPath), payload)) ) for (const result of results) { - expect(result).toMatchObject({ code: 0, stdout: '', stderr: '', timedOut: false }) + expect(result).toMatchObject({ code: 0, stderr: '', timedOut: false }) + // Why: the managed script answers Codex with a neutral JSON object, the same + // contract the POSIX runner emits; cmd's echo appends CRLF. + expect(result.stdout.trim()).toBe('{}') } } expect(posts).toHaveLength(CODEX_EVENTS.length) @@ -122,12 +125,10 @@ describe.skipIf(process.platform !== 'win32')('Codex hook delivery through Power expect(post.get('worktreeId')).toBe(env.ORCA_WORKTREE_ID) } await new Promise((resolve) => server.close(() => resolve())) - expect(await invoke(getManagedCommand(scriptPath), payloads[0])).toMatchObject({ - code: 0, - stdout: '', - stderr: '', - timedOut: false - }) + const afterServerClosed = await invoke(getManagedCommand(scriptPath), payloads[0]) + expect(afterServerClosed).toMatchObject({ code: 0, stderr: '', timedOut: false }) + // The script still runs with Orca context, so it still answers with neutral JSON. + expect(afterServerClosed.stdout.trim()).toBe('{}') rmSync(scriptPath) expect(await invoke(getManagedCommand(scriptPath), payloads[0])).toMatchObject({ code: 0,