fix: await plugin event hooks and handle errors in database effects#17517
Open
omd0 wants to merge 3 commits intoanomalyco:devfrom
Open
fix: await plugin event hooks and handle errors in database effects#17517omd0 wants to merge 3 commits intoanomalyco:devfrom
omd0 wants to merge 3 commits intoanomalyco:devfrom
Conversation
Plugin event hooks were called without `await`, causing errors to be silently swallowed as unhandled promise rejections. This prevented plugins from reliably receiving bus events like `session.created`. Also adds error handling for database effects (used by Bus.publish) so that async failures in event publishing are logged rather than lost. Closes anomalyco#14808 https://claude.ai/code/session_01FnwVBLHausa5Kmue7hxQAZ
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.
Issue for this PR
Closes #14808
Type of change
What does this PR do?
Plugin event hooks in
Plugin.init()were called withoutawait, causing errors to be silently swallowed as unhandled promise rejections. This prevented plugins from reliably receiving bus events likesession.created.The fix:
awaiteach plugin's event hook call so async handlers run to completionBus.publish) so async failures in event publishing are logged rather than silently lostHow did you verify your code works?
Reviewed the async control flow to confirm that
awaitensures promise rejection is caught by the surrounding try/catch, and that the per-hook error handling isolates failures between plugins.Screenshots / recordings
N/A - no UI changes
Checklist