From 7b6376ced3c2067eae3d11d960ee2a6cfb8a07b4 Mon Sep 17 00:00:00 2001 From: Willem Date: Tue, 6 Oct 2026 18:46:26 +0200 Subject: [PATCH] test(electron): provider-switch-context reads only complete log lines readPrompts JSON-parsed every line of a log the fake agent was still appending to; waitFor polls it, so under full-suite load a half-written last line threw and failed the test (seen on three verification runs). Co-Authored-By: Claude Opus 5.5 --- electron/test/provider-switch-context.test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/electron/test/provider-switch-context.test.js b/electron/test/provider-switch-context.test.js index b071f1262..73aa34f1b 100644 --- a/electron/test/provider-switch-context.test.js +++ b/electron/test/provider-switch-context.test.js @@ -67,11 +67,13 @@ process.stdout.write("ok"); return `${process.execPath} -e eval(Buffer.from('${hex}','hex').toString())`; } +// Only complete lines: the fake agent may still be appending the last one, and +// waitFor polls this under load, so a half-written tail must not throw. function readPrompts(logFile) { return fs .readFileSync(logFile, "utf8") - .trim() .split("\n") + .slice(0, -1) .map((l) => JSON.parse(l)); }