openclaw - ✅(Solved) Fix TTS audio generated but not played in WebChat (broadcastChatFinal drops media) [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#81468Fetched 2026-05-14 03:31:48
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Author
Timeline (top)
commented ×1cross-referenced ×1

Root Cause

Two issues in dist/chat-*.js:

Fix Action

Fixed

PR fix notes

PR #81470: fix(webchat): include TTS audio in broadcastChatFinal when media already appended

Description (problem / solution / changelog)

Problem

When appendWebchatAgentMediaTranscriptIfNeeded has already appended TTS audio to the session transcript, the broadcast phase clears rawFinalPayloads to an empty array:

const rawFinalPayloads = appendedWebchatAgentMedia ? [] : deliveredReplies.filter(...)

This causes both buildAssistantDisplayContentFromReplyPayloads([]) and buildWebchatAssistantMediaMessage([]) to return undefined, so the broadcast WebSocket message contains no audio (or text) content — even though the audio file is correctly generated on disk.

Fix

  1. Always include delivered payloads — removes the appendedWebchatAgentMedia ? [] : check so rawFinalPayloads always has the reply payloads
  2. Deduplicate transcript entries — adds idempotencyKey: \${clientRunId}:assistant-media`to the broadcast'sappendAssistantTranscriptMessagecall, preventing duplicate transcript entries sinceappendWebchatAgentMediaTranscriptIfNeeded` already appended the audio content earlier in the pipeline

The appendAssistantTranscriptMessage function already supports idempotencyKey for deduplication (see line 1385 of chat.ts).

Testing

  • TTS audio files confirmed generated and valid (media/outbound/voice-*.mp3)
  • The assistant-media endpoint can serve audio via tickets
  • Issue originally filed at #81468

Changed files

  • src/gateway/server-methods/chat.ts (modified, +4/-5)

Code Example

const finalPayloads = appendedWebchatAgentMedia ? [] : deliveredReplies.filter(...)
RAW_BUFFERClick to expand / collapse

Bug Description

TTS audio files are generated correctly and stored in media/outbound/, but the WebChat frontend does not receive audio content in broadcast messages. The audio is only visible in chat.history responses (where base64 data is stripped) and never included in the real-time WebSocket broadcastChatFinal payload.

Root Cause

Two issues in dist/chat-*.js:

1. Broadcast payloads cleared

In the broadcastChatFinal section, when appendedWebchatAgentMedia is true, finalPayloads is set to an empty array:

const finalPayloads = appendedWebchatAgentMedia ? [] : deliveredReplies.filter(...)

This causes buildAssistantDisplayContentFromReplyPayloads([]) and buildWebchatAssistantMediaMessage([]) to both return undefined, so the broadcast message has no content at all.

Fix: Remove the appendedWebchatAgentMedia ? [] : prefix, always use deliveredReplies.

2. Duplicate session transcript entries

When the above fix is applied, the broadcast phase also calls appendAssistantTranscriptMessage which creates a duplicate session entry (the media transcript was already appended by appendWebchatAgentMediaTranscriptIfNeeded).

Fix: Add idempotencyKey to the broadcast's appendAssistantTranscriptMessage call. The function already supports idempotencyKey for deduplication.

Environment

  • OpenClaw version: 2026.5.7
  • Gateway: loopback-only (127.0.0.1:18789)
  • Channel: WebChat (Control UI)
  • TTS provider: microsoft (Edge TTS)
  • Config: auto: "always"

Additional Context

  • TTS audio files are confirmed generated and valid (verified via journalctl debug markers)
  • The assistant-media endpoint can serve audio via tickets
  • localMediaPreviewRoots is configured (includes /tmp/openclaw and media directory)

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 - ✅(Solved) Fix TTS audio generated but not played in WebChat (broadcastChatFinal drops media) [1 pull requests, 1 comments, 2 participants]