Skip to content

fix: await plugin event hooks and handle errors in database effects#17517

Open
omd0 wants to merge 3 commits intoanomalyco:devfrom
omd0:claude/fix-issue-14808-OXpBC
Open

fix: await plugin event hooks and handle errors in database effects#17517
omd0 wants to merge 3 commits intoanomalyco:devfrom
omd0:claude/fix-issue-14808-OXpBC

Conversation

@omd0
Copy link

@omd0 omd0 commented Mar 14, 2026

Issue for this PR

Closes #14808

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Plugin event hooks in Plugin.init() 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.

The fix:

  1. await each plugin's event hook call so async handlers run to completion
  2. Wrap each hook in a try/catch so one plugin's failure doesn't block others
  3. Add error handling around database effects (used by Bus.publish) so async failures in event publishing are logged rather than silently lost

How did you verify your code works?

Reviewed the async control flow to confirm that await ensures 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

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

claude and others added 3 commits March 14, 2026 14:24
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugin event listener for "session.created" not firing

2 participants