Repository navigation
Description
Part of #3705. Found by the #3710 Phase A check of the protocol against real Google (results).
Context
Gemini dictation omits inputAudioTranscription.languageCodes, so Google uses automatic language detection (plan §6: "Language uses automatic detection (languageCodes omitted)"). The locked setup is built in (geminiLockedSetup, packages/ui-server/src/voice/gemini-speech.ts:63), and the client repeats it (packages/ui-react/src/voice/asr-gemini.ts:89). The other providers are fixed to English: Deepgram sends language: "en" (packages/ui-server/src/voice/speech-providers.ts:38), and browser speech defaults to en-US (packages/ui-react/src/voice/asr-webspeech.ts:70).
Measured on 2026-11-09 against models/gemini-3.5-transcribe-live: in a VERBATIM English take, the short final segment "Third, a spare oar." came back as the Spanish word "esperar". In one session, adding languageCodes: ["en-US"] to both the token's bidiGenerateContentSetup and its fieldMask was accepted by Google, and the same segment came back in English ("a spare oar"). That is a single sample. Google documents languageCodes as a bias hint, not a restriction.
Scope
- Lock
inputAudioTranscription.languageCodes: ["en-US"]into the minted token and addinputAudioTranscription.languageCodesto itsfieldMask. This matches the fixed English of the other providers. - Pass the language to the client in the session
params. The client repeats it in itssetup, field for field, as it already does for the mode and vocabulary. - Update plan §6 to say the hint is fixed and why.
Out of scope
A user-facing language setting or per-take language (a separate feature that needs design). Changing Deepgram or browser speech. Multi-language or code-switching support. Any vendor-key test.
Acceptance criteria
- The minted token body carries
languageCodes: ["en-US"]inbidiGenerateContentSetup.inputAudioTranscription, andinputAudioTranscription.languageCodesinfieldMask. The existing token-body tests assert this and fail before the change. - The session
paramscarry the language, and the client'ssetupframe includeslanguageCodesmatching the token. A client test asserts this. - A malformed or missing
paramslanguage does not break the client: it omits the field, and the lock still applies server side. A test covers this. - A mutation receipt for each new assertion is recorded in the PR.
- Plan §6 no longer says automatic detection.
Verification
bun run test packages/ui-server/tests (the Gemini speech tests) and bun run test packages/ui-react/tests/asr-gemini.test.ts. The real-Google effect is checked again in #3710 Phase B.
Contract impact
None. The session params are opaque provider material between our server and our client, not a documented contract shape.
Activity
schlessera commentedon Nov 9, 2026
Decision (maintainer, 2026-11-09): fix the Gemini language hint to
en-USnow, matching Deepgram's fixeden. This replaces the plan's automatic detection. A configurable dictation language stays out of scope.schlessera commentedon Nov 9, 2026
Claimed (token
claim-1794216672-25469). Branchfix/3768-gemini-drain-language, which fixes #3768 and #3769 in one PR. Collisions: none on these paths, only closure-level overlap with older draft PRs.