refactor: narrow Any-typed fields to concrete types across core models#4762
Open
greysonlalonde wants to merge 13 commits intomainfrom
Open
refactor: narrow Any-typed fields to concrete types across core models#4762greysonlalonde wants to merge 13 commits intomainfrom
greysonlalonde wants to merge 13 commits intomainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| def __exit__(self, *_: object) -> None: | ||
| token = _ALLOW_PICKLE_TOKEN.get() | ||
| if token is not None: | ||
| _ALLOW_PICKLE.reset(token) |
There was a problem hiding this comment.
Context manager fails on nested reentrant usage
Medium Severity
_AllowPickleDeserialization is documented as "reentrant" but isn't. On __enter__, it stores the _ALLOW_PICKLE reset token into _ALLOW_PICKLE_TOKEN but discards the token returned by _ALLOW_PICKLE_TOKEN.set(...). When nested, the inner __exit__ consumes the token, then the outer __exit__ reads the same (already-used) token from _ALLOW_PICKLE_TOKEN and calls _ALLOW_PICKLE.reset(token), raising a ValueError because the token was already consumed.
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.


Note
Medium Risk
Changes Pydantic schemas/serialization for
Crew/Taskcallbacks (now cloudpickle-based) and tightens core model types, which could affect compatibility and introduces opt-in pickle deserialization considerations.Overview
Narrows previously
Any-typed fields acrossCrewandFlow(LLM fields, memory types, tracing span, input provider) to concrete unions, and refactors related helpers/imports accordingly.Adds callback serialization support via new
SerializableCallable(cloudpickle+base64) and updatesTask.callback,Crew.step_callback, andCrew.task_callbackto use it; introduces optionalcrewai[pickling]extra (cloudpickle) with opt-in deserialization guard.Flow behavior is slightly adjusted around memory
remember()handling for list inputs andask()timeout handling, and tests are updated to patchLLMin the correct module and to use VCR cassettes for_collapse_to_outcomecoverage.Written by Cursor Bugbot for commit e869cdc. This will update automatically on new commits. Configure here.