openclaw - 💡(How to fix) Fix Raw JSON tool call arrays leak as user-facing text on BlueBubbles (iMessage) channel [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#62183Fetched 2026-04-08 03:07:55
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
closed ×1

When the LLM outputs tool calls as a JSON array (e.g. [{"name": "exec", "arguments": {...}}]), the reply pipeline delivers the raw JSON string to BlueBubbles as an iMessage before the tools execute. The user receives the full tool call JSON as a chat message.

Root Cause

extractAssistantText() in pi-embedded-BYdcxQ5A.js (line ~4916) calls sanitizeUserFacingText() which strips [Tool Call:...] markers and thinking tags, but does not strip raw JSON arrays that start with [{"name": "exec" — the format used by Claude tool calling.

The stripDowngradedToolCallText() function (in minimax-vlm-uN3pFvTM.js:96) only matches the [Tool Call: ...] text marker format, not raw JSON arrays.

Fix Action

Workaround

Added a regex check at the top of sanitizeUserFacingText() that returns "" when the text matches a raw JSON tool call array pattern. This patch gets overwritten on npm update.

RAW_BUFFERClick to expand / collapse

Version

2026.4.2

Description

When the LLM outputs tool calls as a JSON array (e.g. [{"name": "exec", "arguments": {...}}]), the reply pipeline delivers the raw JSON string to BlueBubbles as an iMessage before the tools execute. The user receives the full tool call JSON as a chat message.

Root cause

extractAssistantText() in pi-embedded-BYdcxQ5A.js (line ~4916) calls sanitizeUserFacingText() which strips [Tool Call:...] markers and thinking tags, but does not strip raw JSON arrays that start with [{"name": "exec" — the format used by Claude tool calling.

The stripDowngradedToolCallText() function (in minimax-vlm-uN3pFvTM.js:96) only matches the [Tool Call: ...] text marker format, not raw JSON arrays.

Reproduction

  1. Message the assistant on BlueBubbles/iMessage
  2. Ask it to do something that requires tool execution (e.g. "run ls")
  3. The raw [{"name": "exec", "arguments": {"command": "ls"}}] JSON is sent as an iMessage to the user

Expected

Tool call JSON should be suppressed from channel delivery. Only the assistant natural language text should be sent.

Affected file

pi-embedded-helpers-CGU2Pfj9.jssanitizeUserFacingText() (line 973)

Workaround

Added a regex check at the top of sanitizeUserFacingText() that returns "" when the text matches a raw JSON tool call array pattern. This patch gets overwritten on npm update.

extent analysis

TL;DR

Modify the sanitizeUserFacingText() function to strip raw JSON arrays that start with [{"name": "exec" to prevent them from being sent as iMessages.

Guidance

  • Update the sanitizeUserFacingText() function in pi-embedded-helpers-CGU2Pfj9.js to include a regex check for raw JSON tool call arrays.
  • Ensure the stripDowngradedToolCallText() function in minimax-vlm-uN3pFvTM.js is also updated to match the new format.
  • Verify that the updated function correctly suppresses tool call JSON from being sent as iMessages.
  • Consider making the workaround patch more robust to prevent it from being overwritten on npm update.

Example

// Example regex check to strip raw JSON tool call arrays
if (/^\[{"name":"exec"/.test(text)) {
  return "";
}

Notes

The current workaround may not be persistent across npm update operations, so a more permanent solution should be explored.

Recommendation

Apply workaround: Modify the sanitizeUserFacingText() function to include the regex check, as this will immediately address the issue, although a more permanent solution should be investigated to prevent the patch from being overwritten.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Raw JSON tool call arrays leak as user-facing text on BlueBubbles (iMessage) channel [1 participants]