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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: tighten worker-crash retry to a stricter no-other-failures check and avoid truncating CI output
[._.]/ Adam Eivyca04f84f399b
diff --git a/scripts/run-ci-tests.js b/scripts/run-ci-tests.jsindex ca42f19dfb..d28d21bd29 100644--- a/scripts/run-ci-tests.js+++ b/scripts/run-ci-tests.js@@ -62,22 +62,34 @@ export function planCrashRetry(scope, output) {}/**- * 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.+ * Vitest's own end-of-run summary lines, e.g.:+ * Test Files 1 failed | 797 passed | 2 skipped (800)+ * Tests 3 failed | 15074 passed | 61 skipped (15145)+ * Errors 1 error+ * The crashed file itself is never counted as "failed" (it errored, not+ * failed — see the fixture in run-ci-tests.test.js) and contributes exactly+ * one unhandled error, so a nonzero "failed" count in either summary, or more+ * than one unhandled error, means a REAL, unrelated problem shared the run.*/const TEST_FILES_SUMMARY_PATTERN = /Test Files\s+([^\n]+)/;+const TESTS_SUMMARY_PATTERN = /\bTests\s+([^\n]+)/;+const ERRORS_SUMMARY_PATTERN = /Errors\s+(\d+)\s+errors?/;/**- * 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.+ * True when the run had a genuine test failure, or more than one unhandled+ * error, 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]);+ const text = String(output || '');+ const filesSummary = TEST_FILES_SUMMARY_PATTERN.exec(text);+ const testsSummary = TESTS_SUMMARY_PATTERN.exec(text);+ const errorsSummary = ERRORS_SUMMARY_PATTERN.exec(text);+ if (!filesSummary || !testsSummary || !errorsSummary) return true;+ if (/\d+\s+failed/.test(filesSummary[1])) return true;+ if (/\d+\s+failed/.test(testsSummary[1])) return true;+ return Number(errorsSummary[1]) !== 1;}export function requiresSourceFiles(mode, repoSources) {@@ -180,8 +192,14 @@ async function spawnNpm(scope, script, extraArgs, label) {return 0;}- console.error(`❌ ${relPath} crashed again on retry — this reproduces, not a runner fluke`);- writeStepEnv('CI_CRASHED_TEST_FILE', relPath);+ if (extractCrashedTestFile(retry.output)) {+ console.error(`❌ ${relPath} crashed again on retry — this reproduces, not a runner fluke`);+ writeStepEnv('CI_CRASHED_TEST_FILE', relPath);+ } else {+ // The retry failed for a different reason (an assertion, a real error) —+ // report it as an ordinary test failure, not a repeat native crash.+ console.error(`❌ ${relPath} failed on retry, but not with the same native crash — treating it as a real failure`);+ }return retry.status || result.status;}@@ -211,15 +229,23 @@ async function main() {if (mode === 'full') {const shard = shardArgs(process.env.CI_SHARD);const label = shard.length ? `full suite shard ${process.env.CI_SHARD}` : 'full suite';- process.exit(await spawnNpm(scope, 'test:ci', shard, label));+ // process.exitCode, not process.exit(): the runner now streams the+ // child's output through this process's own stdout/stderr, and+ // process.exit() can terminate before those writes (and this function's+ // own diagnostic lines) finish flushing. Setting exitCode lets Node drain+ // normally once main() returns.+ process.exitCode = await spawnNpm(scope, 'test:ci', shard, label);+ return;}if (mode === 'files') {if (selectedFiles.length === 0) {console.log(`No ${scope} tests selected.`);- process.exit(0);+ process.exitCode = 0;+ return;}- process.exit(await spawnNpm(scope, 'test:ci', selectedFiles, 'selected tests'));+ process.exitCode = await spawnNpm(scope, 'test:ci', selectedFiles, 'selected tests');+ return;}// Feed Vitest the actual changed source files instead of asking `list@@ -232,12 +258,12 @@ async function main() {// Running them in a second exact-file process repeated any changed test that// already imported the source; on PR #5299 that rebuilt the atlas twice and// added 27.5 seconds after the related run had already passed it.- process.exit(await spawnNpm(+ process.exitCode = await spawnNpm(scope,'test:ci:related',relatedInputs(sourceFiles, selectedFiles),'related and contract tests',- ));+ );}if (isDirectlyInvoked(import.meta.url)) await main();diff --git a/scripts/run-ci-tests.test.js b/scripts/run-ci-tests.test.jsindex e85155fdf9..cb6c24dbf9 100644--- a/scripts/run-ci-tests.test.js+++ b/scripts/run-ci-tests.test.js@@ -187,17 +187,35 @@ 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);+ // The real end-of-run summary block from the crash this fixes (issue 8152):+ // one crashed file counted in neither "Test Files" nor "Tests", and exactly+ // one unhandled error — the crash itself, nothing else.+ const CLEAN_RUN_SUMMARY = [+ 'Test Files 798 passed | 2 skipped (801)',+ ' Tests 15077 passed | 61 skipped (15145)',+ ' Errors 1 error',+ ].join('\n');++ it('reads false from a summary with no failures and exactly one (the crash\'s own) unhandled error', () => {+ expect(hasOtherTestFailures(CLEAN_RUN_SUMMARY)).toBe(false);+ });++ it('reads true when either summary line reports a real failure, whichever order it lists the counts', () => {+ expect(hasOtherTestFailures(CLEAN_RUN_SUMMARY.replace(+ 'Test Files 798 passed', 'Test Files 1 failed | 797 passed',+ ))).toBe(true);+ expect(hasOtherTestFailures(CLEAN_RUN_SUMMARY.replace(+ 'Tests 15077 passed', 'Tests 15076 passed | 1 failed',+ ))).toBe(true);});- 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('reads true when a second, unrelated unhandled error shares the run with the crash', () => {+ expect(hasOtherTestFailures(CLEAN_RUN_SUMMARY.replace('1 error', '2 errors'))).toBe(true);});- it('fails closed (assumes a real failure) when the summary line is missing', () => {+ it('fails closed (assumes a real failure) when any summary line is missing', () => {expect(hasOtherTestFailures('')).toBe(true);+ expect(hasOtherTestFailures('Test Files 798 passed | 2 skipped (801)')).toBe(true);expect(hasOtherTestFailures('some unrelated crash output with no summary at all')).toBe(true);});});