Repository navigation
fix(tts): preserve free-text [[tts:...]] reply body - #137288
gaoanze888 wants to merge 1 commit into
Conversation
gpt-5.6 reads the inbound TTS hint as "wrap the reply in the tag" and emits the spoken reply as the [[tts:...]] directive body. extractTtsDirectiveFacts parsed that body as key=value tokens, found none, and stripped the tag, leaving the reply with no visible text — the channel then delivered the "No reply was generated" fallback. When the [[tts:...]] body contains no key=value directive, treat it as the spoken reply text (mirroring [[tts]]...[[/tts]] and [[tts:text]]...[[/tts:text]] which already carry their body as the spoken text), so the reply is shown and spoken instead of discarded.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed September 3, 2026, 8:10 AM ET / 12:10 UTC. ClawSweeper reviewWhat this changesThis PR changes TTS directive parsing so a Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 4 items remain The parser repair correctly preserves free-text directives for its direct path, but captioned deferred-final delivery still removes that same text, so the reported visible-reply failure remains on an important channel route. Priority: P1 Review scores
Verification
How this fits togetherTTS directives are extracted from assistant replies before delivery metadata and speech are prepared. Channels that defer a final voice message also stream-clean the original reply to derive its visible caption. flowchart LR
A[Assistant reply] --> B[TTS directive parser]
B --> C[Delivery facts]
C --> D[Speech payload]
A --> E[Deferred caption cleaner]
E --> F[Final channel caption]
D --> G[Voice delivery]
F --> G
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +12, Tests +78. Total +90 across 2 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. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Use one shared classification for free-text Do we have a high-confidence way to reproduce the issue? Yes, from source: a free-text Is this the best way to solve the issue? No: the direct parser change is appropriate, but it is not the best complete repair because deferred caption cleanup independently discards the same form. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4c4144d5ae68. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What 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
|
What Problem This Solves
When
tts.auto: "inbound", the system-prompt hint tells the model toUse [[tts:...]] and optional [[tts:text]]...[[/tts:text]] to control voice/expressiveness.gpt-5.6 (via an OpenAI-compatible proxy) reads that as "wrap the reply in the tag" and answers a voice note with, literally:extractTtsDirectiveFactsparsed the[[tts:...]]body askey=valuetokens, found none, stripped the tag, and the reply had no visible text.before_agent_finalizenever fired (no visible payload), and the channel received the fallback"No reply was generated for this message...". The transcript stored an empty assistant message withopenclawDelivery.tts.tagged: true.Reproduced by the reporter with
openclaw agent exec --model litellm/gpt-5.6-terrain 5 of 6 runs on one host and 2 of 3 on another (version 2026.8.1-beta.3;directive-factsunchanged in 2026.8.2).Fix
In
extractTtsDirectiveFacts, when a[[tts:...]]directive body contains nokey=valuetoken (i.e. the model used the tag to carry the spoken reply itself instead of emitting directives), treat the body as the spoken reply text instead of discarding it. This mirrors how[[tts]]...[[/tts]]and[[tts:text]]...[[/tts:text]]already carry their inner body as the spoken text, so all three forms are now consistent. The reply is both shown and spoken, and the empty-reply fallback is no longer reached.Key=value directives (
[[tts:speed=1.5]],[[tts:provider=openai speed=1.2]]) keep their existing behavior — the body is only preserved when there are no parseable directives.Closes #137281.
Evidence
src/tts/directive-facts.ts: the[[tts:...]]directive branch now returns the trimmed body (and setsfacts.text) when nokey=valuetokens are present, instead of always returning"".src/tts/directive-facts.test.ts(new): 9 cases covering the reported scenario and regressions:[[tts:Yes—I understand you clearly now.]]→cleanedTextpreserves the reply,facts.textset.[[tts:text]]...[[/tts:text]]block (unchanged), and plain text without TTS markup (unchanged).origin/main(64f4cdac8):npx vitest run src/tts/directive-facts.test.ts src/tts/directives.test.ts src/tts/directive-number.test.ts— 37 passed (15 new + 22 existing).npx vitest run src/tts/— 206 passed (18 files), no regression.npx tsc --noEmit -p tsconfig.core.json— only the pre-existingchat-turn-router.ts(188,7)false positive (symlinked@typesresolution; reproduces on pristineorigin/main, not visible to CI's real install).oxlint -c .oxlintrc.jsonon both files — clean.oxfmt --checkon both files — clean.Notes
[[tts:provider=openai hello]]) still strips the free-text fragment; that case is not produced by the reported failure and is left as-is to avoid changing directive-parsing semantics.