openclaw - ✅(Solved) Fix [Bug]: WebChat renders raw <tool_call> XML tags in chat bubbles - v2026.4.2 [2 pull requests, 2 comments, 3 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#60494Fetched 2026-04-08 02:50:25
View on GitHub
Comments
2
Participants
3
Timeline
13
Reactions
0
Timeline (top)
referenced ×5commented ×2cross-referenced ×2labeled ×2

After updating to v2026.4.2, WebChat renders raw <tool_call> and <function_calls> XML tags visibly in chat bubbles every time NEXUS uses a tool. Tried /verbose off, /reasoning off, and /new — issue persists. Telegram works fine with no XML showing.

Additionally, NEXUS frequently stops responding mid-task after tool calls and does not continue unless the user manually sends a follow-up message. This appears related to the same tool-call rendering regression.

Root Cause

After updating to v2026.4.2, WebChat renders raw <tool_call> and <function_calls> XML tags visibly in chat bubbles every time NEXUS uses a tool. Tried /verbose off, /reasoning off, and /new — issue persists. Telegram works fine with no XML showing.

Additionally, NEXUS frequently stops responding mid-task after tool calls and does not continue unless the user manually sends a follow-up message. This appears related to the same tool-call rendering regression.

Fix Action

Fixed

PR fix notes

PR #60547: fix(webchat): strip raw <tool_call> and <function_calls> XML from chat bubbles [AI-assisted]

Description (problem / solution / changelog)

Summary

WebChat renders raw <tool_call> and <function_calls> XML tags visibly in chat bubbles when models emit tool calls as text instead of structured blocks. This is a regression in v2026.4.2 (worked in v2026.3.31).

Telegram and other channels are unaffected because the server-side pipeline already strips these, but the WebChat UI rendering path (stripAssistantInternalScaffolding in assistant-visible-text.ts) did not handle these tag families.

What this PR does

Adds stripGenericToolCallXml to the shared assistant-visible-text stripping pipeline. The function:

  • Strips <tool_call>...</tool_call> blocks (exact pattern from reporter's logs)
  • Strips <function_calls>...</function_calls> and <function_call>...</function_call> blocks
  • Strips stray/unpaired tags
  • Preserves tags inside code fences and inline code

What this PR does NOT do

The reporter also mentions "NEXUS frequently stops responding mid-task after tool calls." That is a separate tool execution pipeline issue, not a display bug, and should be tracked independently.

This PR also does not address the root cause of why tool calls end up as XML text in the assistant message content. It adds defense-in-depth stripping on the display path, consistent with how the server-side pipeline already handles similar leaks (Minimax, model special tokens, downgraded tool calls).

Files changed

FileChange
src/shared/text/tool-call-tags.tsNewstripGenericToolCallXml with code-fence awareness
src/shared/text/tool-call-tags.test.tsNew — 9 tests including exact reporter log patterns
src/shared/text/assistant-visible-text.ts2 lines — import + call in stripping pipeline
src/shared/text/assistant-visible-text.test.ts3 test cases for integration coverage

Test plan

  • pnpm build passes
  • pnpm test passes (11,059 passed, 0 failed)
  • pnpm check has a pre-existing tsgo failure in src/channels/plugins/status.ts (verified identical on clean main)
  • Tested against exact strings from reporter's logs — all <tool_call> blocks stripped, natural language preserved
  • Verified code-fence and inline-code preservation
  • No CODEOWNERS-restricted files touched
  • Verify fixed behavior in a running WebChat instance (cannot reproduce locally — no running OpenClaw gateway available)

AI disclosure

  • AI-assisted (Claude, via Cursor)
  • Degree of testing: fully testedpnpm build, pnpm test (11,059/11,059), exact reporter log verification
  • I understand what the code does
  • No Codex access — could not run codex review --base origin/main

Closes #60494

Made with Cursor

Changed files

  • src/shared/text/assistant-visible-text.test.ts (modified, +23/-0)
  • src/shared/text/assistant-visible-text.ts (modified, +3/-1)
  • src/shared/text/tool-call-tags.test.ts (added, +108/-0)
  • src/shared/text/tool-call-tags.ts (added, +61/-0)

PR #60619: fix(outbound): strip leaked <tool_call> XML tags from chat bubbles

Description (problem / solution / changelog)

Summary

Since v2026.4.2, WebChat renders raw <tool_call> and <function_calls> XML tags in chat bubbles when the model emits them as plain text. Telegram is unaffected because it uses a different delivery pipeline.

Root cause: stripAssistantInternalScaffolding() only strips <thinking> and <relevant_memories> tags — it does not handle tool-call XML tags that models sometimes leak into text content.

Fix: Add stripToolCallXmlTags() to the sanitization pipeline in assistant-visible-text.ts:

  • Strips full blocks: <tool_call>...</tool_call>, <function_calls>...</function_calls>
  • Strips lone opening/closing tags
  • Also integrates stripModelSpecialTokens() for <|...|> style markers

This fixes all channels at once since they all flow through stripAssistantInternalScaffolding().

Fixes #60494

Test plan

  • Verify <tool_call> XML tags no longer appear in WebChat bubbles
  • Verify <function_calls> blocks are stripped
  • Verify normal text and code blocks are preserved
  • Run existing assistant-visible-text.test.ts tests

🤖 Generated with Claude Code

Changed files

  • CHANGELOG.md (modified, +1/-22)
  • src/shared/text/assistant-visible-text.test.ts (modified, +268/-0)
  • src/shared/text/assistant-visible-text.ts (modified, +242/-1)
  • src/shared/text/model-special-tokens.ts (added, +47/-0)

Code Example

openclaw-control-ui
3:00 PM



Let me check the recent memory files now.

<tool_call> {"name": "find", "arguments": {"pattern": "memory/2026-04-0*.md", "path": "/root/.openclaw/workspace"}} </tool_call> <tool_call> {"name": "find", "arguments": {"pattern": "memory/2026-03-3*.md", "path": "/root/.openclaw/workspace"}} </tool_call>


⚙️ Reasoning visibility disabled.

NEXUS (Network Expert for Universal Storage Soluti
3:00 PM
3
141
W10.5k
0% ctx
claude-opus-4-6


/reasoning off

You
3:03 PM



⚙️ Reasoning visibility disabled.

NEXUS (Network Expert for Universal Storage Soluti
3:03 PM


/new

You
3:03 PM



Good afternoon. NEXUS is online and ready. What do you need?

NEXUS (Network Expert for Universal Storage Soluti
3:03 PM


We were just workin gon some stuff. What was it?

You
3:04 PM



Let me check the recent notes.

<tool_call> {"name": "read", "arguments": {"file_path": "/root/.openclaw/workspace/memory/2026-04-03.md"}} </tool_call> <tool_call> {"name": "read", "arguments": {"file_path": "/root/.openclaw/workspace/memory/2026-04-02.md"}} </tool_call> <tool_call> {"name": "read", "arguments": {"file_path": "/root/.openclaw/workspace/memory/2026-04-01.md"}} </tool_call>
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

After updating to v2026.4.2, WebChat renders raw <tool_call> and <function_calls> XML tags visibly in chat bubbles every time NEXUS uses a tool. Tried /verbose off, /reasoning off, and /new — issue persists. Telegram works fine with no XML showing.

Additionally, NEXUS frequently stops responding mid-task after tool calls and does not continue unless the user manually sends a follow-up message. This appears related to the same tool-call rendering regression.

Steps to reproduce

  1. Update to OpenClaw v2026.4.2
  2. Open WebChat UI
  3. Send any message that requires NEXUS to use a tool (e.g. "check my gmail" or "what time is it")
  4. Observe raw <tool_call> or <function_calls> XML tags visible in chat bubble
  5. Tried /verbose off, /reasoning off, /new — issue persists

Expected behavior

Tool calls should be hidden from the user. Only the final text response should be visible in chat bubbles, as it worked in v2026.3.31.

Actual behavior

Raw XML tags (<tool_call> and <function_calls>) are rendered visibly in every chat bubble when NEXUS executes a tool. Additionally, NEXUS frequently stops responding after tool calls and requires a manual follow-up message to continue.

OpenClaw version

2026.4.2

Operating system

WSL2 Ubuntu / Windows 11

Install method

npm global

Model

anthropic/claude-sonnet-4-6

Provider / routing chain

openclaw -> anthropic

Additional provider/model setup details

Direct Anthropic API connection. No proxy or gateway routing.

Logs, screenshots, and evidence

openclaw-control-ui
3:00 PM



Let me check the recent memory files now.

<tool_call> {"name": "find", "arguments": {"pattern": "memory/2026-04-0*.md", "path": "/root/.openclaw/workspace"}} </tool_call> <tool_call> {"name": "find", "arguments": {"pattern": "memory/2026-03-3*.md", "path": "/root/.openclaw/workspace"}} </tool_call>


⚙️ Reasoning visibility disabled.

NEXUS (Network Expert for Universal Storage Soluti
3:00 PM
↑3
↓141
W10.5k
0% ctx
claude-opus-4-6


/reasoning off

You
3:03 PM



⚙️ Reasoning visibility disabled.

NEXUS (Network Expert for Universal Storage Soluti
3:03 PM


/new

You
3:03 PM



Good afternoon. NEXUS is online and ready. What do you need?

NEXUS (Network Expert for Universal Storage Soluti
3:03 PM


We were just workin gon some stuff. What was it?

You
3:04 PM



Let me check the recent notes.

<tool_call> {"name": "read", "arguments": {"file_path": "/root/.openclaw/workspace/memory/2026-04-03.md"}} </tool_call> <tool_call> {"name": "read", "arguments": {"file_path": "/root/.openclaw/workspace/memory/2026-04-02.md"}} </tool_call> <tool_call> {"name": "read", "arguments": {"file_path": "/root/.openclaw/workspace/memory/2026-04-01.md"}} </tool_call>

Impact and severity

Affected: All WebChat users on v2026.4.2 Severity: High (blocks workflow — raw XML clutters every tool response) Frequency: Always — happens on every tool call consistently Consequence: Difficult to use WebChat; agent also stops responding after tool calls requiring manual intervention

Additional information

Last known good version: 2026.3.31. First known bad version: 2026.4.2. Tried /verbose off, /reasoning off, /new — none resolved it. Issue only affects WebChat — Telegram doesn't display the issues but stops and doesn't respond unless provoked.

extent analysis

TL;DR

Downgrade to v2026.

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…

FAQ

Expected behavior

Tool calls should be hidden from the user. Only the final text response should be visible in chat bubbles, as it worked in v2026.3.31.

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 - ✅(Solved) Fix [Bug]: WebChat renders raw <tool_call> XML tags in chat bubbles - v2026.4.2 [2 pull requests, 2 comments, 3 participants]