Repository navigation
fix(tts): preserve free-text [[tts:...]] reply across final and caption delivery (#137281) - #137329
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 maintainer review before merge. What this changesThe PR preserves free-text TTS tag bodies in final replies and voice-note captions while retaining directive and hidden-speech handling. Example: Automatic TTS receives [[tts:Here is your answer]].
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it repairs confirmed reply loss that remains on current main, has relevant live behavior evidence, and resolves the previous finding without introducing a verified defect. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherAssistant text enters the shared TTS parser and streaming cleaner; cleaned visible text and existing speech facts feed transcript storage, synthesis, and channel delivery. flowchart LR
A[Assistant text] --> B[TTS fact parser]
A --> C[Streaming cleaner]
B --> D[Transcript and speech facts]
C --> E[Visible reply and caption]
D --> F[Speech synthesis]
E --> G[Channel delivery]
F --> G
Technical reviewBest possible solution: Land the shared parser-and-caption repair through the existing PR after its required checks pass. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically removes [[tts:Here is your answer]] at both affected boundaries; the linked report adds official-release deployment confirmation, and this review executed no target code. Is this the best way to solve the issue? Repairing the existing shared owners covers both transcript preparation and deferred captions; changing prompt wording alone would leave the destructive parsing behavior reachable. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d75796172a24. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +42, Tests +100. Total +142 across 5 files. Added test files: 1. 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. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (11 earlier review cycles; latest 8 shown)
Reviewed October 13, 2026, 12:12 PM ET / 16:12 UTC (Revision 12). |
9f33f3c to
e61143a
Compare
e61143a to
09631ee
Compare
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
…on delivery (openclaw#137281) The inbound/automatic TTS hint can make a model wrap its spoken reply in a single [[tts:<prose>]] tag. The parsed final path parsed no key=value tokens and substituted empty text, and the deferred stream/caption cleaner treated every colon tag as a directive and dropped the body — so the reply reached the 'No reply was generated' fallback on immediate and deferred (Telegram voice-note) delivery alike. Add one shared predicate, bodyHasTtsDirectiveKeyValue: a colon body is speech overrides only when some token is key=value. The final parser now keeps the trimmed body as visible reply text when there is no directive value, and the stream cleaner (cleanDeferredFinalText's engine) emits a bare colon tag with no key=value as visible text, mirroring [[tts]]...[[/tts]] and [[tts:text]]...[[/tts:text]]. Free-text colon grammar matches the parser: any whitespace (including a line break) before/after the colon is accepted and the body is trimmed, so a single-line, multi-line, or leading-newline repro ([tts:\nhello]) stays visible on both owners. Real key=value directives and hidden [[tts:text]] blocks keep their behavior. A lone reserved [[tts:text]] marker (no [[/tts:text]] closer) is not treated as free prose: it stays audio-only, is dropped without setting facts.text, and surrounding prose stays visible, matching shipped main and the streaming cleaner. Regression: parsed, streamed, chunk-split, multiline, leading-newline-lone marker parser and deferred-caption cases; captioned dispatch test fails on main (visible caption emptied) and passes on head.
09631ee to
bcc0136
Compare
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 92b5443. Thanks @wangyan2026! Verified on the Telegram Test Server: free-text [[tts:...]] replies now keep their text and voice-note caption, and real directives behave as before. |
…on delivery (openclaw#137281) (openclaw#137329) fix(tts): keep free-text [[tts:...]] replies and voice captions When the model wrote a free-text `[[tts:<spoken reply>]]` tag, final parsing and the deferred caption cleaner both discarded the body, producing an empty reply or a voice note with no caption. The parser and the stream cleaner now share one body classification, so free-text speech is kept as visible text and caption. Real key=value directives, hidden speech blocks, reserved markers and existing code-literal behavior are unchanged. Proof: Telegram Test Server userbot with a built Gateway: on main the wrapped speech was lost from the voice caption; the candidate keeps combined and wrapped-only captions. The key=value, code-literal and hidden-speech controls match main. Fixes openclaw#137281. Thanks @wangyan2026. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #137281
What Problem This Solves
Fixes lost answers and missing voice-note caption text when automatic TTS receives a model reply wrapped in a free-text
[[tts:...]]tag.User Impact
Wrapped speech remains visible in the reply and Telegram voice-note caption instead of disappearing or becoming an empty-reply error. Real key=value directives, reserved
tts:textmarkers, hidden speech blocks, and existing code-caption behavior remain unchanged. No configuration or stored-data migration is required.Why This Change Was Made
Final parsing and streaming cleanup now use one free-text body classification. Recovery is guarded by the existing incremental Markdown scanner so code-literal bodies do not become newly visible prose. Hidden speech does not advance that scanner, and fence-state updates retain the full tag context that distinguishes code content from a closing fence. This is not the separate repair for existing code-caption stripping.
Redundant caption-wrapper tests were removed. Retained cases cover final parsing, multiline/leading-newline bodies, stream boundaries, code-literal parity, hidden speech, non-closing fence lines, and the ACP dispatcher.
Thanks to @wangyan2026 for the contributor fix and @eiriktorheim for the report. No overlap with Pash/Sarah changes was found in the affected files.
Evidence
Built, isolated Gateway; real Telegram Test Server userbot; automatic TTS in final mode. A scripted model supplied five requested replies, and a local speech endpoint supplied a one-second Opus fixture. These are native Telegram
messageVoiceNoteobservations, not mocked channel delivery. Each next model fixture waits for the previous native reply. Speech requests used the expected input text; the key=value control selected the requestedalloyvoice.Baseline:
fda581a1f5587726b01b7f11ad00da53a7fd7cbd. Its two production TTS files are unchanged in the merged main. Candidate:5cecfc4bfa3dc2a42a981add02a7dd2262fe17ae.Recorder timeline excerpts (elapsed from each recorder's start):
[[tts:Here is your answer]] Visible text.Visible text.Here is your answer Visible text.[[tts:Here is your answer]]Agent couldn't generate a response. Please try again.Here is your answer[[tts:voice=alloy]] Directive control.Directive control.Directive control.The fenced-code control containing
[[tts:Here is your answer]]was identical on baseline (+38.439s) and candidate (+42.099s):The existing stripping of the literal code example is intentionally unchanged, rather than converting its body into prose.
The speech-only Markdown control was also unchanged:
Both baseline (+50.708s) and candidate (+51.661s) delivered only
Visible.. Neither hidden body nor its tags appeared in the caption. Focused tests also cover a chunk boundary after the first hidden block and fence lines with trailing bracket markup. The longer final recording includes a later default heartbeat alert; it is outside the five native reply receipts above. A preliminary 60-second recording timed out during cold startup; the final run used a 180-second recording window.Focused verification: 93 tests passed across the parser, streaming cleaner, caption helper and ACP dispatcher suites (61.00s wall time). Targeted Oxfmt/Oxlint, the isolated build, and
git diff --checkpassed. Before the fix, eight focused parser/streaming cases failed because the wrapped body was removed.A separate real-provider check through the built CLI used OpenAI
gpt-5-miniwith minimal reasoning. It returnedHere is your answer Visible text.with a successful assistant attempt, no fallback, and a visible terminal reply. Credentials and all Gateway state were isolated; leases and secret files were released/removed after the runs.Patch size against the merge base: production +52/-10 (net +42), tests +101/-1 (net +100). Production growth is the shared classification and code-context guard; no new parsing subsystem. The original +177 test-line surface is reduced to the distinct cases above.
Merge risk: two-way door; reverting restores the prior text behavior without migrating state. Blast radius is free-text TTS recovery in automatic replies and their streamed/deferred captions.