Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: never mask a real test failure behind a recovered worker-crash retry

[._.]/ Adam Eivy7b5c60dbdf51
diff --git a/scripts/run-ci-tests.js b/scripts/run-ci-tests.js
index 8d76725f0f..ca42f19dfb 100644
--- a/scripts/run-ci-tests.js
+++ b/scripts/run-ci-tests.js
@@ -61,6 +61,25 @@ export function planCrashRetry(scope, output) {
return { retry: true, relPath, selector: toRunnerPath(scope, relPath) };
}
+/**
+ * Vitest's own "Test Files" summary line, e.g. `Test Files 1 failed | 797
+ * passed | 2 skipped (800)`. The crashed file itself is never counted here
+ * (it errored, not failed — see the fixture in run-ci-tests.test.js), so a
+ * nonzero "failed" count means a REAL, unrelated assertion failure shared the
+ * run with the crash.
+ */
+const TEST_FILES_SUMMARY_PATTERN = /Test Files\s+([^\n]+)/;
+
+/**
+ * True when the run had a genuine test failure alongside (or instead of) a
+ * worker crash. A missing summary line fails closed (treated as "yes, there
+ * were other failures") so a parsing miss can never mask a real regression.
+ */
+export function hasOtherTestFailures(output) {
+ const summary = TEST_FILES_SUMMARY_PATTERN.exec(String(output || ''));
+ return !summary || /\d+\s+failed/.test(summary[1]);
+}
+
export function requiresSourceFiles(mode, repoSources) {
return mode === 'related' && repoSources.length === 0;
}
@@ -151,6 +170,12 @@ async function spawnNpm(scope, script, extraArgs, label) {
const retry = await runNpm(scope, script, [selector]);
recordVitestDuration(scope, `crash retry: ${relPath}`, retryStartedAt);
if (!retry.error && retry.status === 0) {
+ if (hasOtherTestFailures(result.output)) {
+ // The crash retry only clears the crash itself — a real assertion
+ // failure elsewhere in the same run must still fail the job.
+ console.error(`❌ ${relPath}'s worker crash recovered on retry, but the run also has a real test failure — not masking it`);
+ return result.status;
+ }
console.log(`✅ ${relPath} passed on retry — treating the original worker crash as a runner fault, not a regression`);
return 0;
}
diff --git a/scripts/run-ci-tests.test.js b/scripts/run-ci-tests.test.js
index dc84f7204d..e85155fdf9 100644
--- a/scripts/run-ci-tests.test.js
+++ b/scripts/run-ci-tests.test.js
@@ -5,6 +5,7 @@ import { afterEach, describe, expect, it } from 'vitest';
import {
extractCrashedTestFile,
+ hasOtherTestFailures,
planCrashRetry,
recordVitestDuration,
relatedInputs,
@@ -185,6 +186,22 @@ describe('planCrashRetry', () => {
});
});
+describe('hasOtherTestFailures', () => {
+ it('reads false only from a clean "Test Files" summary with no failed count', () => {
+ expect(hasOtherTestFailures('Test Files 798 passed | 2 skipped (801)')).toBe(false);
+ });
+
+ it('reads true when the summary reports a real failure, whichever order it lists the counts', () => {
+ expect(hasOtherTestFailures('Test Files 1 failed | 797 passed | 2 skipped (800)')).toBe(true);
+ expect(hasOtherTestFailures('Test Files 797 passed | 1 failed (798)')).toBe(true);
+ });
+
+ it('fails closed (assumes a real failure) when the summary line is missing', () => {
+ expect(hasOtherTestFailures('')).toBe(true);
+ expect(hasOtherTestFailures('some unrelated crash output with no summary at all')).toBe(true);
+ });
+});
+
describe('relatedInputs', () => {
it('runs source-related tests and explicit guards in one deduplicated invocation', () => {
expect(relatedInputs(