Repository navigation
fix: retain speech providers until stream cleanup finishes - #143369
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. Reviewed September 9, 2026, 4:33 PM ET / 20:33 UTC (Revision 2). ClawSweeper reviewWhat this changesRetains speech plugin resources through stream reads, cancellation, and cleanup, with lifecycle documentation and regression coverage. Merge readiness✅ Ready for maintainer review This remains a useful, focused repair: current main and the latest release lack streaming resource ownership, and the related merged fixes explicitly exclude streams. No actionable introduced defect was found. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw's speech runtime selects a configured provider and returns audio to callers such as Discord voice playback. The stream owner keeps provider resources available until playback and cleanup finish. flowchart TD
A[Text and speech settings] --> B[Acquire speech providers]
B --> C[Select provider and synthesize]
C --> D[Owned audio stream]
D --> E[Playback consumer]
E --> F[EOF, error, cancellation or release]
F --> G[Finish transport and producer work]
G --> H[Release provider resources]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +261, Tests +545, Docs +9. Total +815 across 7 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. Technical reviewBest possible solution: Keep one acquisition owner through stream termination and actual cleanup while preserving provider selection, explicit release, and raw-host lifetimes. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main hands streams out without retaining managed provider registrations, and the native fixture exercises releasing the inspection before consuming the stream. This review did not execute that regression. Is this the best way to solve the issue? Yes. Extending the existing acquisition mechanism through stream cleanup repairs the owning boundary and avoids a competing provider-selection path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 227e2f4fe1c2. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…143369) * fix: retain speech providers through stream cleanup * refactor(tts): require owned provider selection
Related: #140674. Builds on telephony #143065 and buffered speech #143313.
What Problem This Solves
Resolves a problem where speech streams outlive the provider registrations they use, or leave resources behind when metadata fails, cancellation is delayed, or an unopened stream has already ended.
Why This Change Was Made
Transfer the existing owned speech acquisition to the returned stream. Retain it through metadata, reads, source cancellation, provider release, and tracked producer work. Start cancellation before waiting for reads it must unblock, preserve the last queued chunk, and finalize outside the work being drained.
Providers with an explicit release callback keep their existing contract: callers await release after EOF or read failure. Providers without one clean up automatically, including empty or failed unopened streams and a consumed final queued chunk. Failed metadata projection cleans up before fallback; errors after bytes have escaped do not start another provider.
All three synthesis paths now require an owned prepared registry. The unused raw setup function and its type-only coupling are removed; public synchronous provider lookup contracts remain unchanged.
User Impact
Streaming speech retains its provider resources until actual cleanup finishes. It preserves explicit release, cancellation, provider selection and raw-host ownership, without adding a release obligation for providers that previously had none. Completed audio remains usable after disposal.
Evidence
Native regressions cover retirement, cancellation, blocked producer work, metadata/getter failures, cleanup-error precedence, unopened termination, and final-chunk delivery. Final combined testing passes 48 distinct cases across streaming, telephony, buffered speech and Talk. The preceding ownership candidate also passed 141 sibling/E2E cases, including Discord voice and provider binary-stream controls.
Affected checks, fresh full-candidate Codex review through P2, and the final ordinary build passed. The final build took 298.41 seconds and emitted a non-fatal UI startup gzip warning of 29 bytes over its threshold; no UI source, baseline or guard was changed.
Both actual compiled public APIs passed on one sealed build: 21 streaming requests and nine buffered calls across cold, managed and raw ownership. They exercised real WAV/PCM roundtrips and SQLite reads through metadata, cleanup and delayed work, followed by close/reopen. All six process groups terminated; all 11,390 artifact hashes remained unchanged, with no application source fallback. These use synthetic local providers, not an external speech vendor, carrier or operator Gateway.
An additional 32 Web-reader cases covered pending reads, timed/gated cleanup and cleanup failures, preserving final chunks and errors. Timings are local observations, not a comparative speedup claim.