mirror of
https://github.com/block/buzz.git
synced 2026-12-01 05:32:24 +00:00
V-1 (clear resurrection prevention): add effort_ever_picked flag to AgentPool. return_agent propagates a startup-resolved desired_effort to pool level ONLY when no live pick/clear has ever been made. A user clear sets effort_ever_picked=true; subsequent worker returns can no longer resurrect the cleared value. V-2 (all-busy capability loss): add PoolEffortCapabilities cache and capabilities_ever_discovered flag to AgentPool. Pool-level cache is written at return_agent (refreshed from the returning worker's capabilities) and via notify_capabilities_discovered. The handle_set_config_option_control path reads from the cache instead of scanning idle agent slots, so picks and clears are never silently dropped when all workers are checked out. V-3 (busy-worker session convergence): return_agent compares the worker's checkout snapshot (desired_effort) against the current pool value. If they differ (a pick or clear arrived while the worker was busy), the worker's sessions are invalidated so the next try_claim creates a fresh session under the current pool value. Tests added (pool.rs effort_tests): - test_v1_clear_while_busy_return_does_not_resurrect_cleared_effort - test_v2_pick_while_all_busy_is_stored_not_dropped - test_v3_busy_worker_sessions_invalidated_on_return_after_pick - test_startup_effort_propagates_to_pool_on_first_return_when_no_live_pick Existing tests updated (lib.rs control_result_tests, pool.rs effort_tests): four tests that construct AgentPool::from_slots with agents carrying model_capabilities now also call notify_capabilities_discovered to populate the pool-level cache, matching production behavior where the cache is written at return_agent time. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>