Repository navigation
fix(tts): normalize streamed speech and report fallbacks - #125686
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 6:37 AM ET / 10:37 UTC. ClawSweeper reviewWhat this changesThis PR makes streamed TTS use the same Markdown-to-speech normalization as file synthesis, records genuine streaming failures across Discord file fallback, and stabilizes related UI and QA tests. Merge readinessKeep open for maintainer review: the core normalization repair is source-proven and the fallback warning is bounded, but accepting a new once-per-voice-session operator diagnostic is a product-policy choice. The PR is also behind current main, with exact-head checks still in progress. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherDiscord voice prepares an agent reply, attempts low-latency streamed TTS, and falls back to file synthesis when needed. Core TTS selects and invokes providers, while the Discord voice session owns playback and session-scoped diagnostics. flowchart TD
A[Discord voice reply] --> B[Speech preparation]
B --> C[Core streaming TTS]
C --> D{Stream succeeded?}
D -->|Yes| E[Discord playback]
D -->|No| F[File TTS fallback]
F --> G[Once-per-session warning]
G --> E
Decision needed
Why: The normalization repair follows an existing core invariant, but the new warning changes operator-facing diagnostic policy rather than repairing a mechanically required contract. Before merge
Agent review detailsSecurityNone. PR surfaceSource +55, Tests +121. Total +176 across 14 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the shared core normalizer and session-owned once-only failure fact if maintainers approve the diagnostic policy, then rebase and merge only after final-head checks pass. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main sends raw streaming text at src/tts/tts-streaming.ts:41 while buffered synthesis normalizes it at src/tts/tts-synthesis.ts:240. The supplied regression asserts the resulting provider input, but this read-only review did not execute it. Is this the best way to solve the issue? Yes for normalization: placing the existing canonical helper at the shared streaming owner matches buffered synthesis and covers every stream provider. The added warning remains conditional on maintainer approval of its operator-facing policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ee2027a927fa. LabelsLabel changes:
Label 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 (5 earlier review cycles)
|
af313af to
b7830db
Compare
b7830db to
9176b8f
Compare
9176b8f to
46f57f7
Compare
06c2787 to
12c020c
Compare
Streamed Discord voice now strips Markdown and raw link destinations like buffered synthesis. Record the first failed streaming provider and reason code before successful file fallback.
Drive the retry deterministically by advancing the exact 100 ms fake timer while preserving the ordering and outbox proof. Repairs CI run 32110130614 job 95627654678.
Address the ClawSweeper finding by retaining warning metadata only for actual failed attempts. Expected unsupported-for-streaming skips stay silent while real streaming failures still warn after successful file fallback.
Repairs CI run 32117859632 by invoking the markdown table handler directly with a targeted event and waiting for durable IndexedDB composer state before navigation or page close.
CI run 32120793258 exposed two owner-specific test assumptions. Preserve the child-session hover visibility and pointer assertions, then focus and activate its menu with Enter so an unrelated delayed hovercard cannot intercept the pointer. Assert the exact owned descendant PID is dead when QA cleanup completes instead of checking a globally reusable PGID.
CI run 32125741781 exposed the wall-clock race in the connected retry test.
12c020c to
05daedd
Compare
Land-ready proofReviewed head: This is ready for the repository-native prepare/merge workflow. The fix puts streaming speech normalization in the core TTS owner and keeps the once-per-session fallback diagnostic in the Discord voice-session owner. Production LOC is +33/-2 (net +31); tests and test support are +217/-72 (net +145). The absorbed CI repairs are test-only. Focused behavior proofThe core regression failed before the fix because the fallback stream received raw The test-only CI repairs were also exercised through their owning files: Fresh autoreviews after each code/test change reported no accepted or actionable findings. Live and CI proofLive ElevenLabs streaming synthesis produced Exact-head CI run 32127109183 completed successfully for ClawSweeper and owner decisionsThe latest completed review is under 12 hours old and has no actionable findings after the skipped-attempt fix. Its prior finding is resolved by selecting only an attempt whose outcome is The maintainer decision is to accept one operator warning per Discord voice session when a genuine streaming attempt fails and file synthesis succeeds. This preserves operator visibility without segment spam. The other rank-up move is also resolved: current-main comparison was refreshed through conflict-free rebases with stable patch IDs, and the current exact-head CI is green. A fresh current-head ClawSweeper review is queued/started, but repository policy does not block landing on the publisher; changes since the completed no-finding review are deterministic test-only CI repairs. Known gapThe live proof used real provider audio plus real transcription rather than joining a live Discord voice channel. That is the only known proof gap; it is covered at the Discord owner boundary by the 31/31 runtime file, explicit genuine-failure and expected-skip regressions, and exact-head CI. There are no hidden proof gaps, and no docs or changelog change is required under repository policy. |
|
Merged via squash.
|
…5686) * fix(tts): normalize streamed speech and report fallbacks Streamed Discord voice now strips Markdown and raw link destinations like buffered synthesis. Record the first failed streaming provider and reason code before successful file fallback. * test(ui): stabilize reconnect retry timing Drive the retry deterministically by advancing the exact 100 ms fake timer while preserving the ordering and outbox proof. Repairs CI run 32110130614 job 95627654678. * fix(discord): ignore expected TTS stream skips Address the ClawSweeper finding by retaining warning metadata only for actual failed attempts. Expected unsupported-for-streaming skips stay silent while real streaming failures still warn after successful file fallback. * test(ui): settle interaction state before assertions Repairs CI run 32117859632 by invoking the markdown table handler directly with a targeted event and waiting for durable IndexedDB composer state before navigation or page close. * test: remove incidental UI and process identities CI run 32120793258 exposed two owner-specific test assumptions. Preserve the child-session hover visibility and pointer assertions, then focus and activate its menu with Enter so an unrelated delayed hovercard cannot intercept the pointer. Assert the exact owned descendant PID is dead when QA cleanup completes instead of checking a globally reusable PGID. * test(ui): stabilize connected send retry timing CI run 32125741781 exposed the wall-clock race in the connected retry test.
What Problem This Solves
Fixes an issue where streamed Discord voice replies could speak Markdown syntax and raw link destinations that buffered synthesis strips before speech. It also resolves a silent failure mode where a streaming provider error was hidden when file synthesis succeeded as a fallback.
Why This Change Was Made
The core streaming TTS path passed raw input directly into provider attempts instead of applying the canonical speech-text normalization already used by buffered synthesis. The core TTS owner now normalizes streaming text at that boundary.
Discord voice also discarded the failed streaming attempt metadata before successful file fallback, leaving the session with no recordable explanation. The Discord voice owner now carries the failed provider and closed reason code across the fallback and records the first such fallback once per voice session. This preserves successful playback without repeated warnings.
ClawSweeper identified that expected
unsupported_for_streamingskips were still flowing into the warning path. That finding is addressed by selecting only the last attempt whose outcome isfailed: expected capability skips remain silent during successful buffered fallback, while actual failed attempts still preserve their warning metadata.AI-assisted maintainer repair; the implementation and focused evidence were reviewed before publication.
User Impact
Streamed Discord voice now reads cleaned speech instead of vocalizing Markdown markers or raw link destinations. When an actual streaming attempt fails but file synthesis succeeds, operators receive one useful warning per voice session naming the failed provider and reason code while playback continues normally. Buffered-only providers can use their expected file fallback without a misleading streaming-failure warning.
Evidence
## Keep [streaming Markdown](https://example.com) raw!!!!!; after the fix, it receivesKeep streaming Markdown raw!. The focused regression passes, andsrc/tts/tts-runtime-models.test.tspasses 7/7.provider=elevenlabsandreasonCode=provider_errorwhile file fallback succeeds.oxfmtandgit diff --checkare clean, and fresh Codex autoreview completed with no accepted or actionable findings.mp3_44100_128audio (42,258 bytes), and ElevenLabs STT transcribed it asStatus done. Read the release notes. The transcript contained no hash/hashtag/asterisk/URL/raw-URL speech.waitForFast's wall-clock timeout on the saturatedcompact-largeshard.finally. The focused test passed locally, a bounded worker loop passed 10/10, and fresh autoreview completed cleanly.waitForCommittedStateuntil the real IndexedDB composer store contains the expected text and exactly one attachment for each session, while preserving all restoration, removal, and send assertions.coreTestschanged gate passed; formatting, diff checks, and fresh autoreview are clean. These synchronization repairs are production +0/-0 and tests +83/-3.retries an explicitly retryable send rejection while still connectedobserving one send attempt instead of two because its 100 ms retry lost to wall-clock polling under CI load.retryAfter, then verifies the second attempt reused the same idempotency key and emptied the outbox; real timers are restored infinally. The focused test passed, a bounded loop passed 10/10, and formatting, diff checks, and fresh Codex autoreview are clean. This repair is production +0/-0 and tests +16/-6.Rebase evidence
The earlier attachment-lifecycle CI failure from run 32116923052 was already fixed on main by 6b72d65. After rebasing that fix, run 32117859632 exposed a distinct remaining durability race in the shipped-bundle lifecycle test; the new committed-state barrier covers that race without duplicating production code.
Main later advanced through #125665 with an independent raw IndexedDB draft poll in the same lifecycle test. The clean rebase retained this PR's canonical
waitForCommittedStatebarrier and exact write-boundary calls, removed only the redundant helper overlap, and the rebased attachment lifecycle E2E passed 4/4.Main then advanced through #125645 with a real
navigator.clipboard.writeTexttest boundary in the Markdown table test. The clean rebase combined that boundary with this PR's direct handler invocation, preserving both fixes; the focused Markdown file passed 4/4 and the attachment lifecycle E2E passed 4/4. Fresh branch autoreview completed with no accepted or actionable findings.