Sanitize JSON tool-call payload text#14098
Open
helloember99 wants to merge 1 commit intoopenclaw:mainfrom
Open
Sanitize JSON tool-call payload text#14098helloember99 wants to merge 1 commit intoopenclaw:mainfrom
helloember99 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
centminmod
added a commit
to centminmod/clawdbot
that referenced
this pull request
Feb 11, 2026
bfc1ccb to
f92900f
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.
Summary
Testing
Greptile Overview
Greptile Summary
Adds defense against raw JSON tool-call payload leakage in text content. When local/Ollama providers downgrade tool calls to text (due to incompatibility or errors), the raw JSON can leak into user-facing surfaces. This PR introduces
stripJsonToolCallText()helper that detects and removes JSON objects/arrays matching tool-call structure (havingname+ one of:arguments,args,input,tool_input,parameters,payload). The helper is integrated into the streaming pipeline (pi-embedded-subscribe.ts), text extraction (extractAssistantText), and message sanitization (sanitizeTextContent). Test coverage includes both removal of tool payloads and preservation of legitimate JSON blobs.Confidence Score: 5/5
(2/5) Greptile learns from your feedback when you react with thumbs up/down!