Summary#
On Linux, v0.1.13 still starts every Claude agent with a plain fork() of the main server process. #31488 moved git onto the __process-launcher helper, but spawnClaudeProcessGroup calls NodeChildProcess.spawn("/bin/sh", ...) directly (apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts:435-444, used for every non-Windows run at :1832-1851). Claude health probes spawn directly too (apps/server/src/provider/ClaudeProvider.ts:246-260).
The fork copies the server's page tables, so its cost grows with server RSS and it runs on the main thread (same mechanism as #31422).
Measured (v0.1.13, bc0f04da, Linux x64, bpftrace on kernel_clone of the server's main thread)#
- 60 concurrent Claude runs, ~46 agent starts per minute, server RSS ~0.9 GB: each fork 10.1 ms avg (max 22.6 ms), all from the main thread of the main server process; the
__process-launcher helper handled ~2,800 git forks in the same window at 0.25-1 ms each.
- Cost scales at roughly 11-14 µs per MB of server RSS. On an older build whose server grew to 17-20 GB RSS, each fork cost ~230 ms and ~60 forks/min blocked the event loop ~24% of the time, which showed up as disconnects and freezes.
- With the 2-minute idle release (
DEFAULT_IDLE_TIMEOUT_MS, ProviderSessionManager.ts:81-84) an idle thread respawns claude on its next turn, so busy servers start agents often.
Request#
Route spawnClaudeProcessGroup (and the Claude health probe) through the ProcessLauncher helper on Linux, like git, codex and the other providers already are. Optionally expose idleTimeoutMs (already an option at ProviderSessionManager.ts:366) as a setting.
Workaround today#
Keep server RSS small (fresh server homes, rotate before RSS grows) and raise providerHealthRefreshInterval.