Fix Discord snowflake validation, add 503 retry, and Slack rate limit backoff#2253
Open
Divide-By-0 wants to merge 1 commit into42wim:masterfrom
Open
Conversation
… backoff When bridging Slack threads to Discord, the gateway can pass a Slack message timestamp (e.g., "slack 1772220754.010239") as the ParentID when the message cache misses. Discord rejects this as "not snowflake", silently dropping the message. This adds upfront validation of the ParentID, attempts numeric extraction as a fallback, and retries without threading if Discord still rejects the reference. Also adds retry with exponential backoff (1s, 2s, 4s) at the gateway level for transient 503 Service Unavailable errors from Discord. Finally, upgrades the Slack rate limit handler to use exponential backoff (RetryAfter * 2^consecutiveHits), capped at 5 minutes and 10 consecutive hits, to prevent tight retry loops during reconnection bursts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Discord snowflake validation: When bridging Slack thread replies to Discord, the gateway can pass a Slack message timestamp (e.g.,
"slack 1772220754.010239") as themessage_reference.message_idwhen the message cache misses. Discord rejects this withNUMBER_TYPE_COERCE/ "not snowflake", silently dropping the message. This adds:ParentIDis a valid numeric snowflake503 retry at gateway level: Adds retry with exponential backoff (1s, 2s, 4s, up to 3 attempts) for transient
503 Service Unavailableresponses, preventing silent message loss during Discord outages.Slack rate limit exponential backoff: Upgrades
handleRateLimitto track consecutive rate limit hits per operation, applyingRetryAfter × 2^consecutiveHitsbackoff. Capped at 5 minutes max wait and 10 consecutive hits before giving up. Prevents tight retry loops during reconnection bursts when matterbridge re-fetches channel/user info for many channels at once.Test plan
🤖 Generated with Claude Code