From b22ecc7aaea45c669d7e07e47157a3003bd594cf Mon Sep 17 00:00:00 2001 From: "James L. Cowan Jr." <112015792+jameslcowan@users.noreply.github.com> Date: Thu, 12 Nov 2026 14:34:05 -0300 Subject: [PATCH] fix(bench): ignore EPIPE when an agent exits before it reads stdin Problem: "a mock run records one row per arm with the edit the agent made" failed on the Windows Node 24 leg of run 43267718210 (2026-11-12). bench/run.mjs ended the child's stdin after spawn; the mock agent exited before it read it, the write failed with EPIPE, and the stream had no error handler. The harness process died with an unhandled 'error' event and exit code 1, before it recorded any row. The same commit passed on the other 5 legs. Change: the child's stdin gets an error handler that ignores the failed write. The run still records the agent's exit code, output and result, so a closed pipe is not lost information. bench/agent-events.mjs, which moves with this file, reads the agent's output and needed no change. Intent: a scripted agent that exits early gives a recorded row, not a crashed harness and a red CI leg. Assisted-by: Claude --- bench/run.mjs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bench/run.mjs b/bench/run.mjs index 9a34ab7..cbaf53c 100644 --- a/bench/run.mjs +++ b/bench/run.mjs @@ -295,6 +295,11 @@ async function runAgent(task, arm, wt) { const pid = proxy && sig !== 'SIGKILL' ? innerPid(child.pid) : null; try { if (pid) process.kill(pid, sig); else child.kill(sig); } catch {} }; + /* An agent that exits before it reads stdin closes the pipe, and the + write fails with EPIPE. Its exit code and output are recorded + below, so the failed write is not the run's error. Unhandled, it + ended the harness (seen with the mock agent on Windows). */ + child.stdin.on('error', () => {}); child.stdin.end(SCRIPTED[agent] ? '' : PROMPT(task)); const transcript = []; const { m, onEvent } = createMeter({ wt, gold: task.gold, stopAt });