fix: respect configured/system lang in MCP instructions instead of hardcoding French#67
Open
danhayman wants to merge 1 commit into
Open
fix: respect configured/system lang in MCP instructions instead of hardcoding French#67danhayman wants to merge 1 commit into
danhayman wants to merge 1 commit into
Conversation
b75ccaa to
c7812c8
Compare
c7812c8 to
c2c24dc
Compare
…rdcoding French The MCP `instructions` blob hardcoded "- Use French by default (the user prefers it)", so assistants spoke French regardless of the user's language or the configured `lang` preference (`vox config set lang` only affects synthesis, not the language summaries are written in). Derive the language guideline from the configured `lang`, then the system locale (validated against SUPPORTED_LANGS), then a neutral "match the language the user is writing in" fallback. French is preserved for anyone who sets `lang fr`. Adds `sys-locale`, a `normalize_locale` helper, and unit tests.
c2c24dc to
c16c07c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I kept ending up with vox talking to me in French. I'd tell it to switch to English, I set
lang en, the works — and it'd behave for a bit, then a session or two later French would quietly creep back in. After enough rounds of this I went digging, and the reason is that the MCP server'sinstructionsblob hardcodes it:That string gets injected into the assistant on every
initialize, so no amount of config ever made English stick.vox config set langonly changes the synthesis language, not the language the assistant actually writes its spoken summaries in — so the two never lined up.This makes that one guideline come from the configured language instead, with a sensible fallback chain:
langis set →Speak in the user's language (<code>)— so French still works, you justvox config set lang frlangset → fall back to the system locale (e.g.fr_FR→fr), validated againstSUPPORTED_LANGSMatch the language the user is writing in(no language assumed)I pulled the instruction-building into a small
vox_instructions(lang)function and anormalize_localehelper so the logic is unit-testable, andhandle_initializeresolves the language and passes it in.sys-localeis added for the system-locale lookup (works on macOS even when$LANGisn't set). I left thevox initoutput and its tests alone to keep the change focused.Tests cover the configured-language formatting, the neutral unset fallback, and the locale normalization (
fr-FR→fr,en_US→en, unsupported/empty → none).cargo test,cargo fmt --checkandcargo clippyare all clean locally.