Repository navigation
fix: fall back to str() when a tool result's to_dict fails - #13843
Open
aryamangodara wants to merge 1 commit into
Open
aryamangodara wants to merge 1 commit into
aryamangodara wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
@aryamangodara is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
This branch has not been deployed
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.
Related Issues
Proposed Changes:
_result_to_stringpromises astr()fallback when a tool result can't be serialized, but the_serializable_valuecall (which callsresult.to_dict()) sat outside thetry. When anAgenttool returns an object whoseto_dictraises, is not callable, or needs arguments, the error escaped the fallback. It then went past theToolInvocationErrorhandling and stopped the whole Agent run, even withraise_on_failure=False.The fix moves the
_serializable_valuecall inside the existingtry, so these results get the documented warning andstr(result)conversion.coerce_tag_valueinhaystack/tracing/utils.pyalready guards the same call this way.The earlier PR for this issue (#13783) was auto-closed because its CLA was not signed.
How did you test it?
_result_to_string, covering ato_dictthat raises, one that isn't callable, and one that needs an argument. It also checks that the fallback warning is logged._run_tooltest: aToolreturning such an object now produces a normal tool result message ("<broken>", no error) instead of raising.mainand pass with the fix.test/components/agents/passes (378 passed), andhatch run fmtandhatch run test:typesare clean.Notes for the reviewer
This is a one-line move. The
except Exceptionblock and its warning are unchanged.Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.🤖 Generated with Claude Code