Fix: Normalize hooks on every run instead of caching#6944
Open
benmezger wants to merge 1 commit intoagno-agi:mainfrom
Open
Fix: Normalize hooks on every run instead of caching#6944benmezger wants to merge 1 commit intoagno-agi:mainfrom
benmezger wants to merge 1 commit intoagno-agi:mainfrom
Conversation
5e40ab8 to
60d047a
Compare
_hooks_normalised skips normalisation after the first run, causing a TypeError when pre_hooks or post_hooks are reassigned on a reused Agent or Team between runs. Agno calls the raw BaseGuardrail object instead of its bound method. normalize_pre_hooks and normalize_post_hooks are cheap, so the optimisation is not worth the bug IMHO. PR Remove _hooks_normalised and normalise on every run.
60d047a to
4bfc891
Compare
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.
_hooks_normalisedskips normalisation after the first run, causing aTypeErrorwhenpre_hooksorpost_hooksare reassigned on a reusedAgentorTeambetween runs. Agno calls the rawBaseGuardrailobject instead of its bound method.normalize_pre_hooksandnormalize_post_hooksare cheap, so the optimisation is not worth the bug IMHO.Summary
Describe key changes, mention related issues or motivation for the changes.
Type of change
Checklist
./scripts/format.shand./scripts/validate.sh)