[Bug]: Worker report delivery retries forever, with no attempt limit or expiry
What went wrong?
Worker report delivery (ao report) has no retry timeout. When a report isn't acknowledged, AO keeps retrying it with no limit, and those retries used up a lot of tokens. Report delivery should stop retrying at some point.
Agent-collected evidence
Collected 2026-11-14 around 11:27 UTC. Read-only query of ~/.ao/data/ao.db on AO 0.15.1-nightly.202611132033 (commit 48709b6a284d), macOS. Source checked against main at 22229a800fe01716c7f1b52fa813e0b95dfd1e32.
1. Reports retried tens of thousands of times against an orchestrator that couldn't take them (no tokens, but no end).
SELECT substr(last_error,1,120), count(*), max(delivery_attempts), sum(delivery_attempts)
FROM reports WHERE delivery_state='pending' AND project_id='agent-orchestrator' GROUP BY 1;
| last_error | reports | max attempts | total attempts |
|---|---|---|---|
send agent-orchestrator-229: no live chat controller for session |
127 | 93,865 | 2,822,581 |
- The reports were created 2026-10-12 to 2026-10-28. The orchestrator was terminated 2026-11-06. All 127 are still
pendingand were never delivered. - The counter is no longer increasing on the current daemon.
- These attempts failed before reaching a model, so in this installation they cost no tokens. They show that nothing stops or expires a report that can't be delivered.
2. Retries that reach a live orchestrator start a new model turn each time (this is where the tokens go).
A public token audit for #8385 / #7606 (gist, AO 0.14.10, Linux) recorded:
- One Terminal-mode Claude Code orchestrator received the same report batch 9 times (12 delivery attempts per report).
- The 7 repeat-only cycles used 14 responses / 4,670,337 raw tokens, at roughly 322k–343k tokens of context per response.
That audit's trigger was the <pasted_content> wrapper in #7606. It also notes: "An unknown/uncertain acceptance outcome has bounded retry/backoff and a visible state; it must not cause an unlimited sequence of model turns. Retry policy is outside #6387's stated scope and needs separate validation."
3. Current code. In backend/internal/service/report/coordinator.go on main, a failed delivery is retried after RetryDelay (default 5s) or OrchestratorBusyRetry (30s). I found no attempt limit, expiry, or failed/abandoned state for a report. delivery_attempts is counted but never checked against a limit.
Related, different scope:
- #7606 / PR #6387: paste-wrapper acknowledgement
- #6931: reports stay
claimedand re-deliver every turn - #6119 / PRs #6584 and #6885: an undeliverable batch starves newer ones. PR #6885 adds exponential backoff capped at 64× but still retries indefinitely.
- #6639: retry storm against a dead controller, as a side finding of a Windows restart bug
Each of these fixes one cause of a failed or unacknowledged delivery. This issue is about the missing upper limit for any cause.
Can I work on this?
wip