buzz icon indicating copy to clipboard operation
buzz copied to clipboard

fix: reduce default parallelism to 1, use lazy pool on manual start

Open Christian-Sidak opened this issue 4 months ago • 0 comments

Summary

  • Change DEFAULT_AGENT_PARALLELISM from 24 to 1 in types.rs
  • Use lazy-pool startup (lazy: true) in start_managed_agent_process to 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_PARALLELISM 24 → 1. Desktop installations should default to a single worker; higher parallelism remains available as an explicit setting.
  • runtime.rs: start_managed_agent_process now passes lazy: true to spawn_agent_child, deferring pool initialization until the first event arrives.
  • types/tests.rs: two regression tests pinning DEFAULT_AGENT_PARALLELISM == 1 and verifying legacy records without an explicit parallelism field deserialize to 1.

Test plan

  • [x] default_agent_parallelism_is_one -- asserts DEFAULT_AGENT_PARALLELISM == 1
  • [x] managed_agent_record_without_parallelism_defaults_to_one -- legacy JSON without a parallelism key deserializes to 1
  • [x] Verified BUZZ_ACP_LAZY_POOL=true is already used by spawn_agent_child when lazy=true (runtime.rs line 1722), so the env-var path is covered by the existing harness

Fixes #2631

Christian-Sidak avatar Jul 24 '26 04:07 Christian-Sidak