Skip to content

Desktop/buzz-acp: idle pool teardown is a hidden 15-minute constant; expose it per agent and refresh the idle clock on turn completion #7

Open

Description

@spiritabsolute

TL;DR: Desktop hard-codes BUZZ_ACP_IDLE_POOL_SLEEP=900 for agents and forbids overriding the key; after 15 minutes of "idle" time the harness tears down the whole worker pool together with all of the agent's sessions. The idle clock is refreshed only when a turn is dispatched, so a turn longer than 15 minutes loses its session right after it completes. We propose exposing the value in the agent card, porting upstream PR block#7173 and unifying the lazy flag across all launch paths.

Problem

Desktop launches every managed buzz-acp with BUZZ_ACP_LAZY_POOL=true and BUZZ_ACP_IDLE_POOL_SLEEP=900 (desktop/src-tauri/src/managed_agents/agent_env.rs:16, const IDLE_POOL_SLEEP_SECS: &str = "900"). The key is on RESERVED_ENV_KEYS (reserved_env_keys.rs:65), so Edit agent → Advanced → Environment variables rejects it, and there is no UI field. After 900 s without a dispatched turn the reaper tears the whole pool down (crates/buzz-acp/src/lib.rs, inactivity_expired at lib.rs:2196, "idle pool sleep bound reached — tearing pool back to lazy state") and with it the sessions map of every thread and channel this agent serves.

Two aggravating details:

  1. The idle clock only moves on dispatch. last_activity is set at lib.rs:2894 (start), lib.rs:3636 (teardown) and lib.rs:4903 (dispatch). Turn completion does not refresh it. A turn that runs longer than 15 minutes is "idle" the moment it finishes and is reaped on the next 30-second tick. Observed 2026-09-29: dispatch 07:11:01, last reply 07:25:13, teardown 07:26:16 — one minute after the agent stopped talking.
  2. Behaviour depends on how the agent was started. Agents spawned by the mention preflight path run with BUZZ_ACP_LAZY_POOL=false, IDLE_POOL_SLEEP=0 (observed in /proc/<pid>/environ on 2026-09-30: one agent eager, the four agents started via Start/Restart/launch-restore lazy with 900). So the same agent either never sleeps or sleeps after 15 minutes, undocumented, decided by which button spawned it. Note also that BUZZ_ACP_LAZY_POOL itself is not reserved, which upstream feat(buzz-acp): make BUZZ_ACP_IDLE_POOL_SLEEP configurable per agent, or document why it must not be block/buzz#6381 points out as a side door.

Why it matters

Session state is unrecoverable once the pool is gone (see the companion resume issue). For a human who steps away for 20 minutes, or for an agent that runs a 20-minute test suite, the reset is silent: the next mention gets a fresh session with 12 thread messages and no memory of what it was doing. The team's current workaround is a verbal protocol ("pause, we'll continue in the next session") plus hand-written handoff files.

Proposal

  1. Expose the value. Remove BUZZ_ACP_IDLE_POOL_SLEEP from RESERVED_ENV_KEYS, or better, add an "Idle pool sleep (seconds, 0 = never)" field next to Parallelism in Edit agent → Advanced and in global agent defaults, the way Parallelism is exposed while BUZZ_ACP_AGENTS stays reserved. Keep 900 as the default.
  2. Refresh the idle clock on turn completion and steer ack. Port upstream PR fix(buzz-acp): refresh idle clocks on turn completion and steer ack block/buzz#7173 (lib.rs +191, head 91957a54, OPEN since 2026-09-01).
  3. One lifetime policy for all spawn paths. Start, Restart, launch restore and the mention-preflight spawn should pass the same lazy flag (today runtime_commands.rs:227 and restore.rs pass lazy=true, commands/agents.rs preflight passes lazy=false).
  4. Log the teardown as an agent activity event so it is visible in the UI, not only in the harness log.

Cost to document in the UI: a warm pool is BUZZ_ACP_AGENTS (10) worker subprocesses at ~100 MB RSS each, ≈1 GB per awake agent. With 0 the pool lives until Restart or Desktop exit.

Benefit

Owners choose the trade-off (RAM vs. context survival) per agent instead of a hidden 15-minute constant; long turns stop killing their own session; identical behaviour regardless of how the agent was spawned.

References

Activity

  1. spiritabsolute commented on Oct 20, 2026

    @spiritabsolute
    CollaboratorAuthor

    PR #15 is accepted and merged into main as 258fba8eb89a67451806b4ff4e984981d0432d13. It includes completion-driven idle-clock refresh, session continuity, visible state and scoped context controls.

    This issue remains open: configurable idle-sleep settings and unified startup/lifetime policy are outside that accepted scope. This comment does not claim those remaining requirements are implemented. Further work should be a separate task; #25 fan-out recovery also remains separate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions