fix(discord): prevent WebSocket death spiral + fix numeric channel ID…#21463
Closed
akropp wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(discord): prevent WebSocket death spiral + fix numeric channel ID…#21463akropp wants to merge 1 commit intoopenclaw:mainfrom
akropp wants to merge 1 commit intoopenclaw:mainfrom
Conversation
… resolution Two bugs: 1. Message handler awaited processDiscordMessage inline, blocking the Discord event listener. Slow agent responses (30-150s) prevented WebSocket heartbeat servicing, causing code 1005/1006 disconnects and reconnect loops. Changed to fire-and-forget with error catching. 2. Channel resolver compared numeric channel IDs against channel names when config used guildId/channelId format (e.g. '123/456'). The second segment was treated as a name and slug-matched, which never matched numeric IDs. Now matches by ID when the channel query is numeric.
|
This pull request has been automatically marked as stale due to inactivity. |
This was referenced Feb 28, 2026
18 tasks
Member
|
Superseded by #33142 which consolidates the fixes from this PR. Closing this in favor of that PR. |
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.
… resolution
Two bugs:
Message handler awaited processDiscordMessage inline, blocking the Discord event listener. Slow agent responses (30-150s) prevented WebSocket heartbeat servicing, causing code 1005/1006 disconnects and reconnect loops. Changed to fire-and-forget with error catching.
Channel resolver compared numeric channel IDs against channel names when config used guildId/channelId format (e.g. '123/456'). The second segment was treated as a name and slug-matched, which never matched numeric IDs. Now matches by ID when the channel query is numeric.
Summary
Describe the problem and fix in 2–5 bullets:
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
List user-visible changes (including defaults/config).
If none, write
None.Security Impact (required)
Yes/No)Yes/No)Yes/No)Yes/No)Yes/No)Yes, explain risk + mitigation:Repro + Verification
Environment
Steps
Expected
Actual
Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
Compatibility / Migration
Yes/No)Yes/No)Yes/No)Failure Recovery (if this breaks)
Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.Greptile Summary
This PR fixes two critical Discord integration bugs:
Changes:
message-handler.ts): ChangedprocessDiscordMessagefrom blocking (await) to fire-and-forget (void+.catch()) to prevent slow agent responses (30-150s) from blocking the Discord event listener and causing WebSocket heartbeat failures (code 1005/1006 disconnects)resolve-channels.ts): Added numeric ID detection (/^\d+$/) to match channels by ID when usingguildId/channelIdformat (e.g.,123/456), instead of incorrectly treating the numeric channel ID as a name and attempting slug-based matchingImpact:
These are well-targeted fixes that address production stability issues. The fire-and-forget pattern is correct for this use case—errors are still caught and logged, but the event loop remains responsive. The numeric ID fix resolves a logic error where numeric channel IDs in the second segment of
guildId/channelIdpatterns were being compared against channel names instead of channel IDs.Confidence Score: 4/5
Last reviewed commit: c396ee3
(2/5) Greptile learns from your feedback when you react with thumbs up/down!