chore(dev): drop --heapsnapshot-near-heap-limit auto-dump

That flag was added for diagnosing the Ink/perf_hooks leak. Now that the
leak is fixed, leaving it on means a 1GB+ snapshot file gets dumped to
cwd whenever heap pressure hits — noisy and not useful day-to-day.
Inspector flag forwarding is kept for normal --inspect usage.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-25 10:00:15 -07:00
parent e2bd97bc04
commit 945f62ab0c

View File

@@ -16,12 +16,11 @@ const MEMORY_MB = process.env.FUSION_DEV_MEMORY_MB || "8192";
const { spawn } = await import("child_process");
const rawArgs = process.argv.slice(2);
// --inspect / --inspect-brk / --inspect=PORT enables the Node inspector and
// auto-dumps a heap snapshot just before the heap limit is hit. Strip these
// from forwarded args so they don't reach the dashboard CLI parser. We pass
// them as CLI flags directly to node (NOT via NODE_OPTIONS), because
// NODE_OPTIONS is inherited by every grandchild process — every vitest /
// agent / claude subprocess would then try to bind 9229 and fail.
// --inspect / --inspect-brk / --inspect=PORT enables the Node inspector.
// Strip these from forwarded args so they don't reach the dashboard CLI
// parser. We pass them as CLI flags directly to node (NOT via NODE_OPTIONS),
// because NODE_OPTIONS is inherited by every grandchild process — every
// vitest / agent / claude subprocess would then try to bind 9229 and fail.
const inspectFlags = [];
const args = [];
for (const a of rawArgs) {
@@ -31,12 +30,6 @@ for (const a of rawArgs) {
args.push(a);
}
}
if (inspectFlags.length > 0) {
// 3 = take up to 3 snapshots as we approach the heap limit. Files land in
// CWD as Heap.YYYYMMDD.HHMMSS.PID.NNN.heapsnapshot
inspectFlags.push("--heapsnapshot-near-heap-limit=3");
console.log(`[dev-with-memory] inspector flags: ${inspectFlags.join(" ")}`);
}
// NODE_OPTIONS is shared with every spawned node process (build + run +
// agents). Heap size belongs here. Inspector flags do NOT — see comment above.