openclaw - ✅(Solved) Fix [Bug]: <think> and <final> tags appear in openclaw-control-ui even when thinkingDefault is "off". [1 pull requests, 1 comments, 2 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#77879Fetched 2026-05-06 06:19:52
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
2
Timeline (top)
commented ×1cross-referenced ×1labeled ×1mentioned ×1

The UI initially renders a clean message but then overwrites it with the tagged version, suggesting a post-render race condition.

Root Cause

The UI initially renders a clean message but then overwrites it with the tagged version, suggesting a post-render race condition.

Fix Action

Fixed

PR fix notes

PR #78026: fix(control-ui): strip <think>/<final> tags from rendered assistant text

Description (problem / solution / changelog)

Summary

  • renderGroupedMessage reads message.content[].text directly via normalizeMessage, so the streaming bubble and any non-streaming history message can render raw <think> / <final> scaffolding the model emitted as text.
  • Run the assembled assistant text through stripThinkingTags (internal-scaffolding profile, already used elsewhere in the chat extractor) before it becomes markdown. User and tool roles are unchanged.
  • Adds two regression tests covering both renderStreamingGroup and the non-streaming renderMessageGroup path.

Closes #77879

Testing

  • pnpm vitest run ui/src/ui/chat/grouped-render.test.ts (37/37, includes 2 new)
  • pnpm vitest run ui/src/ui/chat (205/205)
  • pnpm vitest run ui/src/ui/views/chat.test.ts (28/28)

Real behavior proof

  • Behavior or issue addressed: Issue #77879 reports literal <think> and <final> tags appearing in openclaw-control-ui chat bubbles even when thinkingDefault is "off". The two new tests fail on origin/main (text content includes the tag bodies) and pass after this patch.
  • Real environment tested: Local OpenClaw checkout from this PR branch on macOS (Darwin 25.5.0) at HEAD f25a2824ec81a022727559a6ad1a8e8633ccd77e. Vitest runs from the branch worktree against the changed UI module.
  • Exact steps or command run after this patch:
    pnpm vitest run ui/src/ui/chat/grouped-render.test.ts
    pnpm vitest run ui/src/ui/chat
  • Evidence after fix:
     Test Files  1 passed (1)
          Tests  37 passed (37)
       Start at  15:06:14
       Duration  1.11s
    
     Test Files  17 passed (17)
          Tests  205 passed (205)
  • Observed result after fix: Streaming and non-streaming assistant bubbles render "Visible answer" / "Done." without the surrounding tags or the in-tag content; tool and user message rendering paths are untouched.
  • What was not tested: A live multi-turn streaming session against google/gemini-flash-3 was not run; this is a UI-side render fix, and the hosted control-ui smoke is covered by CI.

Changed files

  • ui/src/ui/chat/grouped-render.test.ts (modified, +38/-0)
  • ui/src/ui/chat/grouped-render.ts (modified, +9/-1)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

The UI initially renders a clean message but then overwrites it with the tagged version, suggesting a post-render race condition.

Steps to reproduce

use chat in openclw-control-ui.

Expected behavior

<think> and <final> tags get stripped from output

Actual behavior

<think> and <final> tags appear in output

OpenClaw version

2026.5.4 (325df3e)

Operating system

Ubuntu Linux 6.8.0, Node v22.22.0

Install method

No response

Model

google/gemini-flash-3

Provider / routing chain

openclaw -> google

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Affected: users on web-ui Severiy: annoying Frequnecy: always Consequences: harder to read

Additional information

No response

extent analysis

TL;DR

The issue can be resolved by ensuring that the UI rendering is properly synchronized to prevent the post-render race condition that overwrites the clean message with the tagged version.

Guidance

  • Investigate the rendering logic in the openclw-control-ui to identify the source of the race condition and ensure that the <think> and <final> tags are stripped from the output before it is rendered.
  • Verify that the issue is specific to the google/gemini-flash-3 model and the openclaw provider, and test with other models and providers to determine if the issue is isolated.
  • Check the UI code for any asynchronous operations that may be causing the race condition and consider using synchronization mechanisms such as callbacks or promises to ensure that the rendering is properly sequenced.
  • Test the UI with a simplified output to determine if the issue is related to the complexity of the output or the rendering process itself.

Example

No code example is provided as the issue does not include specific code snippets or APIs that can be used to illustrate the solution.

Notes

The issue may be related to the specific version of the openclw-control-ui or the google/gemini-flash-3 model, and upgrading to a newer version or using a different model may resolve the issue. However, without further information, it is difficult to determine the root cause of the problem.

Recommendation

Apply workaround: The issue can be mitigated by modifying the UI rendering logic to strip the <think> and <final> tags from the output before it is rendered, or by using a different model or provider that does not exhibit this behavior.

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

<think> and <final> tags get stripped from output

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]: <think> and <final> tags appear in openclaw-control-ui even when thinkingDefault is "off". [1 pull requests, 1 comments, 2 participants]