Skip to content

ui-server: Gemini dictation auto-detects language and misreads short English segments #3769

Closed

Description

@schlessera

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 add inputAudioTranscription.languageCodes to its fieldMask. This matches the fixed English of the other providers.
  • Pass the language to the client in the session params. The client repeats it in its setup, 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"] in bidiGenerateContentSetup.inputAudioTranscription, and inputAudioTranscription.languageCodes in fieldMask. The existing token-body tests assert this and fail before the change.
  • The session params carry the language, and the client's setup frame includes languageCodes matching the token. A client test asserts this.
  • A malformed or missing params language 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

  1. added this to the 0.45.0 milestone on Nov 9, 2026
  2. added
    type: fix
    area: ui-server
    area: ui-react
    priority: p2
    agent-ready
    on Nov 9, 2026
  3. schlessera commented on Nov 9, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-11-09): fix the Gemini language hint to en-US now, matching Deepgram's fixed en. This replaces the plan's automatic detection. A configurable dictation language stays out of scope.

  4. self-assigned this
    on Nov 9, 2026
  5. schlessera commented on Nov 9, 2026

    @schlessera
    OwnerAuthor

    Claimed (token claim-1794216672-25469). Branch fix/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.

  6. removed their assignment
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: ui-reactarea: ui-serverpriority: p2type: fix

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions