Repository navigation
Description
Bug Description
hermes send --to discord:... does not retry on Discord 429 rate limits. For a multi-chunk message, the first chunk that hits a 429 aborts the loop and every remaining chunk is silently dropped. Discord's 429 response includes retry_after (often sub-second), so a trivial wait-and-retry would deliver the full message.
Telegram already has exactly this: _send_telegram_message_with_retry() in tools/send_message_tool.py (3 attempts, honors retry_after, exponential backoff via _retry_delay_for_exception). Discord has no equivalent in either layer it passes through.
Where (verified on v0.16.0 and current main):
tools/send_message_tool.py, thePlatform.DISCORDchunk loop: callsentry.standalone_sender_fn(...)per chunk andreturn resulton the first chunk whose result dict has anerror— no retry, and the remaining chunks are never sent.plugins/platforms/discord/adapter.py,_standalone_send(): raw aiohttp POSTs; a 429 becomes{"error": "Discord API error (429): ..."}with no retry. (The 429 helpers elsewhere in that file —_extract_discord_retry_after,_is_discord_rate_limit— serve the live gateway adapter and slash-command sync, not the standalone path.)
Workaround: we now chunk in our own wrapper and call hermes send --json once per chunk with per-chunk retry/verification, but native retry would fix every hermes send consumer.
Steps to Reproduce
- Set up multiple bot identities posting to the same Discord channel.
- From concurrent
hermes sendprocesses, post several multi-chunk (>2000 char) messages to that channel in quick succession. - One process hits
429 You are being rate limited, retry_after: 0.3mid-stream. - Its trailing chunks are silently dropped — the chunk loop returns on the first error.
Observed in production 2026-06-10: an 8-chunk message lost chunks 7–8 to a 429 with retry_after: 0.3 — a 0.3-second wait would have saved the delivery.
Expected Behavior
On a 429, honor retry_after (with a small cap and bounded attempts), retry the failed chunk, then continue with the remaining chunks — parity with the Telegram path, wrapping the Discord chunk send in the same retry helper pattern.
Environment: hermes-agent v0.16.0 (2026.6.5), Pop!_OS 24.04, Python 3.11.15. Also confirmed present in main as of 2026-06-11 (same code in both files).
Actual Behavior
The first chunk that hits a 429 returns {"error": "Discord API error (429): You are being rate limited, retry_after: 0.3"} and the chunk loop exits — all remaining chunks are silently dropped with no retry. Observed 2026-06-10: an 8-chunk message delivered chunks 1–6 and lost 7–8 to a single sub-second 429.
Affected Component
Gateway (Telegram/Discord/Slack/WhatsApp)
Messaging Platform (if gateway-related)
No response
Debug Report
Debug share omitted — exact root cause, file paths, and code locations are identified in the Description and Root Cause sections below (verified in both v0.16.0 and current main), so a log/config dump shouldn't be needed. Happy to provide targeted log excerpts on request.Operating System
Pop!_OS 24.04
Python Version
3.11.15
Hermes Version
0.16.0 (2026.6.5)
Additional Logs / Traceback (optional)
Root Cause Analysis (optional)
tools/send_message_tool.py,Platform.DISCORDchunk loop: callsentry.standalone_sender_fn(...)per chunk and doesreturn resulton the first chunk whose result dict has anerror— no retry, remaining chunks never sent.plugins/platforms/discord/adapter.py,_standalone_send(): raw aiohttp POSTs; a 429 becomes an error dict with no retry. The existing 429 helpers in that file (_extract_discord_retry_after,_is_discord_rate_limit) serve the live gateway adapter and slash-command sync, not the standalone path.
Proposed Fix (optional)
Wrap the Discord standalone chunk send in the same retry pattern Telegram already uses (_send_telegram_message_with_retry() — 3 attempts, honors retry_after, exponential backoff). On 429: wait retry_after (with a small cap and bounded attempts), retry the failed chunk, continue with remaining chunks.
Are you willing to submit a PR for this?
- I'd like to fix this myself and submit a PR
Activity
AIalliAI commentedon Jun 11, 2026
Verified on current
main(6c752ca) — everything in this report checks out:tools/send_message_tool.py,Platform.DISCORDchunk loop:return resulton the first chunk whose result dict haserror— no retry, remaining chunks silently dropped. ✔️plugins/platforms/discord/adapter.py::_standalone_send: raw aiohttp POSTs; any non-2xx (including 429) becomes{"error": "Discord API error (429): ..."}with no retry. ✔️_send_telegram_message_with_retry(3 attempts, honorsretry_after, exponential backoff). One tiny naming nit: the delay helper is_telegram_retry_delay, not_retry_delay_for_exception. ✔️_extract_discord_retry_after,_is_discord_rate_limit) indeed only serve the live gateway adapter / slash-command sync, not the standalone path. ✔️Fix is up in #44488: a bounded-retry POST helper (
_standalone_post_with_retry) inside_standalone_send— 3 attempts,retry_afterparsed from the 429 JSON body (sub-second precision, so yourretry_after: 0.3case waits 0.3s) with header fallback and exponential backoff, capped at 10s (a longer/global rate limit fails fast rather than stalling the blocking CLI call). Applied to the text-message POST and both forum thread-creation POSTs.Putting the retry inside
_standalone_send(matching where Telegram retries, inside_send_telegram) means the chunk loop needs no change: a transient 429 on chunk N retries and succeeds, and the remaining chunks proceed. Error dict shapes are unchanged for anything that still fails after retries.liuhao1024 commentedon Jun 12, 2026
This is fixed by #44542 — retries standalone Discord send on 429 rate-limit instead of dropping chunks.
fix(discord): retry 429s in the standalone send path, honoring retry_…
GottZ commentedon Jul 28, 2026
Summary
Three PRs address #44468 by adding bounded retries around Discord standalone delivery: #44488 retries adapter-level text and forum-thread POSTs, #44542 retries adapter-level text and per-file media POSTs, and #44558 retries each chunk at the send-message-tool layer. All three prevent a transient 429 from immediately aborting the reported multi-chunk text path, but their coverage and retry semantics differ.
Related pull requests
best fix— (+216/-43) — fixes / preferred: Adds a reusable three-attempt, 429-only adapter helper used by standalone text and forum-thread POSTs, honoring body or header delays with fallback backoff and preserving non-429 behavior; its five visible tests cover body retry_after, exhaustion, an over-cap delay, non-429 behavior, and fallback, but not header extraction. The diff does not convert the standalone per-file media-upload path, so its scope is not comprehensive, but it directly fixes the reported multi-chunk text failure and the keep_open review on fix(discord): retry 429s in the standalone send path, honoring retry_after #44488 found no blocking defect.fixes— (+177/-16) — fixes, closed duplicate of fix(discord): retry 429s in the standalone send path, honoring retry_after #44488: Retries standalone text and per-file media POSTs on 429 with a 0.5–10s parsed body delay, but returns immediately when retry_after is absent and does not cover the forum-thread POSTs shown in fix(discord): retry 429s in the standalone send path, honoring retry_after #44488. Despite the APPROVED review on fix(discord): retry standalone send on 429 rate-limit instead of dropping chunks #44542, contributor review and closure identify it as the later duplicate of the earlier canonical fix(discord): retry 429s in the standalone send path, honoring retry_after #44488.fixes— (+49/-4) — fixes, closed as superseded by fix(discord): retry 429s in the standalone send path, honoring retry_after #44488: Wraps each Discord chunk at the tool layer with three attempts, using an error-dict retry_after when available or string-based backoff for 429s, and also broadens retries to 502/503 responses. It fixes the reported chunk-abort symptom but duplicates fix(discord): retry 429s in the standalone send path, honoring retry_after #44488 at a higher layer and adds no visible tests in the supplied diff.Duplicates
#44542 and #44558 substantially duplicate #44488's fix for Discord 429s dropping trailing chunks, although #44542 implements adapter-level text/media retries and #44558 implements tool-level per-chunk retries.
Suggested consolidation
Merge #44488 as the verified best fix and earliest canonical implementation: it directly repairs the reported standalone text path, has focused retry tests, and has a keep_open review with no blocking defects. Keep #44542 and #44558 closed as duplicates; #44542's APPROVED review supports its correctness but does not outweigh the contributor-documented duplication, while #44558 is the less-tested higher-layer alternative.
Complex graph
flowchart LR classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937 classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151 classDef best stroke-width:3px,stroke:#b45309 classDef target stroke-width:3px,stroke:#4338ca I44468(["issue #44468 (open)"]) subgraph Dup44488 ["PRs duplicating each other"] P44488["PR #44488 (open)"] P44542["PR #44542 (closed)"] P44558["PR #44558 (closed)"] end P44488 -->|best fix| I44468 P44542 -->|fixes| I44468 P44558 -->|fixes| I44468 class I44468 open class I44468 target class P44488 open class P44542 closed class P44558 closed class P44488 best click I44468 "https://github.com/NousResearch/hermes-agent/issues/44468" click P44488 "https://github.com/NousResearch/hermes-agent/pull/44488" click P44542 "https://github.com/NousResearch/hermes-agent/pull/44542" click P44558 "https://github.com/NousResearch/hermes-agent/pull/44558"Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed or no verify verdict yet (state tag in the node label).
Cross-PR triage: Reviewed 3 pull requests and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 29 kB of PR diffs, 10 kB of issue/PR text, 6 kB of discussion (10 comments), 7 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.