osborn 0.9.260 → 0.9.261
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +14 -2
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -99,8 +99,20 @@ if (existsSync(srcPath)) {
|
|
|
99
99
|
env: process.env,
|
|
100
100
|
})
|
|
101
101
|
} else if (existsSync(distPath)) {
|
|
102
|
-
// Production: run compiled JS directly
|
|
103
|
-
|
|
102
|
+
// Production: run compiled JS directly.
|
|
103
|
+
// HEAP-OOM CRASH FIX (0.9.261): long heavy sessions (big context + many
|
|
104
|
+
// sub-agents) grew the MAIN process past its default V8 old-space limit
|
|
105
|
+
// (~2GB), and a barge-in interrupt tipped it over → "FATAL ERROR: Reached
|
|
106
|
+
// heap limit" → process crash → Fly restart → session lost. Observed 3x in
|
|
107
|
+
// one day, always `🔇 Speech interrupted` → heap OOM. Give the main process a
|
|
108
|
+
// heap limit scaled to the machine's RAM (~half), so it has real headroom and
|
|
109
|
+
// AUTO-SCALES if the machine's memory is bumped. Passed as a node ARGV flag —
|
|
110
|
+
// NOT NODE_OPTIONS — so it applies ONLY to the main process and is NOT
|
|
111
|
+
// inherited by the Claude SDK sub-agent subprocesses (which would multiply
|
|
112
|
+
// memory use and cause a system OOM instead).
|
|
113
|
+
const heapMB = Math.max(3072, Math.floor((os.totalmem() / (1024 * 1024)) * 0.5))
|
|
114
|
+
console.log(`[cli] main agent --max-old-space-size=${heapMB}MB (machine RAM ${Math.round(os.totalmem() / (1024 * 1024))}MB)`)
|
|
115
|
+
child = spawn('node', [`--max-old-space-size=${heapMB}`, distPath, mode, ...args], {
|
|
104
116
|
stdio: 'inherit',
|
|
105
117
|
cwd: join(__dirname, '..'),
|
|
106
118
|
env: process.env,
|