fix(buzz-acp): refresh idle clocks on turn completion and steer ack - #7173
Open
Stalker23b wants to merge 2 commits into
Open
fix(buzz-acp): refresh idle clocks on turn completion and steer ack#7173Stalker23b wants to merge 2 commits into
Stalker23b wants to merge 2 commits into
Conversation
The idle-pool sleep and exit-after-inactivity clocks were only refreshed at dispatch, so any turn longer than the idle bound was torn down on the first reaper tick after it completed — killing the CLI process together with its live background tasks and pending wake-ups (observed in production: a 28-minute turn ended and the pool was reaped 13 seconds later, orphaning two background tasks whose completion the agent was waiting on). Turn completion and steer acks now count as activity. Heartbeat results are excluded: heartbeat dispatch is gated on an idle slot with no flushable work, so counting them would keep a heartbeat-enabled pool awake forever. Signed-off-by: Stalker23b <stalker.23b@gmail.com> Co-authored-by: Пчелинский <pchelinsky@agents.buzz.local> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Review findings: - The refresh now lives inside handle_prompt_result, so the unit tests covering that function also guard the wiring — previously deleting the call-site line left the suite green. - result_refreshes_idle_clock uses an exhaustive match: a new PromptSource variant must decide explicitly whether its completion keeps the pool alive. - Corrected the heartbeat comment: dispatch is gated on an idle slot with no flushable work (not "only into an idle pool" — in a multi-agent pool a heartbeat can fire while another agent's turn is live). - Two wiring tests: a channel result refreshes the idle clock through handle_prompt_result; a heartbeat result leaves it stale. Signed-off-by: Stalker23b <stalker.23b@gmail.com> Co-authored-by: Пчелинский <pchelinsky@agents.buzz.local> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
🔐 Codex Security Review
|
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.
Fixes #7171
Problem
The idle-pool reaper clocks (idle-pool sleep, exit-after-inactivity) are refreshed only at dispatch time. Any turn that runs longer than the idle bound is guaranteed to look idle the moment it completes, so the first reaper tick after completion tears the pool down — killing the CLI process together with its live background tasks and pending wake-ups.
Observed in production: a 28-minute turn completed and the pool was reaped 13 seconds later, orphaning two background tasks whose completion the agent was waiting on (details in #7171).
Fix
Turn completion and steer acks now count as activity:
handle_prompt_result, so the existing unit tests around result handling also guard the wiring.matchonPromptSource: a new variant must explicitly decide whether its completion keeps the pool alive.Known edges (unchanged, noted for reviewers)
max_turn_duration + 100s; a turn exceeding it auto-expires and the pool can still be reaped before the turn ends (pre-existing).Testing
result_refreshes_idle_clock(mapping, exhaustive match) plus wiring tests that a channel result refreshes the idle clock throughhandle_prompt_resultand a heartbeat result leaves it stale.cargo test -p buzz-acp: 28 failures on this (heavily loaded) machine, in modules this patch does not touch (acp::testssteer/session,pool::model_switch_tests,pool::startup_effort_tests) — the failure set is byte-identical on the clean base commit under the same conditions, i.e. pre-existing machine-local flakes, zero new failures from this patch. The four new idle-clock tests pass.🤖 Generated with Claude Code