buzz
buzz copied to clipboard
fix: reduce default parallelism to 1, use lazy pool on manual start
Summary
- Change
DEFAULT_AGENT_PARALLELISMfrom 24 to 1 intypes.rs - Use lazy-pool startup (
lazy: true) instart_managed_agent_processto match launch-time restore behavior
Problem
With the default parallelism of 24, starting agents eagerly initializes the full worker pool via spawn_agent_child(..., false, ...). With Codex ACP backends, each worker spawns multiple processes (adapter + app-server chain), resulting in ~220 idle processes and ~14 GB RSS for just four agents -- before any work arrives.
The launch-time restore path already uses lazy: true with an explicit comment ("eager restore... silently reintroduces N idle brains on every launch"). The manual-start path lacked the same protection.
Changes
types.rs:DEFAULT_AGENT_PARALLELISM24 → 1. Desktop installations should default to a single worker; higher parallelism remains available as an explicit setting.runtime.rs:start_managed_agent_processnow passeslazy: truetospawn_agent_child, deferring pool initialization until the first event arrives.types/tests.rs: two regression tests pinningDEFAULT_AGENT_PARALLELISM == 1and verifying legacy records without an explicit parallelism field deserialize to 1.
Test plan
- [x]
default_agent_parallelism_is_one-- assertsDEFAULT_AGENT_PARALLELISM == 1 - [x]
managed_agent_record_without_parallelism_defaults_to_one-- legacy JSON without aparallelismkey deserializes to 1 - [x] Verified
BUZZ_ACP_LAZY_POOL=trueis already used byspawn_agent_childwhenlazy=true(runtime.rs line 1722), so the env-var path is covered by the existing harness
Fixes #2631