Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

cli tests: run vitest on half the machine's cores

0xken15b5bfc72637f2
diff --git a/cli/vitest.config.ts b/cli/vitest.config.ts
index 55bd13d77..e16ae431e 100644
--- a/cli/vitest.config.ts
+++ b/cli/vitest.config.ts
@@ -1,3 +1,4 @@
+import { availableParallelism } from 'node:os'
import { defineConfig } from 'vitest/config'
export default defineConfig({
@@ -6,7 +7,8 @@ export default defineConfig({
setupFiles: ['./vitest.setup.ts'],
include: ['src/**/*.test.ts', 'src/**/*.spec.ts'],
// These suites spawn real shells, hooks and tmux helpers with bounded
- // deadlines. One worker per CPU starves those children on busy hosts.
- maxWorkers: 4,
+ // deadlines. One worker per CPU starves those children on busy hosts, so
+ // take half the machine: the other half is theirs.
+ maxWorkers: Math.max(1, Math.floor(availableParallelism() / 2)),
},
})