fix(hooks): skip offload for empty-string tool results - #12584
fix(hooks): skip offload for empty-string tool results#12584Alphaxiaoteng wants to merge 2 commits into
Conversation
Empty string results were wrapped into TextContent before the emptiness check, so they were written as zero-byte files with a dangling Preview pointer. Treat "" like [] and leave them in context. Closes deepset-ai#12583 Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
@Alphaxiaoteng is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
|
|
|
I independently opened #12585 with what turns out to be the same patch (the test change is byte-identical — we both took the regression test from the issue verbatim). Closing mine in favour of this one since it came first. Two findings from my verification that might be worth having on the record here: 1. This is reachable from a normal Agent run, not just a hand-built message. Worth stating explicitly because the fix hinges on 2. One adjacent shape still produces the reported symptom. A non-empty list whose blocks are all empty text — if not result.result or all(isinstance(b, TextContent) and not b.text for b in content_blocks):
return messageThe issue explicitly considered and set that aside as reading further from the docstring's "the result is empty" than the raw-value check does, so this PR matches the issue's chosen scope — just flagging it so the maintainers can decide deliberately rather than by omission. Verification (same diff as here): against pre-fix — so it's a real regression test, not just a passing assertion. With the change, |
|
Hi @Alphaxiaoteng, thanks a lot for your contribution! 🙏 We noticed that the Contributor License Agreement (CLA) check ( To get your PR reviewed, please sign the CLA via the link in the |
Related Issues
Proposed Changes:
_maybe_offloadwrapped string results into[TextContent(...)]before the emptiness check, soresult=""became a one-element list and was offloaded as a zero-byte file with a danglingPreview:pointer. Empty lists already returned early. Checkif not result.resultbefore wrapping so""and[]are both left in context.How did you test it?
2 passed (
empty_string,empty_list).Notes for the reviewer
This PR was fully generated with an AI assistant. I have reviewed the changes and run the relevant tests.
Checklist
Made with Cursor