Repository navigation
fix(discord): harden rate limit retries - #75338
Conversation
|
@clawsweeper automerge |
3363f63 to
01d0833
Compare
|
@clawsweeper automerge |
|
🦞🦞 I added Draft PRs stay fix-only until GitHub marks them ready for review. A maintainer can pause this with |
|
Codex review: passed for ClawSweeper automerge. What this changes: The PR adds Discord REST queued 429 retry scheduling with retry limits and generation guards, shared Retry-After parsing, typed webhook and voice-upload errors, guarded voice-upload URL reacquisition, regression tests, and a changelog entry. Automerge follow-up: No repair job is needed: the latest PR head already addresses the prior narrow review blocker, so the remaining action is normal exact-head automerge gating rather than a ClawSweeper fix PR. Security review: Security review cleared: No concrete security or supply-chain regression found: the diff touches Discord TypeScript code, tests, and changelog only, and the moved raw voice-upload network calls use fetchWithSsrFGuard. Review detailsBest possible solution: Let the automerge path continue on the exact current head once required checks and merge gates pass; keep this Discord-owned retry hardening in the Discord plugin with the added scheduler, webhook, and voice-upload tests. Do we have a high-confidence way to reproduce the issue? Yes. The added focused unit test covers the previously identified clearQueue/active-429 race, and adjacent tests cover queued 429 retry timing, max retry behavior, HTTP-date Retry-After parsing, and fresh voice upload URL reacquisition. Is this the best way to solve the issue? Yes. The latest generation guard is a narrow scheduler fix for the stale requeue race, and routing the voice upload raw HTTP calls through the plugin SDK SSRF guard is the safer boundary-preserving direction. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 3c4851037b6c. |
|
🦞🦞 Source: I will update this PR branch, or open a safe credited replacement, if the repair worker finds a narrow fix. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3363f63300
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (error instanceof RateLimitError && this.requeueRateLimitedRequest(queued)) { | ||
| requeued = true; | ||
| return; |
There was a problem hiding this comment.
Skip rate-limit requeue after queue is cleared
When clearQueue() is called, callers expect all queued work to be rejected and no further retries to be scheduled, but runQueuedRequest will still requeue an in-flight request on RateLimitError (requeueRateLimitedRequest) and return early. In a shutdown or teardown path where clearQueue() races with an active request that receives HTTP 429, that request can survive the clear and run again later, leaving queueSize non-zero and the original promise unresolved longer than expected.
Useful? React with 👍 / 👎.
|
@clawsweeper automerge |
|
🦞🦞 I added Draft PRs stay fix-only until GitHub marks them ready for review. A maintainer can pause this with |
|
@clawsweeper automerge |
|
@clawsweeper automerge |
|
🦞🦞 Source: The automerge loop is complete. |
|
🦞🦞 Reason: automerge requires an open PR. Draft PRs stay fix-only until GitHub marks them ready for review. A maintainer can pause this with |
* fix(discord): harden rate limit retries * fix(discord): guard voice upload fetches * fix(discord): avoid stale rate limit requeues
* fix(discord): harden rate limit retries * fix(discord): guard voice upload fetches * fix(discord): avoid stale rate limit requeues
* fix(discord): harden rate limit retries * fix(discord): guard voice upload fetches * fix(discord): avoid stale rate limit requeues
* fix(discord): harden rate limit retries * fix(discord): guard voice upload fetches * fix(discord): avoid stale rate limit requeues
Summary
Retry-Afterseconds and HTTP-date headers consistently across REST, webhook, and voice upload pathsVerification
pnpm test extensions/discord/src/internal/rest.test.ts extensions/discord/src/send.webhook.proxy.test.ts extensions/discord/src/api.test.ts extensions/discord/src/internal/gateway.test.ts extensions/discord/src/proxy-request-client.test.ts extensions/discord/src/client.proxy.test.ts extensions/discord/src/send.creates-thread.test.ts extensions/discord/src/outbound-adapter.test.ts extensions/discord/src/actions/runtime.test.ts extensions/discord/src/voice-message.test.ts -- --runOPENCLAW_TESTBOX=1 pnpm check:changed(tbx_01kqgj672yetap933mr5gsk8wb)