openclaw - 💡(How to fix) Fix WebChat/Control UI duplicates assistant replies when auto-TTS appends assistant-media transcript entries [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#73234Fetched 2026-04-29 06:21:59
View on GitHub
Comments
2
Participants
3
Timeline
3
Reactions
0
Timeline (top)
commented ×2closed ×1

When WebChat / Control UI is used with auto-TTS enabled (messages.tts.auto or persisted TTS prefs set to always), assistant text replies can appear twice in chat history/transcripts.

The duplicate entry is not a second model generation. It appears to be an extra gateway-injected / assistant-media transcript entry appended after TTS adds a mediaUrl to the reply payload.

Root Cause

When WebChat / Control UI is used with auto-TTS enabled (messages.tts.auto or persisted TTS prefs set to always), assistant text replies can appear twice in chat history/transcripts.

The duplicate entry is not a second model generation. It appears to be an extra gateway-injected / assistant-media transcript entry appended after TTS adds a mediaUrl to the reply payload.

Fix Action

Temporary workaround

Set TTS auto mode to tagged or off instead of always. This prevents ordinary text replies from being turned into media-bearing payloads and avoids the duplicate text entry.

RAW_BUFFERClick to expand / collapse

Summary

When WebChat / Control UI is used with auto-TTS enabled (messages.tts.auto or persisted TTS prefs set to always), assistant text replies can appear twice in chat history/transcripts.

The duplicate entry is not a second model generation. It appears to be an extra gateway-injected / assistant-media transcript entry appended after TTS adds a mediaUrl to the reply payload.

Environment

  • OpenClaw: 2026.4.25 (aa36ee6)
  • Surface: WebChat / Control UI
  • Runtime: direct main/agent sessions
  • TTS: enabled, auto mode always
  • Observed across multiple agents/sessions, not limited to one agent

What I observed

For one assistant response, the transcript/history contains two consecutive assistant messages with the same visible text:

  1. Normal assistant final answer
    • provider/model example: openai-codex / gpt-5.x
    • has normal model responseId
  2. Injected media mirror
    • provider/model: openclaw / gateway-injected
    • idempotencyKey ends with :assistant-media
    • visible text is the same as the previous assistant message

This makes the UI show the same assistant reply twice.

Likely cause

Current suspected flow:

  1. Assistant generates a normal text final answer.
  2. Auto-TTS (auto=always) runs via maybeApplyTtsToPayload(...) and adds mediaUrl to the reply payload.
  3. WebChat sees a media-bearing payload.
  4. appendWebchatAgentMediaTranscriptIfNeeded(...) appends an additional transcript message for the media payload.
  5. The appended assistant-media message includes the same transcript text as the original final answer.
  6. Chat history / Control UI renders both as visible assistant text.

Relevant code areas from the built distribution:

  • maybeApplyTtsToPayload(...)
  • isMediaBearingPayload(...)
  • appendWebchatAgentMediaTranscriptIfNeeded(...)
  • appendAssistantTranscriptMessage(...) with idempotencyKey: ...:assistant-media

Expected behavior

When TTS adds audio/media to an assistant reply, the text should not be duplicated in WebChat / Control UI history.

Possible expected outcomes:

  • attach/associate the media with the existing assistant response, or
  • append a media-only transcript entry without repeating the same visible text, or
  • have WebChat/history rendering collapse/filter assistant-media entries when their visible text exactly matches the preceding assistant final answer.

Actual behavior

The same assistant text appears twice:

  • once as the original model final answer
  • once as a gateway-injected assistant-media mirror entry

Temporary workaround

Set TTS auto mode to tagged or off instead of always. This prevents ordinary text replies from being turned into media-bearing payloads and avoids the duplicate text entry.

Notes

There may be a separate older duplication class involving append-only branch history / inactive branch reads, but this report is specifically about the current auto TTS -> assistant-media transcript append -> duplicate visible text behavior.

extent analysis

TL;DR

The most likely fix is to modify the appendWebchatAgentMediaTranscriptIfNeeded function to check for and prevent duplicate text entries when auto-TTS is enabled.

Guidance

  • Review the maybeApplyTtsToPayload function to ensure it correctly adds mediaUrl to the reply payload without triggering duplicate text entries.
  • Investigate the appendWebchatAgentMediaTranscriptIfNeeded function to determine why it appends an additional transcript message with the same text as the original final answer.
  • Consider modifying the appendAssistantTranscriptMessage function to include a check for idempotencyKey ending with :assistant-media and skip appending the message if the text is a duplicate.
  • Verify that the isMediaBearingPayload function correctly identifies media-bearing payloads and does not contribute to the duplicate text entry issue.

Example

// Example of how to check for duplicate text entries in appendWebchatAgentMediaTranscriptIfNeeded
if (isMediaBearingPayload(payload) && payload.text === previousAssistantText) {
  // Skip appending the message if the text is a duplicate
  return;
}
appendAssistantTranscriptMessage(payload, 'assistant-media');

Notes

The provided temporary workaround of setting TTS auto mode to tagged or off may not be a permanent solution, and further investigation is needed to resolve the root cause of the issue.

Recommendation

Apply a workaround by modifying the appendWebchatAgentMediaTranscriptIfNeeded function to prevent duplicate text entries, as this is a more targeted solution than disabling auto-TTS entirely.

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

Temporary workaround

Set TTS auto mode to tagged or off instead of always. This prevents ordinary text replies from being turned into media-bearing payloads and avoids the duplicate text entry.

Expected behavior

When TTS adds audio/media to an assistant reply, the text should not be duplicated in WebChat / Control UI history.

Possible expected outcomes:

  • attach/associate the media with the existing assistant response, or
  • append a media-only transcript entry without repeating the same visible text, or
  • have WebChat/history rendering collapse/filter assistant-media entries when their visible text exactly matches the preceding assistant final answer.

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 WebChat/Control UI duplicates assistant replies when auto-TTS appends assistant-media transcript entries [2 comments, 3 participants]