Skip to content

fix: respect configured/system lang in MCP instructions instead of hardcoding French#67

Open
danhayman wants to merge 1 commit into
rtk-ai:mainfrom
danhayman:dont-hardcode-french-default
Open

fix: respect configured/system lang in MCP instructions instead of hardcoding French#67
danhayman wants to merge 1 commit into
rtk-ai:mainfrom
danhayman:dont-hardcode-french-default

Conversation

@danhayman

@danhayman danhayman commented Jun 23, 2026

Copy link
Copy Markdown

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's instructions blob hardcodes it:

- Use French by default (the user prefers it)

That string gets injected into the assistant on every initialize, so no amount of config ever made English stick. vox config set lang only 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:

  • lang is set → Speak in the user's language (<code>) — so French still works, you just vox config set lang fr
  • no lang set → fall back to the system locale (e.g. fr_FRfr), validated against SUPPORTED_LANGS
  • nothing usable → Match the language the user is writing in (no language assumed)

I pulled the instruction-building into a small vox_instructions(lang) function and a normalize_locale helper so the logic is unit-testable, and handle_initialize resolves the language and passes it in. sys-locale is added for the system-locale lookup (works on macOS even when $LANG isn't set). I left the vox init output and its tests alone to keep the change focused.

Tests cover the configured-language formatting, the neutral unset fallback, and the locale normalization (fr-FRfr, en_USen, unsupported/empty → none). cargo test, cargo fmt --check and cargo clippy are all clean locally.

@danhayman danhayman force-pushed the dont-hardcode-french-default branch from b75ccaa to c7812c8 Compare June 23, 2026 10:21
@danhayman danhayman changed the title fix: don't hardcode French as the default spoken language fix: respect configured lang in MCP instructions instead of hardcoding French Jun 23, 2026
@danhayman danhayman force-pushed the dont-hardcode-french-default branch from c7812c8 to c2c24dc Compare June 23, 2026 10:48
…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.
@danhayman danhayman force-pushed the dont-hardcode-french-default branch from c2c24dc to c16c07c Compare June 23, 2026 11:01
@danhayman danhayman changed the title fix: respect configured lang in MCP instructions instead of hardcoding French fix: respect configured/system lang in MCP instructions instead of hardcoding French Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant