Repository navigation
fix(gateway): TTS audio shows as a separate "Audio reply" message until reload - #148696
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed September 15, 2026, 1:04 AM ET / 05:04 UTC (Revision 5). ClawSweeper reviewWhat this changesThe Gateway requests a full history refresh when delayed speech arrives, allowing existing projection logic to attach audio to the original answer, and adds regression coverage to browser CI. Merge readiness⛔ Blocked before merge - 2 items remain This remains a useful fix for a current history-reconciliation bug, with no blocking code finding. The previously requested visual proof remains incomplete: the after screenshot still omits the original answer text. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway converts stored conversation records into messages displayed by Control UI. Incremental history normally appends new records; speech supplements need the earlier answer available so the existing full-history projection can combine text and audio. flowchart TD
A[Stored assistant answer] --> D[Full history projection]
B[Delayed speech supplement] --> C[Incremental history reader]
C --> E{Speech supplement detected}
E -->|Yes| F[Reset cursor and refresh history]
F --> D
E -->|No| G[Append ordinary messages]
D --> H[One answer with text and audio]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +17, Tests +443, Config +1. Total +461 across 9 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Mantis proof suggestionA targeted Control UI capture could resolve the remaining text-and-audio visual proof gap. A maintainer can ask Mantis to capture proof by posting this exact PR comment: Technical reviewBest possible solution: Keep speech matching in the existing full-history projection and use cursor invalidation to make live chat converge to the same text-and-audio result as reload. Do we have a high-confidence way to reproduce the issue? Yes, from source: append a marked speech supplement after saving the answer cursor, then request incremental history; current main projects it without the earlier answer. Runtime tests were not executed in this read-only review. Is this the best way to solve the issue? Yes. Reusing the existing reset response and full-history matcher is a narrow repair that avoids browser-side matching, transcript rewrites, or new configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 530ce231326b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
b84365d to
66ddf0e
Compare
|
landpr-approve-admin-merge |
|
landpr-approve-admin-merge |
|
landpr-approve-unrelated-red |
|
Thanks @LiuwqGit! Proof: In browser chat with local speech, the original answer keeps one playable audio attachment live and after reload. Delayed speech, a second spoken turn, and speech disabled also pass.
One hosted check exhausted its 8 GiB heap in |
…il reload (openclaw#148696) ## What Problem This Solves Local chat displayed generated speech as a separate “Audio reply” until reload. Closes openclaw#148680. ## Why This Change Was Made Cursor history now recognizes stored speech supplements after projecting display content, then requests the existing full-history merge. This state has one writer: the transcript owner. Speech matching stays in the full-history projection. Production growth: history classifier +9 lines; projection export +1; cursor reset +7. Growth accepted under the owner's standing acceptance (2026-09-15). ## User Impact The original answer keeps one playable WAV during live chat and after refresh. ## Evidence A served Control UI with local speech reproduced the separate row on `f272cd6ee9c5`. The repaired browser flow preserves the text and attaches audio without reload. Playback, delayed speech after the answer cursor, reload, a second speech turn, and speech off pass. Before (generated filename hidden):  After (generated filename hidden):  ## Compatibility Uses existing transcript fields and the existing reset response. ## Consumers Foreground chat and background history refresh use the same Gateway reader. ## Invalidation A supplement resets the cursor; a full page applies the existing text/audio merge. ## Tests The hosted browser command now selects the speech regression. Nine focused registration and serial-ownership checks pass. 99 Gateway tests pass on the merge with main. The registered browser regression fails on main and passes on the candidate: `node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-tts-supplement.real-gateway.e2e.test.ts` AI-assisted. ## Evidence detail The browser regression fails on baseline `f272cd6ee9c5c7503b90c1f604c3b523831e0517`: the original answer contains no audio player after speech completes. It passes on repair `a4bd39cc5040a8e816ee4cb06fee7b8763f5d637`, whose production code is unchanged at `57d2e52aaa79ac7198555f09fd51d324a1b499bd`. Later test cleanup preserves the prompts and assertions. The repair includes main through merge `b42eb0ff31015162c150820bc2170a5513e74494`, with parents `66ddf0e78e90dfe4085fb50253c88b160a14a847` and `f272cd6ee9c5c7503b90c1f604c3b523831e0517`. On that integrated source, 22 history-reader tests and 77 Gateway owner and sibling tests pass. The browser test runs once in `ui-e2e-serial-standalone` and covers delayed speech after the answer cursor, playback, reload, a second spoken turn and speech disabled. The full-history projection remains the sole speech-to-answer matcher. Cursor history only detects when it must request that projection. The original answer retains its identity; model replay still excludes display-only attachments. No configuration, storage or public protocol changes are required. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Local chat displayed generated speech as a separate “Audio reply” until reload. Closes #148680.
Why This Change Was Made
Cursor history now recognizes stored speech supplements after projecting display content, then requests the existing full-history merge. This state has one writer: the transcript owner. Speech matching stays in the full-history projection.
Production growth: history classifier +9 lines; projection export +1; cursor reset +7. Growth accepted under the owner's standing acceptance (2026-09-15).
User Impact
The original answer keeps one playable WAV during live chat and after refresh.
Evidence
A served Control UI with local speech reproduced the separate row on
dc260de0ca70. The repaired browser flow preserves the text and attaches audio without reload. Playback, delayed speech after the answer cursor, reload, a second speech turn, and speech off pass.Before (generated filename hidden):

After (generated filename hidden):

Compatibility
Uses existing transcript fields and the existing reset response.
Consumers
Foreground chat and background history refresh use the same Gateway reader.
Invalidation
A supplement resets the cursor; a full page applies the existing text/audio merge.
Tests
The hosted browser command now selects the speech regression. Nine focused registration and serial-ownership checks pass.
99 Gateway tests pass on the merge with main. The registered browser regression fails on main and passes on the candidate:
node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-tts-supplement.real-gateway.e2e.test.tsEvidence detail
The browser regression fails on baseline
dc260de0ca7098a8880938bd79a160df3305db57: the original answer contains no audio player after speech completes. It passes on repaira4bd39cc5040a8e816ee4cb06fee7b8763f5d637, whose production code is unchanged at57d2e52aaa79ac7198555f09fd51d324a1b499bd. Later test cleanup preserves the prompts and assertions.The repair includes main through merge
b42eb0ff31015162c150820bc2170a5513e74494, with parents66ddf0e78e90dfe4085fb50253c88b160a14a847anddc260de0ca7098a8880938bd79a160df3305db57. On that integrated source, 22 history-reader tests and 77 Gateway owner and sibling tests pass. The browser test runs once inui-e2e-serial-standaloneand covers delayed speech after the answer cursor, playback, reload, a second spoken turn and speech disabled.The full-history projection remains the sole speech-to-answer matcher. Cursor history only detects when it must request that projection. The original answer retains its identity; model replay still excludes display-only attachments. No configuration, storage or public protocol changes are required.