buzz-acp: provider quota/billing exhaustion (429/402) is retried for ~25 min, then the message is dropped and the author isn't notified
Describe the bug
When an agent turn fails because the model provider reports that the account is out of quota or out of balance, buzz-acp treats it as a transient error. It retries for about 25 minutes, discards the batch, and then posts a failure notice that does not mention the author.
Only two error classes skip the retry budget today:
model not found→ immediate dead-letter (crates/buzz-acp/src/lib.rs:5359)- auth errors:
is_auth_errormatches"Re-authenticate"or"API Error: 401"(lib.rs:5167)
Everything else falls through to queue.requeue(batch) (lib.rs:5388). requeue() (queue.rs:693) allows MAX_RETRIES = 10 with backoff from BASE_RETRY_DELAY_SECS = 5 doubling up to MAX_RETRY_DELAY_SECS = 300 (queue.rs:85-91), plus ±20% jitter:
5 + 10 + 20 + 40 + 80 + 160 + 300 + 300 + 300 + 300 = 1,515 s ≈ 25 min (±20%)
For quota or billing errors this causes four problems:
- Delay. Nothing visible happens for about 25 minutes.
- Retries can't help when the error is permanent. A 402 "balance exhausted" won't clear until someone pays, and a 429 whose window resets hours later won't clear within the budget either.
- Nobody is notified.
build_failure_notice_eventpasses an empty mentions list tobuzz_sdk::build_message(channel_id, content, thread_ref, &[], …)(pool.rs:5544-5551), so the author of the dropped message isn't p-tagged. In a busy channel the notice is easy to miss. - The notice hides the cause. In the 402 case below, the notice only carried the JSON-RPC error (
-32603 Internal error). The provider's message, which says what happened and when the limit resets, appeared only in the daemon log.
I understand the precision argument in the is_auth_error docstring: misclassifying a transient error as permanent silently drops a message. So the proposal below is narrow and always notifies the author. It does not dead-letter every 429.
Steps to reproduce
- Run
buzz-acpwith an agent whose provider account has run out of balance (402) or whose subscription window is exhausted (429). - Mention the agent in a channel.
- Watch the log:
requeueing failed batch with backoffforattempt=1..10, thendead-lettering batch after 10 retries — discarding 1 eventsabout 25 minutes later. - The failure notice is posted without a
ptag for the message author.
Expected behavior
- 402 / balance exhausted: dead-letter right away. Include the provider's message in the notice.
- 429 with a reset time in the message: keep retrying only if the reset falls inside the remaining backoff budget. Otherwise dead-letter right away and include the reset time in the notice.
- 429 without a reset time, or anything unrecognized: keep the current backoff.
- Failure notices should p-tag the author of the triggering event(s), so the person who asked is actually notified.
- Longer term: carry the HTTP status as a structured field on the error instead of matching message text. Providers phrase these errors very differently (examples below), and exact-string checks like
"API Error: 401"miss them.
Version and platform
- Buzz version:
buzz-acpbuilt from7c789dee0(September 2026). I re-read the relevant paths onmain@744f394(2026-11-06), and the logic is unchanged. Line numbers above are frommain. - OS: Linux x86_64 (Ubuntu) for the 402 and session-limit cases. The 429 case came from a separate deployment.
Logs / additional context
Three providers, three different message formats (timestamps UTC, identifiers removed):
# xAI (Grok Build) — 402, permanent until topped up
14:52:09 status_code=402 "Grok Build usage balance exhausted"
14:52:09 → 15:13:22 requeueing failed batch with backoff attempt=1..10
15:18:10 ERROR dead-lettering batch after 10 retries — discarding 1 events
total 1,561 s, consistent with 1,515 s ± jitter
failure notice posted without a p tag for the author
# Subscription provider via a third-party ACP adapter — 429, reset ~4 h later
11:01:51 API error 429 …: Subscription quota exhausted.
Your usage window resets at <time ~4 h later>. (rate_limit_error)
attempt=1..10 → dead-letter
# Claude Code — session limit, no status code in the text
"You've hit your session limit · resets 3:20pm"
attempt=1..6 (4.2 / 8.1 / 16.6 / 34.7 / 65.0 / 134.3 s)
attempt 7 succeeded about 6 min later
The third case is why I'm not proposing to dead-letter every 429: when the reset falls inside the backoff window, retrying does rescue the message. The first two cases can't be rescued by retrying.
I haven't verified whether the extra retries consume more of the remaining quota.
I'm happy to open a PR if this direction sounds right.
Adding a variant that the classifier-based fixes in #7317 and #7787 won't catch: the agent hides the 429 and ends the turn normally, so buzz-acp records success and never sees an error to classify.
Setup: buzz-acp (built from main around 2026-11-25) running Google's Antigravity CLI as the agent (agy acp, model gemini-4-neon-high, consumer Google AI Pro account), BUZZ_ACP_AGENTS=6, SESSION_POLICY=thread.
agy's own log (~/.gemini/antigravity-cli/log/acp-server-*.log):
E1201 01:31:06.185901 errorreport.go:285] agent executor error: generating and executing: RESOURCE_EXHAUSTED (code 429): Individual quota reached. Please upgrade your subscription to increase your limits. Resets in 19m4s.
E1201 01:32:01.258135 errorreport.go:285] agent executor error: ... RESOURCE_EXHAUSTED (code 429): Individual quota reached. ... Resets in 18m9s.
E1201 01:41:11.972985 errorreport.go:285] agent executor error: ... RESOURCE_EXHAUSTED (code 429): Individual quota reached. ... Resets in 8m59s.
buzz-acp for the same turns:
01:41:10.696954 DEBUG buzz_acp: agent_claimed agent=0 channel=… scope=thread:… affinity_hit=false
01:41:11.973471 DEBUG buzz_acp: agent_returned agent=0 outcome="ok"
01:41:11.973493 DEBUG buzz_acp: dispatch_pending dispatched=0 queue_depth=0
The turn takes about 1.3 s, is logged as outcome="ok" at DEBUG, and produces nothing at WARN or ERROR. There's no requeue, no dead-letter and no failure notice, so the message is never retried after the quota resets. agy has done this 14 times since 2026-11-20 on this host. The only sign of it is agy's own log file; it's invisible from the buzz-acp journal.
This is the same failure as #5605 (the Claude CLI exits 0 with is_error: true), but with a different agent. It means that matching on AgentError text, which #7317 and #7787 both rely on, only covers agents that return a JSON-RPC error. Ideas that would cover both cases:
- Treat a very short
end_turnthat published nothing as suspect. For example, anokturn that finished in under a few seconds and published no message, if #4648'semptyoutcome isn't already doing this. Hold or retry it like an error rather than counting it as done. - Run the usage-limit classifier on the agent's message text as well as on
AgentError, for agents that send the limit notice as ordinary output (#5605's case). - Log a non-
okoutcome at WARN by default so this shows up withoutRUST_LOG=buzz_acp=debug.
Ideally agy acp would also return a JSON-RPC error for a provider 429, but the harness shouldn't depend on every agent doing that.
For the hold-vs-dead-letter question, I'd support #7317 (hold until the reset time parsed from the error). Every message dropped here was sent less than 20 minutes before the quota reset, so holding would have answered all of them.