feat(acp): make event queue max-retries configurable via BUZZ_ACP_QUEUE_MAX_RETRIES - #5703
feat(acp): make event queue max-retries configurable via BUZZ_ACP_QUEUE_MAX_RETRIES#5703obbax wants to merge 1 commit into
Conversation
…UE_MAX_RETRIES The dead-letter threshold for a stuck channel's event batch was a hardcoded constant (queue.rs MAX_RETRIES = 10). Operators running buzz-acp against a flaky downstream agent/MCP server had no way to tune retry tolerance without recompiling. Add `--queue-max-retries` / `BUZZ_ACP_QUEUE_MAX_RETRIES` (clap flag with env fallback, matching the existing --context-message-limit / --max-turns-per-session pattern) threaded through Config into a new `EventQueue::with_max_retries` builder method, following the same pattern as `with_in_flight_deadline`. MAX_RETRIES stays as the default value (10) so behavior is unchanged unless the flag/env var is set. Signed-off-by: obbax <robinniclasandersson@gmail.com>
|
wiring looks right — one thing on the bound: worth reading alongside #5557 (429s retried with no backoff, 20-42/sec) before picking the ceiling — with no backoff on that path, raising this multiplies the storm rather than giving the batch more time to succeed. |
Chessing234
left a comment
There was a problem hiding this comment.
two things, both small.
the docs in queue.rs didn't follow the code: :102 ("dead-letter after MAX_RETRIES"), :134 ("if retry_counts[channel] > MAX_RETRIES"), and especially :422 — requeue's own contract doc, "After [MAX_RETRIES] attempts the batch is dead-lettered", an intra-doc link to the constant the function no longer honours. you did update the const doc at :30, so it's just those three.
and worth stating the reach explicitly: this only tunes a hand-run buzz-acp. the sibling knobs are plumbed twice — runtime.rs:672/676 emits BUZZ_ACP_IDLE_TIMEOUT / BUZZ_ACP_MAX_TURN_DURATION on local spawn, and agents_deploy.rs:89 puts them into policy_env for remote deploys — and BUZZ_ACP_QUEUE_MAX_RETRIES is in neither, so desktop-managed and remote agents keep the hardcoded 10. given the incident you describe (provider quota exhaustion) hits hosted agents just as hard, that's exactly the population still untunable.
Summary
The dead-letter threshold for a failed event batch is a hardcoded constant (
queue.rsMAX_RETRIES = 10). When the downstream agent is hard-down for its whole outage (we hit this with a quota-exhausted LLM provider:-32603 … session limit), every queued message burns all ten attempts over ~30 minutes of pure backoff noise before dead-lettering, and operators can't tune it without recompiling.This exposes the cap as
--queue-max-retries/BUZZ_ACP_QUEUE_MAX_RETRIES(clap flag with env fallback, same pattern as--context-message-limit/--max-turns-per-session), threaded throughConfiginto a newEventQueue::with_max_retriesbuilder mirroring the existingwith_in_flight_deadline. The flag rejects0(range(1..)), andMAX_RETRIESremains the default — behavior is byte-for-byte unchanged unless the flag/env var is set. The startup config summary line now includesqueue_max_retries=….Related issue
N/A — none found (searched issues/PRs for queue retry configurability).
Testing
test_requeue_dead_letters_after_max_retriesunchanged — still covers the default path (EventQueue::newdefaults toMAX_RETRIES).test_requeue_dead_letters_after_custom_max_retriescovers a custom cap via.with_max_retries(2): requeues up to the cap, dead-letters on the following failure.cargo test -p buzz-acp queue: 159 passed, 0 failed (Linux x86_64, rust:1-bookworm).Signed-off-by: obbax robinniclasandersson@gmail.com