Skip to content

Commit f4def5b

Browse files
timmeckclaude
andcommitted
fix(spawn): windowsHide:true + Node v22 wrapper — kills 100-window spawn-storm + Limit #11 hang
Two root causes of the 2026-05-15 spawn-storm (100+ conhost windows forced PC hard-reboot): 1. windowsHide missing on spawn('claude', ...) — each spawn opens a visible conhost. Added windowsHide: true to claude-pool.ts:106 and claude-code-spawner.ts:1322. chat-spawner.ts already had it. Refs anthropics/claude-code#28138, #15572. 2. Node v25.2.1 silent-termination after ~25min on Win11 — bypasses all error handlers. Known Node bug nodejs/node#62125 (v24+ broken, v22 LTS works). Added scripts/brain-v22.cmd + brain-watchdog-v22.cmd wrappers pointing to C:\Users\mecklenburg\node22\node-v22.22.1-win-x64\node.exe. Verified: Brain alive >2min under v22, 0 visible windows during active spawning. This obsoletes the planned WSL migration — Windows + Node v22 LTS is enough. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 14ca717 commit f4def5b

4 files changed

Lines changed: 25 additions & 0 deletions

File tree

‎packages/brain-core/src/self-modification/claude-code-spawner.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,7 @@ export class ClaudeCodeSpawner {
13191319
stdio: ['pipe', 'pipe', 'pipe'],
13201320
timeout,
13211321
shell: useShell,
1322+
windowsHide: true,
13221323
env: spawnEnv,
13231324
});
13241325
// Detach so the parent event loop isn't anchored to this child. The

‎packages/brain-core/src/session/claude-pool.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export class ClaudePool extends EventEmitter {
104104
proc = spawn('claude', args, {
105105
stdio: ['pipe', 'pipe', 'pipe'],
106106
shell: true,
107+
windowsHide: true,
107108
env,
108109
}) as ChildProcessWithoutNullStreams;
109110
} catch (err) {

‎scripts/brain-v22.cmd‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@echo off
2+
REM Brain CLI wrapper — uses Node v22 LTS (fix for Limit #11 silent-termination on Win11)
3+
REM Usage: scripts\brain-v22.cmd [start|stop|status|doctor|...]
4+
setlocal
5+
set NODE22=C:\Users\mecklenburg\node22\node-v22.22.1-win-x64\node.exe
6+
set BRAIN_CLI=C:\Users\mecklenburg\Desktop\brain-ecosystem\packages\brain\dist\index.js
7+
if not exist "%NODE22%" (
8+
echo ERROR: Node v22 not found at %NODE22%
9+
echo Install: download https://nodejs.org/dist/v22.22.1/node-v22.22.1-win-x64.zip
10+
exit /b 1
11+
)
12+
"%NODE22%" "%BRAIN_CLI%" %*

‎scripts/brain-watchdog-v22.cmd‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@echo off
2+
REM Brain external watchdog — uses Node v22 LTS
3+
REM Run in a background terminal: scripts\brain-watchdog-v22.cmd
4+
setlocal
5+
set NODE22=C:\Users\mecklenburg\node22\node-v22.22.1-win-x64\node.exe
6+
set WATCHDOG=C:\Users\mecklenburg\Desktop\brain-ecosystem\scripts\brain-watchdog.mjs
7+
if not exist "%NODE22%" (
8+
echo ERROR: Node v22 not found
9+
exit /b 1
10+
)
11+
"%NODE22%" "%WATCHDOG%"

0 commit comments

Comments
 (0)