Port the surgical toolResult stripping from buyer-agent - #36
Open
aleksUIX wants to merge 1 commit into
Open
Conversation
patches/crewai_bedrock_fix.py has drifted between the two agent repos. buyer-agent's sanitizer strips only the toolResult blocks whose toolUseId has no matching toolUse in the preceding assistant message; the seller copy stripped ALL toolResult blocks in that case, discarding valid tool results along with the orphans and losing tool output from the conversation. This ports buyer's surgical version and brings the file to the union of both repos' fixes, byte-identical with the buyer-agent copy (a matching PR ports _patch_parse_native_tool_call there). Also documents the surgical-strip behavior in the sanitizer docstring.
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.
Problem
patches/crewai_bedrock_fix.pyhas drifted between buyer-agent and seller-agent, and each repo is missing the other's fix. The one seller-agent lacks: buyer's surgical toolResult stripping. When a user message carries toolResult blocks and at least one has no matching toolUse in the preceding assistant message, the seller copy strips ALL toolResult blocks and keeps only text. Valid tool results are discarded along with the orphans, so the model loses tool output it legitimately produced.Change
Ports buyer-agent's surgical version: only toolResult blocks whose
toolUseIdis absent from the preceding assistant message's toolUse set are stripped; matched toolResults and text blocks are kept. The file is now byte-identical with the buyer-agent copy, at the union of both repos' fixes; a matching PR to buyer-agent ports seller's_patch_parse_native_tool_callin the other direction, so the two copies stay in sync. One docstring bullet updated to match the behavior.Verification
Ran against installed crewai: patches apply cleanly, and for a user message carrying one matched and one orphaned toolResult, the sanitizer now keeps the matched block and the text block while stripping only the orphan (previously both toolResults were dropped).