Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion desktop/src-tauri/src/managed_agents/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,10 @@ fn child_rust_log_filter() -> String {
}
}

fn manual_start_uses_lazy_pool() -> bool {
true
}

pub fn start_managed_agent_process(
app: &AppHandle,
record: &mut ManagedAgentRecord,
Expand Down Expand Up @@ -998,7 +1002,16 @@ pub fn start_managed_agent_process(
// Scalar PIDs are migration-only and never establish pair liveness.
record.runtime_pid = None;

let mut process = spawn_agent_child(app, record, &key.relay_url, false, owner_hex)?;
// Manual starts and config-driven restarts must match launch restore's
// lazy behavior. Eager startup reserves every configured ACP slot before
// an event arrives, multiplying idle child processes across a fleet.
let mut process = spawn_agent_child(
app,
record,
&key.relay_url,
manual_start_uses_lazy_pool(),
owner_hex,
)?;
let now = now_iso();
let receipt = super::ManagedAgentRuntimeReceipt {
key: key.clone(),
Expand Down
5 changes: 5 additions & 0 deletions desktop/src-tauri/src/managed_agents/runtime/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
use crate::managed_agents::known_acp_runtime;

#[test]
fn manual_start_defers_agent_pool_initialization() {
assert!(super::manual_start_uses_lazy_pool());
}

// ── desktop binary name tests ───────────────────────────────────────────

#[test]
Expand Down
2 changes: 1 addition & 1 deletion desktop/src-tauri/src/managed_agents/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ pub struct UpdateTeamRequest {
pub const DEFAULT_ACP_COMMAND: &str = "buzz-acp";
/// ~5 min (320s) — matches the CLI harness default (BUZZ_ACP_IDLE_TIMEOUT).
pub const DEFAULT_AGENT_TURN_TIMEOUT_SECONDS: u64 = 320;
pub const DEFAULT_AGENT_PARALLELISM: u32 = 10;
pub const DEFAULT_AGENT_PARALLELISM: u32 = 1;

fn default_agent_parallelism() -> u32 {
DEFAULT_AGENT_PARALLELISM
Expand Down
9 changes: 9 additions & 0 deletions desktop/src-tauri/src/managed_agents/types/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,3 +694,12 @@ fn mint_rejects_out_of_range_input_parallelism() {
"input-branch error must not blame the definition: {err}"
);
}

#[test]
fn managed_agent_parallelism_defaults_to_one() {
assert_eq!(
super::DEFAULT_AGENT_PARALLELISM,
1,
"one idle managed identity must not eagerly reserve multiple ACP runtimes",
);
}