fix: run on_event_callback before append_event to persist plugin modifications#5309
Open
Jah-yee wants to merge 2 commits intogoogle:mainfrom
Open
fix: run on_event_callback before append_event to persist plugin modifications#5309Jah-yee wants to merge 2 commits intogoogle:mainfrom
Jah-yee wants to merge 2 commits intogoogle:mainfrom
Conversation
added 2 commits
April 13, 2026 21:33
Updates documentation for 'adk web' and 'adk api_server' commands to clarify
the multiple supported agent directory formats:
- {agent_name}/agent.py (module with root_agent)
- {agent_name}.py (module with root_agent)
- {agent_name}/__init__.py (package with root_agent or app)
- {agent_name}/root_agent.yaml (YAML config folder)
The implementation already supports all these formats via AgentLoader, but the docstring
only mentioned the YAML case, causing user confusion per issue google#4425.
Signed-off-by: RoomWithOutRoof <RoomWithOutRoof@users.noreply.github.com>
…fications Previously, on_event_callback was executed AFTER append_event, causing plugin modifications to events (e.g., custom_metadata) to only be visible in the real-time event stream but not persisted to the database. This fix reorders the execution so that: 1. on_event_callback runs first to modify the event 2. append_event stores the (possibly modified) event to DB 3. The event is then yielded to the client This ensures plugin modifications are persisted and visible when fetching conversation history. Fixes: google#3990
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Collaborator
|
Hello @Jah-yee, thank you for your contribution! Before we can merge this PR, could you please address the following:
This information will help us review and merge your PR more efficiently. Thanks! Response from ADK Triaging Agent |
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.
Good day
Summary
Fixes issue #3990 - the on_event_callback plugin hook was executing after the event had already been saved to the database via session_service.append_event(). This caused plugin modifications (e.g., adding/modifying custom_metadata) to only be visible in the yielded event stream but not persisted to the database.
Changes
Reorders execution in runners.py so that:
This ensures plugin modifications are persisted and visible when fetching conversation history.
Testing
Files Changed
感谢你们的奉献,希望能提供帮助。如果我解决得有问题或有待商妥的地方,请在下面留言,我会来处理。
Warmly,
RoomWithOutRoof