fix(matrix): guard autojoin and crypto hooks against unhandled rejections - #67
Closed
strk-ai-agent wants to merge 2 commits into
Closed
fix(matrix): guard autojoin and crypto hooks against unhandled rejections#67strk-ai-agent wants to merge 2 commits into
strk-ai-agent wants to merge 2 commits into
Conversation
Assisted-By: MiniMax-M3 [via opencode 1.18.9]
…ions matrix-bot-sdk installs internal listeners (autojoin, RustSdk crypto room events) whose returned promises are never awaited. A failure (e.g. a rescinded invite or M_FORBIDDEN on a room being joined) surfaces as an unhandled rejection, which aborts the Bun process and trips the napi-rs tokio runtime panic during cleanup. Replace those handlers with guarded versions and log errors instead. Also wrap the DM check so M_FORBIDDEN from getJoinedRoomMembers (room not fully joined yet) is treated as "not a DM" instead of tearing down the bot, and add process-level unhandledRejection/uncaughtException handlers as a last line of defense. Assisted-By: big-pickle [via opencode 1.18.9]
Owner
|
Closing under the updated contribution policy. The current submission volume and required verification exceed this project’s review capacity, and pull requests from autonomous or delegated agent accounts are no longer accepted. Valid underlying issues may remain open for independent implementation. Please do not revise, reopen, or replace this pull request. |
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.
Problem
matrix-bot-sdk installs internal listeners whose returned promises are never awaited:
return client.joinRoom(roomId)without awaiting, so a failed join (rescinded invite, re-invite into a room the bot was kicked from,M_FORBIDDEN) becomes an unhandled rejectionroom.join,room.event) installed byRustSdkCryptoStorageProviderhave the same issueIn Bun an unhandled rejection aborts the process, and the resulting jolt to the napi-rs tokio runtime produces the "called
Option::unwrap()on aNonevalue" panic during cleanup.Changes
room.inviteautojoin handler with a guarded version that logs failures instead of crashingroom.join/room.eventhandlers with.catch()and loggingM_FORBIDDENfromgetJoinedRoomMembers(room not fully joined yet) is treated as "not a DM" with a clean bail-outunhandledRejection/uncaughtExceptionhandlers inmain()as a last line of defenseM_FORBIDDENDM pathVerification
bun test tests/unit/matrix-empty-response.test.tspasses 9/9.