Skip to content

ui-react: qualify Gemini dictation and provider switching on real devices #3710

Open

Description

@schlessera

Part of #3705.

Delivered prerequisites: #3708 (#3717, 723280e) and #3709 (#3724, 8752570), both on inspected main.

Context

Keyless conformance/browser proof establishes our serialization, selection, consent and resource lifecycle; it cannot establish Google acceptance, actual SMART output, latency or physical microphone/browser behavior. The requested Gemini API and published capabilities are sourced in the epic. Source pointers verified on main a63e564f02f9b1ab0462bb0ac02dbf8ea6eacee7 on 2026-11-08; verify named anchors again at pickup.

Exercise the real selected adapter from #3708 through #3709 and the approved design from #3706. Existing capture/review behavior is (const start, packages/ui-react/src/voice/use-dictation.ts:115); PCM capture is (openConversationMicrophone, packages/ui-react/src/voice/conversation-pcm.ts:13). #961 qualifies conversation engines and does not cover this new dictation path automatically.

Scope

Perform a separately authorized, bounded real-Google and physical browser/device qualification of streaming dictation, provider switching and SMART behavior. Use a small synthetic Odysseus corpus covering corrections, lists/formatting, names/vocabulary, silence/Done, interrupted/error capture and declared language behavior. Record exact model/config/build/browser/device identities and actual finalization/resource observations; distinguish measured results from upstream claims.

Out of scope

Unbounded benchmarks/costs, personal audio/content, production-instance details or deployments, modifying test guards, making ordinary CI require a vendor key, non-streaming Gemini recordings and qualifying all languages/platforms from one device.

Acceptance criteria

  • The 2026-11-09 authorization supplies the account/access method, combined caps, synthetic scripts and device operator/route before Phase A. Keep credentials and any private test evidence out of public issues; use the approved secret channel when execution needs access.
  • From the real UI, selecting Gemini opens that exact streaming model; its ephemeral authentication, interim/final delivery and SMART configuration are accepted. Deepgram/browser choices still target their own supported paths without any silent fallback.
  • A representative physical Android/Chrome capture plus the agreed desktop browser run establishes only its named conditions. Test actual microphone start/stop/Done/denial, failure retention and cleanup; browser emulation alone is not physical-device proof.
  • Observe at least the approved correction/list/vocabulary examples and final-drain case, report actual transcript differences and capture-to-final timings without inventing an accuracy or latency pass threshold. Any required performance threshold is agreed before classifying it as passed.
  • Failure/unknown/unsupported conditions and consumed budget are recorded honestly; bugs found are filed separately and block any unsupported qualification claim. Existing keyless/browser mutations remain required on their own candidate.
  • The epic's docs and capability claims reflect the verified scope; no mock is described as real-provider proof, and the epic remains open if its required qualification is incomplete.

Verification

Run the agreed manual/authorized-agent protocol after the implementation's complete keyless candidate proof. Publish sanitized commands, candidate/model/config/browser identities, observed results and budget usage; do not commit raw credential/device/deployment details. No live run is started by filing this task.

Contract impact

Qualification/report only. Corrections to supported behavior, capabilities or public documentation must use their own correctly classified fix/contract change; no API or release commitment is created here.

Approved design (folded 2026-11-08 from #3706)

Qualify against the selectable-dictation plan §2 "still unproven" list: which ephemeral endpoint Google accepts (the SDK's v1alpha BidiGenerateContentConstrained versus the docs' v1beta), whether an empty lockAdditionalFields locks exactly the constrained fields, whether interim text is cumulative per segment, what follows audioStreamEnd (finished or turnComplete) and the actual SMART output for corrections and lists. Also check the D4 acknowledgement and D1 toggle on a real device.

Required human action

The authorization prerequisite is supplied by the 09 November record; do not request it again as though absent. The combined limits are 40 Live sessions, 20 minutes of streamed audio, $5 and about two hours wall clock across both phases. Phase A consumed 17 sessions (two refused at connect), about 2.4 minutes of audio and a reported estimated $0.02. Reconcile actual cumulative spend/time before any further authorized call; triage does not reset or extend those caps, and credentials remain in the secret channel only.

The remaining human action is the reserved Phase B real-UI and physical-device run: the named operator reads the same synthetic scripts on physical Android/Chrome and desktop Chrome, checks the selected provider/formatting and D1/D4 controls, microphone start/stop/Done/denial, final drain, failure retention, provider switching and cleanup. Record sanitized kit/model/config/browser identities, transcripts/timings, observed pass/fail/unknown outcomes and cumulative budget usage. No raw audio, credential or deployment detail is posted. needs: human now describes this actual reserved operator step, rather than missing initial authorization. Keep the issue open until the required qualification result exists.

Triage 2026-11-08: Folded the already recorded implementation completion into the active body. The required authorization, finite budget, synthetic audio and physical-device/access route remain exactly as specified; no live call or device qualification was performed.

Recorded Phase A evidence — 2026-11-09

The real-Google scripted receipt is attributed evidence at kit fb999b8ba, Bun 1.4.2 and models/gemini-3.5-transcribe-live; it is not new execution by this triage. It used shipped server token minting and exact browser-client setup/audio frames with synthetic Odysseus audio, without the real UI or a physical microphone.

Observed: constrained tokens were accepted; both v1alpha/v1beta constrained endpoints transcribed; SMART mode overrode a VERBATIM client request; reuse/expiry refused; interim text was cumulative per segment; and SMART corrections/list formatting were observed under the recorded conditions. A different requested model was accepted without the serving model being disclosed, so model-lock identity remains indirect. No accuracy or latency pass threshold was agreed.

For the final-drain sample, the pending final arrived about 253 ms after audioStreamEnd, followed by generationComplete; no finished, turnComplete or close arrived within the eight-second observation. The current client therefore reached its three-second drain timeout without losing the sampled words. A short undeclared-language segment was recognized as Spanish; one hand-minted languageCodes sample returned English. Vocabulary effect remained inconclusive. Preserve these limits and use Phase B to qualify actual UI/device behavior; neither the scripted protocol result nor source inspection closes this issue or proves all model/language/device claims.

Phase A follow-up fixes — 2026-11-10

The two client defects that Phase A exposed were filed separately, as the acceptance criteria require, and are fixed on main through #3770 (81f1240dd, 0.45.0): #3768 (Done waited its full 3 s drain because Google sends no finished/turnComplete; it now ends on the generationComplete that follows audioStreamEnd, or after a short quiet with nothing pending) and #3769 (undeclared language misread a short English segment; the minted token now locks languageCodes: ["en-US"], repeated in the client setup). docs/plans/selectable-dictation.md now records the Phase A measurements and narrows its "still unproven" list to latency and real-microphone, real-browser and physical-device behavior.

Run Phase B on a build that contains 81f1240dd. In addition to the checks above, record whether Done finalizes promptly on the real UI (no fixed 3 s wait) and whether the English scripts are returned in English with the locked hint. The en-US lock is a supported-scope fact for Phase B, not a multilingual qualification.

Triage 2026-11-09 at main 9c7eb25825fdad5f4485db0df472188805edb450: Folded the later authorization and Phase A results into the current specification, with their exact provenance and limits. Reserved physical/UI qualification, cumulative caps, existing p2 and release attribution remain; this pass made no vendor call or device observation.

Triage 2026-11-10 at main 3aadc8df5: Folded the #3768/#3769 fixes (#3770) and the updated plan into the Phase B handoff. needs: human, caps, p2 and release attribution are unchanged; no vendor call or device observation was made.

2026-11-14 triage at main faa480e8c864d547cd8b4eb75965b7d609284770: Refreshed verified current-source pointers; historical receipts, decisions and remaining qualification requirements retain their identities.

Activity

  1. added
    type: test
    area: ui-server
    area: ui-react
    priority: p2
    blocked
    needs: human
    on Nov 8, 2026
  2. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    2026-11-08: Folded the approved #3706 design (maintainer rulings D1–D4, schemas, states and proof split) into this body under Approved design. Source pointers were re-verified at main a63e564f0. Design PR: #3713.

  3. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    2026-11-08: Both blockers have landed. #3708 merged as #3717 (723280e) and #3709 as #3724 (8752570), both in 0.45.0. The keyless candidate proof for both passed (runs 42509003401 and 42525761919). Only the human prerequisite in this body remains: an authorized test account or access route, a finite time/cost/call budget, the synthetic Odysseus audio set, and a physical-device operator or approved test route. The qualification items to resolve are listed in the plan (docs/plans/selectable-dictation.md §2, still unproven): whether Google accepts the token and which endpoint version it uses (the SDK's v1alpha BidiGenerateContentConstrained vs the docs' v1beta), whether fieldMask locks exactly the constrained fields, interim-text semantics, what follows audioStreamEnd, SMART output, and the D4/D1 flows on a real device.

  4. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Unblocked: #3708, #3709 are closed, so scripts/sync-project.ts is removing the blocked label.

  5. removed
    blocked
    on Nov 8, 2026
  6. schlessera commented on Nov 9, 2026

    @schlessera
    OwnerAuthor

    2026-11-09: Authorization and budget record (maintainer, before the first vendor call).

    • Access: the maintainer's existing Gemini API key, handed over through the secret channel only. It is never posted, logged or committed.
    • Budget (hard caps for both phases together): at most 40 Live sessions, at most 20 minutes of streamed audio in total, at most $5, about 2 hours wall clock. Current pricing is checked before the first call, and the run stops at whichever cap it reaches first. Consumed budget is reported here at the end.
    • Audio: Phase A streams synthetic Odysseus scripts generated by local TTS (no extra vendor). In Phase B the maintainer reads the same scripts into the microphone. Raw audio is never committed or posted; only transcripts and timings are reported.
    • Device route: the maintainer's own hosted instance, with a physical Android/Chrome phone plus desktop Chrome. Instance details stay out of this repository; only the sanitized build identity (kit commit and package version) is recorded.

    Protocol: Phase A is a scripted, server-side check of the protocol (token acceptance, v1alpha vs v1beta, fieldMask enforcement, interim semantics, what follows audioStreamEnd, SMART vs VERBATIM). Phase B runs the real-UI flows on desktop and the phone. No pass threshold is set for accuracy or latency.

  7. schlessera commented on Nov 9, 2026

    @schlessera
    OwnerAuthor

    2026-11-09: Phase A results (scripted check of the protocol against real Google; no UI, no device).

    Identity. Kit main fb999b8ba. Tokens were minted by the shipped createGeminiSpeechProvider (packages/ui-server/src/voice/gemini-speech.ts), except in one hand-minted session (see Language below). The client side was a Bun 1.4.2 WebSocket script that sends GeminiAsrClient's exact setup and audio frames: 100 ms of 16 kHz PCM16, paced in real time. Model models/gemini-3.5-transcribe-live. Audio was synthetic Odysseus scripts spoken by local Windows SAPI TTS (Zira, en-US), with 0.5 s of leading silence and 1.5 s of trailing silence (none for the drain case).

    Budget used: 17 sessions (2 of them refused at connect), about 2.4 minutes of streamed audio, an estimated $0.02 at the published $0.009/min blended rate. Caps: 40 sessions, 20 minutes, $5.

    The unknowns from plan §2

    Question Measured
    Does Google accept the constrained token? Yes: setupComplete and full transcription on every fresh token.
    v1alpha or v1beta BidiGenerateContentConstrained? Both accept it, with identical output. We keep v1alpha (the SDK's choice); no change needed.
    Is the fieldMask lock enforced? Mode: yes. The client asked for VERBATIM on a SMART token and got SMART-cleaned output, so the lock silently overrides the client. Model: a different setup.model was accepted, and the session behaved exactly like the transcribe model (same message types, no model turns). Consistent with the lock, but Google does not report the serving model, so this is indirect.
    Is uses: 1 enforced? Yes: a reconnect within the window closed with 1011 "Token has been used too many times". After the 60 s window it closes with 1011 "new_session_expire_time deadline exceeded".
    Interim semantics Cumulative within each segment ("Tell" → "Tell Penelope the" → …). Interims are verbatim even in SMART; only the final is cleaned.
    When does a final arrive? On a pause, with generationComplete: true and speechState: NON_SPEECH in the same burst. Messages also carry voiceActivity (ACTIVITY_START/END with audioOffset).
    What follows audioStreamEnd? With no trailing pause, the pending final arrived +253 ms after audioStreamEnd, followed by generationComplete. No finished, no turnComplete and no close came in an 8 s observation. As built, the client's Done therefore always waits its full 3 s drain timeout. Words are not lost.
    Silence 10 s of silence plus end of stream: only setupComplete, no transcript, no error.

    SMART vs VERBATIM (actual finals)

    Case SMART VERBATIM
    Correction "Tell Penelope the suitors arrive Wednesday in the great hall." "Tell Penelope the suitors arrive Tuesday. No, wait, Wednesday. In the Great Hall."
    List "Supplies for the voyage:\n1. 12 jars of wine\n2. Barley in leather sacks" then a separate final "A spare oar." "Supplies for the voyage. First, 12 jars of wine. Second, barley in leather sacks." then a separate final "esperar"
    Fillers and date "Council meets on the 12th of July, 2026." (the article "the" was also dropped) "Um, so they, uh, council meets on the 12th of July, 2026."
    Names, no vocabulary "Telemachus and Eurycleia met Eumaeus near Ithaca before Athena arrived." —
    Names, with vocabulary Identical. Clean TTS does not show vocabulary's effect; this is inconclusive. —
    Drain (Done with no pause) "Odysseus leaves the island at dawn." —

    Observations:

    • A pause in the TTS between list items ended the segment, so SMART formatted only the items within one segment.
    • With no declared language, the short trailing segment "Third, a spare oar" was recognized as Spanish ("esperar").
    • Language: one hand-minted session added inputAudioTranscription.languageCodes: ["en-US"] to both the token setup and fieldMask. Google accepted it, and the same segment came out English ("a spare oar"; "Third," was dropped). That is one sample only.

    No accuracy or latency threshold was set; these results are observations, not a pass. Phase B (real UI on desktop Chrome and a physical Android phone, on the maintainer's instance) is still open, and so is this issue.

  8. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    2026-11-10 triage at main 3aadc8df5: folded the Phase A follow-up into the body. #3768 (fixed 3 s Done drain) and #3769 (undeclared-language misread) are closed through #3770 (81f1240dd, 0.45.0), and docs/plans/selectable-dictation.md now records the Phase A measurements. Phase B must run on a build that contains 81f1240dd and should also record whether Done finalizes promptly on the real UI and whether English scripts come back in English with the locked hint. needs: human (the Phase B operator run), the cumulative caps, p2 and release attribution are unchanged.

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

    area: ui-reactarea: ui-serverneeds: humanpriority: p2type: test

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions