fix(speak): honour the voice profile's language instead of forcing English - #1054
fix(speak): honour the voice profile's language instead of forcing English#1054Zeptoniator wants to merge 1 commit into
Conversation
…glish Both speak surfaces built their GenerationRequest with a hardcoded "en" fallback and never consulted the resolved profile, so a profile created with language="fr" was still synthesised as English unless the caller passed language= explicitly. This hurts the MCP path most: an agent calling voicebox.speak has no way to know the bound profile's language, so it cannot pass the argument either. Every agent-triggered generation on a non-English profile came out with an English accent. The fallback chain is now explicit argument -> resolved profile's language -> "en", which matches how engine and personality already consult the resolved binding. The "en" backstop is kept so profiles with no language set behave exactly as before. Adds backend/tests/test_speak_language.py covering both surfaces: the fallback, explicit-argument precedence, and the unchanged "en" default. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe REST ChangesSpeak language fallback
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The PR makes both speak surfaces honor the voice profile's language while preserving explicit caller overrides and the English fallback; no actionable merge-blocking risk remains after normal checks and review. Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
A voice profile carries a
languagefield, but neither speak surface ever reads it. Both build theirGenerationRequestwith a hardcoded English fallback:So a profile created with
language="fr"is still synthesised as English unless every caller passeslanguage=explicitly.This hurts the MCP path most. An agent calling
voicebox.speakresolves its profile through the per-client binding — it never sees the profile object, so it has no way to know the profile's language and cannot pass the argument either. Every agent-triggered generation on a non-English profile comes out with an English accent.Reproduction
Create the Kokoro French preset and bind it to a client:
Before:
"language": "en"— French text read with an English accent.After:
"language": "fr".Fix
The fallback chain becomes explicit argument → resolved profile's language →
"en", matching howengineandpersonalityalready consult the resolved binding.The
"en"backstop is kept, so profiles with no language set behave exactly as before.Tests
Adds
backend/tests/test_speak_language.py— 6 tests covering both surfaces (RESTPOST /speakand thevoicebox.speakMCP tool):language=argument still wins over the profile"en"when the profile has no languageVerified the tests fail without the fix: the two fallback tests fail on the unpatched tree, the four precedence/backstop tests pass in both states as intended.
Manually verified end to end on Linux + CUDA with the Kokoro engine.
Notes
CHANGELOG.mdentry: the file header says it is compiled automatically during the release workflow and manual edits are overwritten. Happy to add one if maintainers prefer.backend/tests/test_profile_duplicate_names.pyfails at collection on a clean checkout withImportError: attempted relative import beyond top-level package. Not touched here.Checklist
Summary by CodeRabbit
Bug Fixes
Tests