From c6becad2f76c1308d835504486f7afc5a0c975af Mon Sep 17 00:00:00 2001 From: sunrioa <178722768+sunrioa@users.noreply.github.com> Date: Fri, 4 Sep 2026 18:15:27 +0800 Subject: [PATCH] fix(eval): decode file URLs before launching child processes Generated-by: OpenAI Codex --- .../src/__tests__/lifecycle-boundaries.test.ts | 7 +++++-- .../provider-admission-integration.test.ts | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/packages/eval/src/__tests__/lifecycle-boundaries.test.ts b/packages/eval/src/__tests__/lifecycle-boundaries.test.ts index aadcfe8f55..fe84a2d6ec 100644 --- a/packages/eval/src/__tests__/lifecycle-boundaries.test.ts +++ b/packages/eval/src/__tests__/lifecycle-boundaries.test.ts @@ -33,6 +33,7 @@ import { import { tmpdir } from 'node:os'; import { join } from 'node:path'; import test from 'node:test'; +import { fileURLToPath } from 'node:url'; import { promisify } from 'node:util'; import { FileAttemptStore } from '../attempt-store.js'; import type { ExperimentCell, ExperimentSpec, JsonObject } from '../experiment.js'; @@ -601,7 +602,7 @@ test('the Maka shim projects only a completed subject as a zero exit', async () )},shortCircuit:true}:n(s,c)}`, )}",import.meta.url)`, )}`, - shim.pathname, + fileURLToPath(shim), Buffer.from( JSON.stringify({ rootPath: join(root, 'state'), @@ -859,7 +860,9 @@ test('eight-arm spec and wrappers freeze the working provider contracts', async // These subjects run `/usr/bin/true` and never reach the provider, so // each one is an infrastructure failure and exits nonzero: the exit code // now carries the semantic status for the relay's benefit. - const stdout = await execFileAsync(process.execPath, [wrapper.pathname, ...args], { env }) + const stdout = await execFileAsync(process.execPath, [fileURLToPath(wrapper), ...args], { + env, + }) .then((settled) => settled.stdout) .catch((error: { stdout?: string }) => { assert.equal(typeof error.stdout, 'string'); diff --git a/packages/eval/src/__tests__/provider-admission-integration.test.ts b/packages/eval/src/__tests__/provider-admission-integration.test.ts index b1f2890d16..159b8dd829 100644 --- a/packages/eval/src/__tests__/provider-admission-integration.test.ts +++ b/packages/eval/src/__tests__/provider-admission-integration.test.ts @@ -25,6 +25,7 @@ import { createServer } from 'node:http'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; import test from 'node:test'; +import { fileURLToPath } from 'node:url'; import { promisify } from 'node:util'; import { meteringCheckpointMacMatches } from '../metering-checkpoint.js'; @@ -76,7 +77,7 @@ test('provider metering checkpoint records admission before the request settles' const wrapperProcess = spawn( process.execPath, [ - wrapper.pathname, + fileURLToPath(wrapper), 'opencode', `http://127.0.0.1:${address.port}`, root, @@ -163,7 +164,7 @@ test('provider failures remain infrastructure failures until inference admission const wrapper = new URL('../harbor-external-subject.js', import.meta.url); const { stdout, exitCode } = await runWrapper( [ - wrapper.pathname, + fileURLToPath(wrapper), 'opencode', `http://127.0.0.1:${address.port}`, root, @@ -292,7 +293,14 @@ async function executePiWithTerminalRecord(contentBytes: number): Promise<{ try { const wrapper = new URL('../harbor-external-subject.js', import.meta.url); const { stdout } = await runWrapper( - [wrapper.pathname, 'pi', `http://127.0.0.1:${address.port}`, root, process.execPath, child], + [ + fileURLToPath(wrapper), + 'pi', + `http://127.0.0.1:${address.port}`, + root, + process.execPath, + child, + ], { OPENAI_API_KEY: 'upstream-test-key', MAKA_EVAL_RESULT_TOKEN: RESULT_TOKEN }, ); return decodeResultFrame(stdout) as Awaited>; @@ -388,7 +396,7 @@ process.exit(1); const wrapper = new URL('../harbor-external-subject.js', import.meta.url); const { stdout } = await runWrapper( [ - wrapper.pathname, + fileURLToPath(wrapper), 'opencode', `http://127.0.0.1:${address.port}`, root,