-
Notifications
You must be signed in to change notification settings - Fork 2.9k
plugin_framework fix #4403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
plugin_framework fix #4403
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -840,8 +840,20 @@ async def _exec_with_plugin( | |
| modified_event, invocation_context.run_config | ||
| ) | ||
| yield modified_event | ||
| # Detect state_delta changes after yielding the modified event | ||
| if modified_event.actions.state_delta: | ||
| await plugin_manager.run_on_state_change_callback( | ||
| invocation_context=invocation_context, | ||
| state_delta=modified_event.actions.state_delta.copy(), | ||
| ) | ||
| else: | ||
| yield event | ||
| # Detect state_delta changes after yielding the original event | ||
| if event.actions.state_delta: | ||
| await plugin_manager.run_on_state_change_callback( | ||
| invocation_context=invocation_context, | ||
| state_delta=event.actions.state_delta.copy(), | ||
| ) | ||
|
Comment on lines
+843
to
+856
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic to detect and handle |
||
|
|
||
| # Step 4: Run the after_run callbacks to perform global cleanup tasks or | ||
| # finalizing logs and metrics data. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
_run_callbackshere introduces an early-exit behavior if any plugin returns a non-Nonevalue. For an observational callback likeon_state_change_callback, all registered plugins should be notified regardless of the return values of others. The current implementation could lead to some plugins missing state change notifications if a preceding plugin in the chain returns a value.To ensure all plugins are reliably called, consider implementing this method by looping through the plugins directly. This would align better with the 'observational only' nature of this callback.