feat: implement fail-fast monitoring to stop as soon as error/traceback is detected
Lint / pre-commit Linting (push) Successful in 42s
Test / Run Tests (push) Successful in 1m3s

This commit is contained in:
2026-05-16 18:28:54 +02:00
parent 55a9fc027d
commit b6cef04a9c
4 changed files with 66 additions and 2 deletions
+9 -1
View File
@@ -224,9 +224,10 @@ export async function pollUntilDone(
shard,
intervalMs,
onProgress,
shouldStop = () => false,
) {
let elapsed = 0;
while (elapsed < targetTicks) {
while (elapsed < targetTicks && !shouldStop()) {
await sleep(intervalMs);
const { time } = await api.time(shard);
elapsed = time - startTick;
@@ -332,6 +333,13 @@ export async function monitorConsole(api, opts) {
lastProgressTick = elapsed;
}
},
() => {
// Fail-fast logic: stop monitoring if any 'fail' action is triggered
if (opts.onTraceback === "fail" && state.sawTraceback) return true;
if (opts.onErrorLog === "fail" && state.sawErrorLog) return true;
if (opts.onWarningLog === "fail" && state.sawWarningLog) return true;
return false;
},
);
} finally {
// ── Step 5: always disconnect cleanly ────────────────────────────────