Repository navigation
fix(discord): wait out 429s instead of dropping the message - #217
Conversation
The first weekly PR digest on 2026-11-11 sent 15 Discord messages back to back and Discord rate-limited 4 of them, so 4 developers never got their digest. The Discord client treated a 429 like any other failure. Every Discord API call now waits the retry_after Discord returns (1s when the body has none) and tries again, failing only after 5 attempts so a lasting limit still surfaces. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🔵 Tier A · Mergeable after minor fixes
Adds a bounded Discord request retry helper that waits for the response body's
Note Not approving while a bug finding is open: Route thread PATCH calls through the retry helper
Fix with agent prompt### Issue 1
crates/claudear-integrations/src/discord/client.rs:127
**Route thread PATCH calls through the retry helper**
`archive_thread` and `unarchive_thread` still call `self.http.patch` directly (lines 390–413), so a 429 on either operation bypasses this helper and fails immediately. These two API calls remain outside the new retry behavior.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.📂 Walkthrough · 1
Reviewed |
|
|
||
| /// Send a request, waiting out each 429 for as long as Discord asks | ||
| /// before sending it again. | ||
| async fn request<F, Fut>(&self, send: F) -> Result<HttpResponse> |
There was a problem hiding this comment.
Route thread PATCH calls through the retry helper
archive_thread and unarchive_thread still call self.http.patch directly (lines 390–413), so a 429 on either operation bypasses this helper and fails immediately. These two API calls remain outside the new retry behavior.
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/claudear-integrations/src/discord/client.rs
Line: 127
Comment:
**Route thread PATCH calls through the retry helper**
`archive_thread` and `unarchive_thread` still call `self.http.patch` directly (lines 390–413), so a 429 on either operation bypasses this helper and fails immediately. These two API calls remain outside the new retry behavior.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.🟡 Minor · bug · Reply if this doesn't apply.
What broke
The first weekly PR digest went out on 2026-11-11 at 22:45 UTC. Discord answered 4 of its 15 messages with HTTP 429 (
You are being rate limited), and those 4 developers never received their digest.DiscordClienttreated a 429 like any other failure, and none of its calls retried.Fix
Every
DiscordClientAPI call now goes throughrequest. On a 429 it:retry_aftervalue from Discord's response body, or 1s when the body has none;Tests
a_rate_limited_message_is_sent_once_discord_allows_it: a 429 followed by a 200 sends the message in two posts. This test fails when retries are turned off.a_lasting_rate_limit_still_fails_the_message: a 429 that never clears gives up after 5 attempts.a_429_without_retry_after_waits_the_default🤖 Generated with Claude Code