Repository navigation
feat(tts): local Kokoro neural voices as the default text-to-speech provider - #1686
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: blocked before merge. What this changesAdds Kokoro, a local neural text-to-speech engine, with downloadable voice packs, language-specific previews, and a fresh-install default that preserves existing provider settings. Example: A user downloads the English and Chinese voice pack and requests speech with af_maple.
Review scores
ProductKind: Feature · Worth it: Needs a maintainer decision Merge readiness⛔ Blocked before merge - 3 items remain This collaborator-authored PR contains useful work absent from main. The latest commit fixes all four prior findings, and no remaining discrete patch defect was established. Priority: P2 Decision needed
Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe Windows tray turns text from voice previews, chat read-aloud, and node or MCP commands into audible speech. Saved provider settings and downloaded assets select the engine, with Windows speech providing the configured-provider fallback. flowchart TD
A[Preview or speech command] --> B[Saved provider and voice]
B --> C{Provider ready?}
C -->|Kokoro ready| D[Shared Kokoro engine]
E[Verified downloaded voice pack] --> D
C -->|Configured provider unavailable| F[Windows speech fallback]
D --> G[Audio playback]
F --> G
Technical reviewBest possible solution: Keep Kokoro within the existing speech pipeline, preserve legacy settings, and settle the fresh-install default with the speech-area owner. Do we have a high-confidence way to reproduce the issue? Not applicable to this feature proposal; the existing local provider and fallback contracts are established in source and merged speech PRs. Is this the best way to solve the issue? Yes for the integration approach: it extends the existing provider pipeline and gives the expensive, non-thread-safe context one shared owner. The fresh-install default remains a product choice. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 037c17dcb581. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
Review metrics
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 (3 earlier review cycles)
Reviewed October 9, 2026, 3:56 AM ET / 07:56 UTC (Revision 4). |
6c811f1 to
8ee4fb4
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
|
Global triage: HOLD_FOR_AUTHOR. Take confidence 20%; recommendation confidence 98%; effort large; risk high. Reviewed exact head Author: investigate the 1 failing check(s), establish whether each failure is branch-owned, and publish a green exact-head CI Gate before reconsideration. This is a triage classification, not a merge action. No branch changes were made. |
|
@karkarl which failed check? |
|
@RomneyDa please help move this forward. |
|
@clawsweeper this should be ready for maintainer look |
|
|
66506e6 to
40518f3
Compare
|
Global triage: NEEDS_HUMAN_TEST. Take confidence 70%; recommendation confidence 96%; effort large; risk high. Reviewed exact head Required proof remains: actual ARM64 and installed-MSIX synthesis with dictionary/model assets, current-head download/preview/delete UI, latest-stable upgrade preserving provider/settings/assets, gateway-mediated invocation, and speech-owner acceptance of the fresh-install default/native dependency. No fixes or branch changes were made by this review. |
Adds the kokoro provider backed by Larroy.Kokoro 0.1.0 (nuget.org). Voice packs (v1.1 English+Chinese, v1.0 Spanish) download at runtime with pinned SHA-256; G2P dictionaries ship in the package as kokoro-dict/. A process-wide KokoroSpeechEngine owns the single loaded context. Fresh installs default to Kokoro; existing settings keep their provider. Updates Voice Settings UI and all locales, MCP tts.* descriptions, winnode skill, release native probe, and tests.
Kokoro and Piper Preview read a sentence matching the voice's language (VoicePreviewText, keyed by BCP-47 tag with primary-subtag fallback) instead of the UI-localized English sentence. Adds Spanish and Chinese sentences; unknown languages keep the localized text. Adds KokoroModelManager.FindVoice.
…loads Settings files that omit or blank TtsProvider resolve to Piper again (SettingsData.LegacyDefaultTtsProvider); only freshly created settings default to Kokoro. Lock the Kokoro voice picker during a download and drop late progress reports. Show actionable disk-full, network, and integrity failure messages in all locales. Replace copy-pinning preview tests with behavioral ones.
Keep preview completion and duplicate clicks from replacing active download UI state. Add source-method overlap and lifecycle regressions. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 2abf7cc2-7010-4713-b335-98b25e4ac7cd
Keep terminal recovery independent of model storage availability. Cover refresh errors after both failed and successful transfers. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 2abf7cc2-7010-4713-b335-98b25e4ac7cd
750195b to
d346548
Compare
Reuse bounded-process test isolation without weakening deadlines or internal concurrency. Complete the loopback close handshake across both transports and enable dump-free Shared test hang diagnostics. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 2abf7cc2-7010-4713-b335-98b25e4ac7cd
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 2abf7cc2-7010-4713-b335-98b25e4ac7cd
Updated verdict: TAKERecommend taking this PR at This supersedes my earlier HOLD recommendation. The blocking source findings were repaired and cleared by re-review, current CI is green, and the maintainer has now manually checked the isolated native ARM64 app and reported: "I've verified locally, everything looks good." That supplies the local behavior confirmation missing from the earlier assessment. The confidence rating is an engineering judgment, not a measured probability. Review findingsBoth models agree on closure of the repaired findings:
The storage issue was initially found by Astra and then corroborated by Opus. Both independently reviewed the final repair and reported no actionable or blocking findings in that repair delta. Two pre-existing, non-blocking status-text observations remain:
These are follow-up cleanup, not reasons to hold this repaired PR. They are distinct from the active-download control ownership bug that was fixed. This is an updated disposition of the existing Hanselman review, not a claim that the later CI-only changes received a new dual-model review. The reviewed Kokoro patches were preserved unchanged through the contributor's rebase. Validation and manual confirmationCurrent-head CI is successful: 17 successful checks, 7 skipped, no failed or pending checks, and CI Gate passed. This includes x64/ARM64 MSIX builds, the x64 release smoke, the multi-architecture bundle, all three E2E lanes, UI tests, and accessibility scans.
The manual app used separate settings and model storage, with no gateway connection. Following the maintainer's check, authenticated local MCP One separate onboarding UI assertion passed on a single unchanged-head retry. Its intermittent cause was not fixed, and green CI should not be read as a claim that all flakiness has been eliminated. Default-provider direction and remaining limitsKokoro's default status may be temporary. The maintainer has noted a possible later pivot to Windows ML-provided TTS. Taking this PR does not commit the project to Kokoro as its permanent provider, and that possible pivot is not implemented or promised by this PR. Installed-MSIX ARM64 synthesis, latest-stable upgrade retention, a dedicated MCP speech invocation, and gateway-mediated speech were not separately demonstrated in this validation pass. The manual confirmation is user-reported; no screenshot or recording was collected. These qualification gaps remain explicit and no unexecuted proof pool is being marked complete. On the available review, CI, and maintainer manual evidence, my recommendation is now TAKE rather than HOLD. The remaining LOW observations and broader qualification gaps do not change that recommendation for this PR. This is a merge recommendation, not a merge action. |
|
Thank you Karen! |
…rovider (openclaw#1686) * feat(tts): add Kokoro local TTS provider via kokoro.cpp as the default Adds the kokoro provider backed by Larroy.Kokoro 0.1.0 (nuget.org). Voice packs (v1.1 English+Chinese, v1.0 Spanish) download at runtime with pinned SHA-256; G2P dictionaries ship in the package as kokoro-dict/. A process-wide KokoroSpeechEngine owns the single loaded context. Fresh installs default to Kokoro; existing settings keep their provider. Updates Voice Settings UI and all locales, MCP tts.* descriptions, winnode skill, release native probe, and tests. * improve(tts): preview local voices in their own language Kokoro and Piper Preview read a sentence matching the voice's language (VoicePreviewText, keyed by BCP-47 tag with primary-subtag fallback) instead of the UI-localized English sentence. Adds Spanish and Chinese sentences; unknown languages keep the localized text. Adds KokoroModelManager.FindVoice. * fix(tts): keep upgraded settings on Piper and harden Kokoro pack downloads Settings files that omit or blank TtsProvider resolve to Piper again (SettingsData.LegacyDefaultTtsProvider); only freshly created settings default to Kokoro. Lock the Kokoro voice picker during a download and drop late progress reports. Show actionable disk-full, network, and integrity failure messages in all locales. Replace copy-pinning preview tests with behavioral ones. * fix(tts): preserve active Kokoro download controls Keep preview completion and duplicate clicks from replacing active download UI state. Add source-method overlap and lifecycle regressions. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 2abf7cc2-7010-4713-b335-98b25e4ac7cd * fix(tts): recover controls when Kokoro storage refresh fails Keep terminal recovery independent of model storage availability. Cover refresh errors after both failed and successful transfers. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 2abf7cc2-7010-4713-b335-98b25e4ac7cd * test(ci): stabilize process timing and WebSocket fixture shutdown Reuse bounded-process test isolation without weakening deadlines or internal concurrency. Complete the loopback close handshake across both transports and enable dump-free Shared test hang diagnostics. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 2abf7cc2-7010-4713-b335-98b25e4ac7cd * test(chat): isolate disposal reentrancy from pool scheduling Co-authored-by: Copilot App <[email protected]> Copilot-Session: 2abf7cc2-7010-4713-b335-98b25e4ac7cd --------- Co-authored-by: Karen Lai <[email protected]> Co-authored-by: Copilot App <[email protected]> Copilot-Session: 2abf7cc2-7010-4713-b335-98b25e4ac7cd
What Problem This Solves
The tray's default local voice (Piper) sounds robotic, and the cloud voices need an API key and send text off the device. There was no high-quality, fully local default.
This neural voice runs with ONNX runtime from a C++ library wrapped in a .net package published with nuget. It has no python / pytorch dependencies.
There's already a dependency on ONNX runtime for other TTS engines.
Screenshots and demo
kokoro.cpp.openclaw.windows.node.mp4
User Impact
User impact: fresh installs speak with Kokoro, a local neural voice that never leaves the PC. Voice & Audio offers two downloadable voice packs: English and Chinese (Kokoro v1.1, about 379 MB) and Spanish (Kokoro v1.0, about 312 MB). Existing installs keep their current provider. Until a pack is downloaded, speech with no explicit provider falls back to Windows voices as before.
Why This Change Was Made
Kokoro runs through kokoro.cpp, published on nuget.org as
Larroy.Kokoro0.1.0. Kokoro follows the same pattern as Piper: the native engine ships in the package, and the model files download on demand and are checked against pinned SHA-256 hashes. The package uses the tray's existing ONNX Runtime 1.30.0 instead of adding a secondonnxruntime.dll. It ships the pronunciation dictionaries itself (kokoro-dict\), because they must match the engine version.Loading a voice pack takes about 14 s and a few hundred MB of memory. Three places in the tray each create their own TTS service, so one shared, app-wide engine owns the loaded model. Previews, chat read-aloud and
tts.speakall reuse it.Implementation notes
KokoroModelManager(Shared): pack catalog, download with a single in-flight download per pack, an install marker, hash check before files are moved into place, and cleanup on failure.KokoroSpeechEngine(Tray): holds the single loaded model and serializes loading and synthesis, since the native context is not thread-safe.UnloadAsyncruns before a pack is deleted.PcmWavEncoder: the float-PCM-to-WAV conversion moved out of the Piper client verbatim so both engines share it.TtsCapability.KokoroProvider,SettingsData.TtsKokoroVoiceId, readiness and the setup-required check.tts.*descriptions, the winnode skill, andTest-ReleaseNativeDependencies.ps1now checkkokoro.dll,Kokoro.Net.dll,kokoro-dict\vocab.txtandKokoroContext.Version().Evidence
https://api.nuget.org/v3/index.json).onnxruntime.dll(1.30.0) andkokoro-dict\present.winnodetts.status/tts.speakbefore and after download. Details below.Change Type
Scope
winnodeRequired proof pools
windows-winui-interactive: Voice & Audio settings gained the Kokoro provider panel (download, progress, delete, preview) and Kokoro is the new default selection.windows-clean-installer-upgrade: the payload gainskokoro.dll,Kokoro.Net.dlland thekokoro-dict\folder, and the default TTS provider changes for fresh installs. Upgrades must keep the existing provider.Validation
Run on
3d873299, win-x64, after removing the local feed and purging the cachedlarroy.kokoro*packages so restore pulled from nuget.org:./build.ps1: all 5 projects built.dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore: Passed 4273, Skipped 36, Failed 0.dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore: Passed 3996, Failed 0.dotnet test ./tests/OpenClaw.WinNode.Cli.Tests/OpenClaw.WinNode.Cli.Tests.csproj --no-restore: Passed 129, Failed 0.dotnet publish src/OpenClaw.Tray.WinUI -c Release -r win-x64 --self-contained+.\scripts\Test-ReleaseNativeDependencies.ps1 -RequireAppLocalVCRuntime:Release native dependency policy passed.(the probe throws ifKokoroContext.Version()is empty),kokoro-dict\vocab.txtpresent, 1onnxruntime.dll.New or updated tests:
KokoroModelManagerTests: voice-to-pack lookup is case-sensitive, voice ids are unique, and an install is "downloaded" only with no marker and both files present; delete removes it.AssetHashPinningTests.EveryKokoroAsset_HasPinnedSha256AndHttpsUrl.CapabilityTests, settings round-trip ofTtsKokoroVoiceId.NativeSpeechStackRuntimeTestsloadskokoro.dlland checkskokoro-dict.SkillMdDriftTestsprovider list.Real Behavior Proof
run-app-local.ps1 -NoBuild -DataDir <temp>), MCP-only mode (EnableMcpServer=true,NodeTtsEnabled=true, no gateway).3d873299source; the UI run used the locally packedLarroy.Kokoro0.1.0 before the nuget.org push, and the gates above were rerun against the nuget.org package.winnodetts.status/tts.speakbefore and after the download.tts.speakwithef_dora, then Delete andtts.speakagain."TtsProvider":"piper"."TtsProvider": "kokoro"and"TtsKokoroVoiceId": "af_maple". The UI showed Provider "Kokoro (local neural voices)", Voice "English (US): Maple", "Voice pack not downloaded yet. Click Download to fetch it (about 379 MB)."tts.statusreturnedconfiguredProvider: "kokoro",effectiveProvider: "windows",willFallBack: true,providers[0] = { provider: "kokoro", readiness: "voice-not-downloaded" }.tts.speak {"text":"fallback"}returnedprovider: "windows", requestedProvider: "kokoro", fellBack: true. Explicitprovider: "kokoro"returnedSpeak failed.Kokoro voice pack 'v1.1-en-zh' verified and ready, thenKokoro voice pack 'v1.1-en-zh' loaded in 13717 ms (kokoro 0.1.0), logged once. The second preview and every MCP call afterwards reused the loaded model.tts.statusreturnedeffectiveProvider: "kokoro",willFallBack: false, and kokoroready.tts.speak {"text":"Hello from Kokoro","provider":"kokoro","voiceId":"af_maple"}returnedprovider: "kokoro", fellBack: false, contentType: "audio/wav", durationMs: 3588. With no provider it also usedkokoro.ef_dorareturnedSpeak failedbefore its pack was downloaded. After the pack was downloaded (311.9 MB) and the preview loaded it (loaded in 13996 ms), it returnedprovider: "kokoro", fellBack: false. Delete showed "Voice pack deleted." and removedmodels\kokoro\v1.0-es, andef_dorareturnedSpeak failedagain."TtsProvider":"piper":tts.statusreportedconfiguredProvider: "piper".node.invokepath (only local MCP was exercised).kokoro-dict\(the Inno installer includes it viarecursesubdirs).Security Impact
tts.*commands).Yes, explain the risk and mitigation: voice packs download on explicit user action from GitHub releases (larroy/kokoro.cppvoices_model_filesandthewh1teagle/kokoro-onnxmodel-files-v1.0) through the existingAllowedAssetDownloadhost allowlist. Each file is verified against a pinned SHA-256 before it is moved into place, and a mismatch deletes the partial download. Synthesis is fully local, with no text or audio egress.Compatibility and Migration
TtsKokoroVoiceId(defaultaf_maple). The defaultTtsProviderfor new settings files changes frompipertokokoro. Existing settings files keep their persisted provider, and no user action is needed.Review Conversations