feat(acp): host-wide session pool with fleet slot cap, idle close and DM auto-publish - #7273
Open
gruming wants to merge 2 commits into
Open
feat(acp): host-wide session pool with fleet slot cap, idle close and DM auto-publish#7273gruming wants to merge 2 commits into
gruming wants to merge 2 commits into
Conversation
🔐 Codex Security Review
|
… DM auto-publish Memory on a multi-harness host scales with live ACP sessions (each is a `claude` process plus its MCP servers), not with harness count. This adds a connection-pool style cap and idle reclamation so 25 harnesses fit on one host: - `--fleet-slots N` / `--fleet-slot-dir`: host-wide cap on live sessions, shared by every harness via one flock(2)ed file per slot, so the kernel releases a dead harness's slots. Work that finds every slot held waits in the channel queue instead of failing. - `--session-idle-close S`: close a channel session (releasing its slot) after S seconds without a turn; the next event starts a fresh session. - `--min-agents M`: start only M subprocesses eagerly; the rest of `--agents` spawn on demand when every started agent is busy and shut down again after the idle bound. - `--dm-autopublish` (default on): in DM channels, when a turn ends without the agent having published, post its trailing reply text so the human never gets silence. Skipped when the agent already posted in that turn; channel turns are unaffected. All flags default off (autopublish on) so existing deployments are unchanged. README documents the flags and a 25-harness / 32 GB example. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: gruming <tnalsl1984@naver.com>
gruming
force-pushed
the
feat/acp-session-pool
branch
from
September 3, 2026 06:38
2b5fd9b to
5727813
Compare
Align the DM auto-publish flag with the pool flags: every new flag in this change now defaults off, so a deployment that passes none of them behaves exactly like upstream. Set BUZZ_ACP_DM_AUTOPUBLISH=true (or --dm-autopublish true) to enable it. README default updated and the CLI default test now covers the flag. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: gruming <tnalsl1984@naver.com>
gruming
marked this pull request as ready for review
September 4, 2026 06:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Memory on a host running many
buzz-acpharnesses scales with live ACP sessions (forclaude-agent-acp, oneclaudeprocess plus its MCP servers each), not with harness count. This PR adds a connection-pool style cap and idle reclamation so a fleet of 25 harnesses fits on one 32 GB host, plus a DM safety net.--fleet-slots N/--fleet-slot-dir(BUZZ_ACP_FLEET_SLOTS,BUZZ_ACP_FLEET_SLOT_DIR): host-wide cap on live sessions shared by every harness. Oneflock(2)ed file per slot, so the kernel releases a dead harness's slots. Work that finds every slot held waits in the channel queue rather than failing (crates/buzz-acp/src/fleet.rs, new).--session-idle-close S(BUZZ_ACP_SESSION_IDLE_CLOSE): close a channel session, releasing its slot, afterSseconds without a turn; the next event in that channel starts a fresh session.--min-agents M(BUZZ_ACP_MIN_AGENTS): start onlyMsubprocesses eagerly; the rest of--agentsspawn on demand when every started agent is busy and channels are waiting, and shut down again after the idle bound.--dm-autopublish(BUZZ_ACP_DM_AUTOPUBLISH, defaultfalse): in DM channels, when a turn ends without the agent having runbuzz messages send, post the agent's trailing reply text as a top-level message so the human never gets silence. Skipped when the agent already posted in that turn (relay lookup, fails closed); channel turns are unaffected.All new flags — the pool flags and
--dm-autopublish— default off, so existing deployments are unchanged. README documents the flags and the fleet example (--agents 8 --min-agents 1 --fleet-slots 20 --session-idle-close 600).Key decisions / trade-offs
flocked files rather than a shared counter so a crashed harness can never leak capacity. This is Unix-only;fleet.rsrefuses to start with--fleet-slots > 0whereflockis unavailable.Relation to #6732 (per-thread sessions)
main(40220d5). A "live session" is keyed bySessionScope, so under the default--session-policy channelbehavior is per channel; underthreadpolicy fleet slots and idle close apply per thread session automatically (a busy thread keeps its context, quiet ones return their slot). On-demand sizing counts distinct pending scopes.UuidtoSessionScope.Deferred / follow-up
--session-idle-close/--fleet-slotshelp text still says "channel session"; accurate under the default policy, could be softened to "session" if thread policy becomes the default.Related issue
Addresses the memory growth in #2961 (per-channel sessions never released) and #4577 (subprocesses never reaped) by bounding and reclaiming live sessions host-wide. No existing PR found for a fleet-wide session cap; #7173 and #5982 touch idle/rotation handling but not a shared cap.
Testing
cargo fmt -p buzz-acp --check,cargo clippy -p buzz-acp --all-targets -- -D warnings: clean.cargo test -p buzz-acp: 924 passed, 0 failed (plus 9 integration tests intests/pool_lifecycle_state.rs; doc-tests: 0), on the rebased commit (new unit tests for fleet slots, min-agents resolution, idle close anddm_autopublish_wanted). Note:CliArgstests readBUZZ_ACP_*from the environment like the existing ones, so run them with those variables unset.just ci(this host has no GTK/WebKitGTK toolchain for the desktop crates); only thebuzz-acpcrate was touched.🤖 Generated with Claude Code