Repository navigation
Speaker identification: measured threshold + margin, live clip pooling, SpeechBrain retirement; carries #12531 without the onboarding-step removal - #12935
Conversation
…rded accounts Rebased onto origin/main as a single commit. Keep both main's open_provider_selection_circuit and this PR's is_stt_available helpers, then regenerate OpenAPI clients from the rebased backend. Co-authored-by: Cursor <[email protected]>
…ile screens Add FadeInWordsText: a centered word Wrap where only the words appended since the previous render animate from transparent to opaque with a short stagger, existing words stay put, and a rewritten transcript re-reveals from the start. Both the onboarding speech-profile step and the Settings redo page adopt it in the next commit so the live transcript reads the same whether the words come from the server or the on-device fallback. Verification: flutter test test/widgets/fade_in_words_text_test.dart (4 passed); observed on an iPhone 16 Pro via hot reload while dictating. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01F1zmRTRh3DV8NsM3QUrrAB
…is unavailable The speech-profile question flow (onboarding step and Settings redo) needs a transcript only to drive the questions and progress; the voice print itself is computed server-side from the WAV uploaded at finalize(). So when the backend's streaming STT is down, transcribe on the phone instead of dead-ending: - SpeechProfileProvider gains a local-STT mode. It is entered up front when the stt-availability pre-flight fails, or mid-session after the existing three 1011 closes with no captured speech (previously STT_UNAVAILABLE). The socket becomes the existing CompositeTranscriptionSocket: an on-device polling primary (Apple speech on iOS, downloaded Whisper on Android) forwarding suggested_transcript frames to the backend listen socket in custom_stt mode, which the OnboardingHandler already consumes like server STT output. No backend change; a receiver regression test pins that seam. - iOS on-device recognition hardening (AppDelegate.swift): resolve the app's bare language code to an installed on-device locale (a recognizer built from "en" failed every request with kAFAssistantErrorDomain 1101); reply exactly once per clip on final result, error, or a 20 s timeout, keeping partial results; and expose onDeviceAvailable, which probes a silent clip so a phone with Siri and Dictation disabled (kLSRErrorDomain 201) is reported as "no local STT" instead of entering the fallback blind. - PurePollingSocket bounds each transcribe() with a 30 s timeout. A provider that never answered left the processing flag set forever and silently stopped transcription for the rest of the session; now the audio is requeued and the next tick retries. This also protects the main app's on-device mode. - When neither server nor on-device STT is available, the pre-flight dialog now says to check the connection or turn on Dictation. - Speech-profile UI: subtler mic-level glow, and the live transcript uses the new fade-in words widget. Verification: - flutter test (full suite): 1731 passed, 5 skipped; scripts/analyze_ratchet.sh passed - new tests: speech_profile_provider_test (5 fallback cases), pure_polling_test (hung-provider timeout), fade_in_words_text_test (4), backend test_onboarding_question_start (suggested_transcript reaches the transcript queue only in custom-STT mode) - live on iPhone 16 Pro against the local dev harness with the STT primary forced unavailable: session connects with custom_stt+onboarding flags, Apple on-device recognition returns the spoken answer (~180 ms per clip) and it is forwarded to the backend; with Dictation disabled the probe reports unavailable and the dialog appears. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01F1zmRTRh3DV8NsM3QUrrAB
SFSpeechRecognizer's on-device mode fails with kLSRErrorDomain 201 whenever Siri and Dictation are turned off in Settings, which is what produced the "turn on Dictation" pre-flight dialog in the speech-profile fallback. iOS 26's SpeechAnalyzer/SpeechTranscriber has no such dependency: the language model is an asset the app installs itself through AssetInventory. - transcribe: on iOS 26 run the clip through SpeechAnalyzer (preset .transcription, analyzeSequence(from:) + finalizeAndFinish), falling back to the SFSpeechRecognizer path only if the analyzer throws. - onDeviceAvailable: report true when a supported locale's model is installed or installs within 8 s; a longer download keeps going in the background and the first transcribe() waits for it. Concurrent callers share one download. - SFSpeechRecognizer remains the path for iOS 15-18. Verified on an iPhone (iOS 26.6.1) with Dictation off: the speech-profile redo enters local-STT mode and transcribes. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
… a word target Speech-profile recording (onboarding step and Settings redo) no longer walks one question at a time with a percentage bar. Instead: - A compact white-outlined card headed "Answer with your voice:" lists three topics (where you live, what you do for work, your long-term goal), and a thin bar under it fills as the user speaks. Reaching SpeechProfileProvider.targetWordCount (60 spoken words) finalizes the recording; the backend's onboarding_complete event no longer does, so "bar full" and "done" are the same moment. Omi's own question segments are excluded from the count. - The live transcript is bottom-anchored in a box exactly three lines tall above the card, so whole lines scroll off the top and nothing overlaps. - The Play button on the Settings page plays the saved profile audio in place (just_audio) and turns into Stop, instead of opening the samples page. Redo stops playback first. - Backend ONBOARDING_QUESTIONS is the same three topics, and OnboardingHandler keeps the transcript across questions so one stretch of speech can satisfy several of them. - Removed the unused percentage progress-bar widget and the "Skip this question" button; onboarding keeps "Skip for now". Tests: speech_profile_provider_test (word target fills, finalizes once, ignores Omi segments and the backend completion event); backend test_onboarding_talk_about_flow (one transcript answers every topic; the transcript is kept when it stops answering). Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
A phone built against OMI_DEV_HOST could reach the backend but not the files it links to: OMI_LOCAL_STORAGE_BASE_URL was always http://127.0.0.1:<port>/_local/storage, so playing the saved speech profile from a device failed. The harness now derives a dev_advertise_host from OMI_DEV_HOST (loopback stays the default) and uses it only for that base URL; every other service address still binds and talks over loopback. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
…rd-fix-prod # Conflicts: # app/lib/pages/speech_profile/page.dart
…pped scroll The speech-profile transcript was a bottom-scrolled ListView clipped to a three-line box, so a sliver of the line above always showed at the top edge and read as cut-off text. FadeInWordsText now takes visibleLines: it replays the Wrap line breaking with measured word widths and builds only the words on the last N lines, so earlier lines drop off whole, nothing is clipped or scrolled, and words keep their reveal state while on screen. Both screens use visibleLines: 3 inside a fixed three-line, bottom-anchored area, moved a little further above the topics card. Test: fade_in_words_text_test covers short text showing everything, earlier lines dropping once the text exceeds three lines, and the shown words matching the line-break replay. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
…word target FadeInWordsText replayed the Wrap line breaking with the caller's raw style, but each word's Text inherits the ambient DefaultTextStyle (font family, weight) under that style, so the replay undercounted lines and the real layout could reach four lines and draw over the topics card. Measure with the same merged style, and clip the fixed three-line area on both screens as a safety net so a stray line can never overlap the card. Also lower SpeechProfileProvider.targetWordCount from 60 to 40 so the recording finishes sooner. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
The title wrapped onto two lines for longer names; it now scales down to fit a single line instead. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
…e card The three-line transcript area was a fixed-height clipped box, so whenever the rendered lines ran taller than the fontSize*height estimate (text scaling, font metrics) the top line was cut off. FadeInWordsText already guarantees at most three lines, so the area now only has a three-line minimum height (scaled with the text scaler) and grows to its content instead of clipping. Both screens also keep more space between the transcript and the topics card. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
…oad spinner The recording now completes once the user has spoken three sentences (SpeechProfileProvider.targetSentenceCount, counted on ./!/? boundaries followed by a space or the end of the text, so "3.5" is not one) instead of a word count, and the bar under the topics card fills per sentence. The progress-bar widget is renamed SpeechProgressBar to match. The Settings speech-profile page no longer swaps its Play/Redo or Get Started buttons for a spinner while the page initialises or the STT pre-flight runs; the buttons stay put and startRecording() ignores taps until the check finishes. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
The app's audio session is normally configured for recording, so tapping Play on the Settings speech-profile page routed the WAV to the quiet earpiece. Before playing, configure a playback-category session (default mode, media usage on Android) and play at full volume, so the profile comes out of the main speaker like any other media. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
Tapping Redo showed the previous recording's words (and counted them toward the sentence target) because nothing cleared the provider's transcript before a new session; only close() did, on leaving the page. initialise() now calls a new resetTranscript() first, which forgets the segments, text, progress, completion and upload flags without touching the audio storage it recreates right after. resetSegments() reuses it. Test: a completed session's transcript is gone after resetTranscript and the fresh session counts sentences from zero and can finalize again. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
…entence on screen Reaching the third sentence finalized immediately, which stopped the mic mid-utterance (the recognizers punctuate each clip, so a pause can read as a sentence end) and swapped the transcript for a spinner at once. Now: - After the target is reached the provider waits completionGrace (2 s) without new speech before finalizing, restarting the wait on every new segment, and finalizes at completionCap (8 s past the target) at the latest. Once fired it does not re-arm; resetTranscript() clears it. - Both screens keep the last three transcript lines visible through the upload and the All done state, so the final sentence lingers instead of vanishing. Tests: grace/cap timing under fakeAsync, no double finalize, and the reset test now elapses the grace. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
Tapping Redo within two minutes of the previous attempt showed last time's words as soon as the user spoke again. The new listen socket attached to the still-open in-progress conversation from the previous attempt (same source, inside conversation_creation_timeout), so combine_segments() merged the first new segment into that conversation's last segment and the merged segment, old text included, was what the client received. LiveConversationController.prepare() now always creates a fresh in-progress conversation for onboarding_mode sessions (the onboarding step and the Settings redo both set it) instead of consulting the in-progress pointer. Ordinary listen sessions are unchanged. Test: test_listen_speech_profile_fresh_conversation.py. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
… done button Keeping the transcript on screen through the upload made it pop back in on its own above the spinner and the All done button. The Settings page now cross-fades (450 ms) from the recording UI (transcript, topics card, bar) to nothing while uploading and then to the All done button, which is the same black capsule with a plain white border as the other buttons instead of the gradient box. The onboarding step likewise no longer shows the transcript in its upload and All done states. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
The Play button now plays the saved profile in place, so the samples page and its provider became unreachable (CI dead-code ratchet). Also drop the scroll controllers and SCROLL_DOWN signal the old clipped transcript used, and the word-count progress-message state (SpeechProfileProgressState, percentageCompleted, questionProgress) nothing reads any more. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
… All done After the third sentence the final words disappeared as soon as the upload began. Both screens now keep the finished recording (last words, topics card, full bar) on screen through the upload and for a further 1.5 s (allDoneHold) after the profile is saved, then cross-fade into the All done button. Onboarding's upload spinner row and its now-unused loading-text helper are gone; Skip for now hides once recording ends. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
Parts of the finished recording could change on their own before the cross-fade (the transcript and the mic disclaimer are built from live provider state that finalize() and its callbacks touch), so they did not disappear together. Both screens now snapshot the recording view (last words, no-device flag) the moment recording ends and build from that until a new recording starts, and the onboarding step's All done switch is now the same AnimatedSwitcher cross-fade as the Settings page, so the words, the topics card, the bar and the disclaimer fade out at the same time. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
…ng fades finalize() clears the provider's text once the profile is saved, and the bar derived its value from that text, so it dropped back to zero before the cross-fade. The frozen recording view now pins the bar at full from the moment recording ends. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
…run onboarding Onboarding now goes from Permissions straight to the completion screen. The speech profile is recorded from Settings instead, and the memory-graph preview (with its background graph prebuild) is gone. The two step widgets are deleted; their page indices stay as placeholders like the other retired steps so the existing page constants keep working. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
The white glow behind the device graphic vanished the instant the upload began. It now stays through the upload and hold and eases down to nothing over the same 450 ms in which the recording view fades into All done. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
The glow followed the live mic level, which drops to zero the instant the microphone stops after the recording ends, so it snapped down to its resting size before the ease-out. The frozen recording view now also captures the last mic level, so the glow holds still and then eases shut with the fade. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017iFNr6rZDcD1FkCS3dJ3Cm
…m first-run onboarding" This reverts commit 4ebcb3d.
…hold-and-redo # Conflicts: # desktop/macos/Desktop/Sources/Generated/OmiApi.generated.swift # desktop/windows/src/renderer/src/lib/omiApi.generated.ts # web/admin/lib/services/omi-api/omiApi.generated.ts # web/app/src/lib/omiApi.generated.ts # web/personas-open-source/src/lib/omiApi.generated.ts
…d retire the SpeechBrain matcher Speaker identification rejected most of the owner's own audio. The verification threshold (0.45 cosine distance) was copied from a clean-studio VoxCeleb figure; an offline bench over real enrollments in the speech-profiles bucket (229 users with a current profile plus an older one, 16 with extra recordings, 60 taught persons, 400 impostors; wespeaker-voxceleb-resnet34-LM, the diarizer's /v2/embedding model) puts same-user cross-session distance at a median of 0.40-0.53 and other users at 0.93. At 0.45 the owner was rejected 37-71% of the time at a 0.0% false-accept rate; the equal-error threshold is ~0.78. Same-session audio matched at either value, which is why the old constant looked fine in demos. - New utils/stt/speaker_match.py owns the policy (numpy only, shared by the live socket and the sync pipeline): threshold 0.65, plus a 0.10 margin over the runner-up so the owner is not guessed as a taught household member. - Live sessions pool up to three recent clips per diarized speaker and decide on the centroid once 5 s of clip audio has accumulated, instead of letting the first 2 s clip that lands under the threshold stick for the session. - Both surfaces log one structured speaker_id_decision line (best, runner-up, evidence, accepted) so the prod distribution can be checked against the bench from a day of logs. - The bench scripts live in backend/scripts/speaker_id_bench for reruns; user audio never leaves the machine running them. - Retire the dead SpeechBrain speaker-identification path: modal/speech_profile_modal, utils/stt/speech_profile (zero production callers), the /v1/speaker-identification route, HOSTED_SPEECH_PROFILE_API_URL in every chart/env, the speechbrain dependency, the shared-package COPY lines in the modal image, the dev-harness and e2e fakes, and the unused ListenLimits.speaker_id_target_audio field. Drop the now-unused is_same_speaker/find_best_match/bytes helpers. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
There was a problem hiding this comment.
8 issues found across 134 files
Confidence score: 2/5
backend/routers/listen/contracts.pytrusts the client-suppliedspeech_profile_redoflag, allowing authenticated users to bypass the completed-account admission gate; validate the persisted speech-profile state server-side before permitting redo access.app/lib/services/sockets.dartcan create a stale on-device/composite session when the persisted STT policy changes during socket shutdown, potentially including an incorrect secondary Omi socket; re-read the persisted policy before creating the replacement session.scripts/dev-harness/dev_harness/config.pyexposes/_local/storagewithout authorization whenOMI_DEV_HOSTis reachable over LAN or tailnet, allowing peers to read speech profiles and other local files; require authorization or restrict the mount to loopback.- The speech-profile flow still has user-facing release gaps:
app/lib/l10n/app_localizations_ru.dart,app/lib/l10n/app_localizations_hr.dart, andapp/lib/l10n/app_localizations_hi.dartreturn English strings, whileapp/lib/pages/onboarding/speech_profile_widget.dartcan overflow its fixed viewport; complete locale entries and constrain the recording content before relying on the onboarding layout.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/routers/listen/contracts.py">
<violation number="1" location="backend/routers/listen/contracts.py:53">
P1: When an authenticated client sets `speech_profile_redo`, the runtime trusts it as proof that this is an existing-profile redo and bypasses the completed-account admission gate. Validate the persisted speech-profile state server-side before allowing this bypass; otherwise a client can evade the onboarding-provenance gate with a query parameter.</violation>
</file>
<file name="app/lib/pages/onboarding/speech_profile_widget.dart">
<violation number="1" location="app/lib/pages/onboarding/speech_profile_widget.dart:559">
P2: When recording on the onboarding page, this card makes the fixed-height bottom column taller than the `TabBarView` viewport, so Flutter overflows and can clip the skip/progress controls. Move the recording content into a scrollable or height-fitting layout, or reduce the content so it fits the wrapper's bounded page area.</violation>
</file>
<file name="app/lib/services/sockets.dart">
<violation number="1" location="app/lib/services/sockets.dart:171">
P1: When the persisted STT policy changes while the previous speech-profile socket is stopping, this branch can create a stale on-device/composite session, including its secondary Omi socket. Re-read the persisted policy after `await _speechProfileSocket?.stop()` and skip factory creation when the current policy is local-only.
(Based on your team's feedback about speech-profile STT policy revalidation.) .</violation>
</file>
<file name="app/lib/l10n/app_localizations_ru.dart">
<violation number="1" location="app/lib/l10n/app_localizations_ru.dart:9951">
P1: The Russian locale now returns English text for the newly added speech-profile strings (`speechProfileOwnerTitle`, `play`, `redo`, `answerWithYourVoice`, `speechProfileTopicLocation/Work/Goal`, and `speechToTextUnavailableDesc`). Russian users will see English UI in this onboarding/speech-profile flow. These values were also added directly to the generated `app_localizations_ru.dart` while the source `app_ru.arb` has none of these keys (grep count 0), so a `flutter gen-l10n` regeneration will drop them entirely. Add proper Russian translations to `app_ru.arb` and let gen-l10n regenerate the Dart file instead of hand-editing the generated output.</violation>
</file>
<file name="scripts/dev-harness/dev_harness/config.py">
<violation number="1" location="scripts/dev-harness/dev_harness/config.py:366">
P2: When `OMI_DEV_HOST` is a LAN or tailnet address, this advertises an unauthenticated static mount containing speech profiles and other local files to every reachable peer. Protect `/_local/storage` with authorization, or issue device-scoped authenticated URLs before exposing it off-host.</violation>
</file>
<file name="backend/scripts/speaker_id_bench/sweep.py">
<violation number="1" location="backend/scripts/speaker_id_bench/sweep.py:91">
P2: The owner-vs-person diagnostic is empty for most cohort-C users because cohort selection never downloads or embeds their `speech_profile.wav`. Add each cohort-C owner profile to the benchmark inputs before computing this metric.</violation>
</file>
<file name="app/lib/l10n/app_localizations_hr.dart">
<violation number="1" location="app/lib/l10n/app_localizations_hr.dart:9950">
P2: Croatian users will see English text in the speech-profile onboarding flow: this generated file hard-codes 'Play', 'Redo', 'Answer with your voice:', 'Where do you live?', etc. in English, and app_hr.arb has none of these keys. Add Croatian translations to app_hr.arb and run flutter gen-l10n instead of editing the generated Dart directly — a regeneration would overwrite these hand-edits (and warn about the untranslated keys) since the ARB lacks them.</violation>
</file>
<file name="app/lib/l10n/app_localizations_hi.dart">
<violation number="1" location="app/lib/l10n/app_localizations_hi.dart:9893">
P2: These new getters live in the Hindi localization class but return English strings, so Hindi users will see untranslated UI during the speech-profile onboarding step. They also have no matching keys in app_hi.arb, so this hand-edited generated file diverges from the ARB source and `flutter gen-l10n` will drop them. Add Hindi translations of these keys to app/lib/l10n/app_hi.arb (and the other non-English ARBs) and regenerate, rather than editing app_localizations_hi.dart directly.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| # completed-account admission gate below without weakening it for real | ||
| # onboarding — see runtime.py's _bootstrap. Appended last so a positional | ||
| # caller can't silently mis-bind an existing argument. | ||
| speech_profile_redo: bool = False |
There was a problem hiding this comment.
P1: When an authenticated client sets speech_profile_redo, the runtime trusts it as proof that this is an existing-profile redo and bypasses the completed-account admission gate. Validate the persisted speech-profile state server-side before allowing this bypass; otherwise a client can evade the onboarding-provenance gate with a query parameter.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At backend/routers/listen/contracts.py, line 53:
<comment>When an authenticated client sets `speech_profile_redo`, the runtime trusts it as proof that this is an existing-profile redo and bypasses the completed-account admission gate. Validate the persisted speech-profile state server-side before allowing this bypass; otherwise a client can evade the onboarding-provenance gate with a query parameter.</comment>
<file context>
@@ -44,6 +44,13 @@ class ListenRequest:
+ # completed-account admission gate below without weakening it for real
+ # onboarding — see runtime.py's _bootstrap. Appended last so a positional
+ # caller can't silently mis-bind an existing argument.
+ speech_profile_redo: bool = False
</file context>
| } | ||
|
|
||
| @override | ||
| String speechProfileOwnerTitle(String name) { |
There was a problem hiding this comment.
P1: The Russian locale now returns English text for the newly added speech-profile strings (speechProfileOwnerTitle, play, redo, answerWithYourVoice, speechProfileTopicLocation/Work/Goal, and speechToTextUnavailableDesc). Russian users will see English UI in this onboarding/speech-profile flow. These values were also added directly to the generated app_localizations_ru.dart while the source app_ru.arb has none of these keys (grep count 0), so a flutter gen-l10n regeneration will drop them entirely. Add proper Russian translations to app_ru.arb and let gen-l10n regenerate the Dart file instead of hand-editing the generated output.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/lib/l10n/app_localizations_ru.dart, line 9951:
<comment>The Russian locale now returns English text for the newly added speech-profile strings (`speechProfileOwnerTitle`, `play`, `redo`, `answerWithYourVoice`, `speechProfileTopicLocation/Work/Goal`, and `speechToTextUnavailableDesc`). Russian users will see English UI in this onboarding/speech-profile flow. These values were also added directly to the generated `app_localizations_ru.dart` while the source `app_ru.arb` has none of these keys (grep count 0), so a `flutter gen-l10n` regeneration will drop them entirely. Add proper Russian translations to `app_ru.arb` and let gen-l10n regenerate the Dart file instead of hand-editing the generated output.</comment>
<file context>
@@ -9950,6 +9947,29 @@ class AppLocalizationsRu extends AppLocalizations {
}
+ @override
+ String speechProfileOwnerTitle(String name) {
+ return '$name\'s Speech Profile';
+ }
</file context>
| } | ||
|
|
||
| @override | ||
| String speechProfileOwnerTitle(String name) { |
There was a problem hiding this comment.
P2: These new getters live in the Hindi localization class but return English strings, so Hindi users will see untranslated UI during the speech-profile onboarding step. They also have no matching keys in app_hi.arb, so this hand-edited generated file diverges from the ARB source and flutter gen-l10n will drop them. Add Hindi translations of these keys to app/lib/l10n/app_hi.arb (and the other non-English ARBs) and regenerate, rather than editing app_localizations_hi.dart directly.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/lib/l10n/app_localizations_hi.dart, line 9893:
<comment>These new getters live in the Hindi localization class but return English strings, so Hindi users will see untranslated UI during the speech-profile onboarding step. They also have no matching keys in app_hi.arb, so this hand-edited generated file diverges from the ARB source and `flutter gen-l10n` will drop them. Add Hindi translations of these keys to app/lib/l10n/app_hi.arb (and the other non-English ARBs) and regenerate, rather than editing app_localizations_hi.dart directly.</comment>
<file context>
@@ -9892,6 +9889,29 @@ class AppLocalizationsHi extends AppLocalizations {
}
+ @override
+ String speechProfileOwnerTitle(String name) {
+ return '$name\'s Speech Profile';
+ }
</file context>
Serialize live matches per speaker, subtract previously embedded audio, invalidate late session results, and keep all enrolled candidates in sync margin comparisons before enforcing unique assignment. Validation: 396 selected backend tests passed; Python typecheck has zero errors. Five live regression cases and two sync cases failed before the fixes. Changed sync expectations follow PR #12935's measured household-confusion margin. Failure-Class: new
Include available owner profiles even outside legacy, additional, and impostor cohorts. Distinguish offline benchmark evidence from deployed accuracy. Validation: synthetic manifest regression passes for owners outside other cohorts and people without an owner profile. No private audio or threshold retuning. Failure-Class: new
Use one native completion owner so availability deadlines do not wait for shared model downloads and recognition cleanup precedes timeout completion. Serialize legacy recognition callbacks on the main queue. Propagate native failures to retain audio for retry; remove the polling Future timeout that allowed overlapping work. Scope fallback availability and polling results to their recording session. Validation: full Flutter suite 1836 passed, 5 skipped; analyzer ratchet passed. Native deadline behavioral tests pass and are registered in the existing manifest. Native speech code typechecks for iOS 15 deployment with Flutter boundary stubs; no full iPhone build or live enrollment claim. Preflight passed 53 selected checks. Failure-Class: new
Translate the eight speech-profile keys across all 48 non-English ARBs and fill two inherited missing keys exposed by generation. Use device-neutral speech recognition guidance and regenerate localization output from source catalogs. Validation: flutter gen-l10n reports zero untranslated messages; owner-name placeholders and complete catalog coverage verified. Full Flutter suite passed. Failure-Class: new
…hold-and-redo Resolved .github/checks-manifest.yaml by keeping both iOS ruby test entries: the PR's ios-speech-deadline and main's ios-flutter-launch-engine-guard. AppDelegate.swift and project.pbxproj auto-merged with both sides' intents (SpeechDeadline/SpeechAnalyzer work and the FlutterLaunchEngineGuard untethered-launch guard) verified after the merge; manifest contract test_run_checks.py passes.
…ission bypass cubic P1: the client-supplied speech_profile_redo flag alone proved nothing; any authenticated client could send it to skip the completed-account onboarding-provenance admission gate. The runtime now confirms the redo from durable state (an actually stored speech_profile.wav) before taking the bypass, and an unprovable claim falls through to the provenance admission, failing closed when the check errors. Adds a regression test asserting a redo claim without a persisted profile is judged by the gate.
…mission cubic P2: onboarding=enabled is a client hint, yet prepare() took the fresh-conversation shortcut on the raw flag even when _bootstrap refused to admit the session — a client could dodge the existing-conversation lookup with a query parameter. The path now requires the runtime's onboarding_admitted (also true for the authorized Settings redo); an unadmitted claim keeps an ordinary session's behavior. Adds a regression test for the unadmitted path.
cubic P2: is_checking_answer stayed set across up to three awaited LLM calls in _check_answer, and on_segments_received dropped everything spoken in that window, so answers covering later topics could be lost. Segments received while a check is in flight are now queued and replayed when it finishes, re-entering the normal accumulate-and-timer flow. Adds a regression test.
…tor rates cubic P2 x2: score.py evaluated the retired 0.45 operating point while the README and shipped policy (SPEAKER_MATCH_THRESHOLD) sit at 0.65, making its false-reject/false-accept and live-decision numbers misleading; and cohort-C impostor distances included the current user's own owner profile when that user was also sampled as an impostor, folding owner-vs-own-person confusion into the random-impostor sweep. score.py now pins T to the production 0.65 and formats every label from it; sweep.py excludes each cohort-C user's own profile from their impostor pool (the confusion keeps its dedicated diagnostic). Owner profiles for cohort C were already added to the cohort inputs by 8126713.
cubic review follow-ups still present after 1d7a2fd: - page.dart: _isCheckingAvailability is now held until the entire startup path exits (dialogs, codec lookup, stopDeviceRecording, initialise), not just the availability round-trip, so a second tap cannot race socket and microphone init; context/mounted are rechecked after the language dialog and before initialise. - page.dart: profile playback deactivates the activated audio session on every teardown path (stop, natural completion, failure after activation, disposal) instead of leaving media routing active. - speech_profile_provider: a socket created while the session was closed or reset is discarded instead of adopted, which previously leaked a live backend session stop() never saw. - transcription_service: the speech-profile on-device fallback forwards raw audio per config.sendRawAudioToOmi, matching the conversation composite, instead of hardcoding every frame onto the Omi socket; suggested transcripts still flow and keep the backend session clock alive. Pinned by a factory test.
…in merge The merge combined this PR's on-device speech pointer with main's profile-build-mode and batch-contract lines, pushing app/AGENTS.md past its agents-md-lean budget (11747 > 11500 bytes). Tightens wording without dropping any fact: the batch-writer guarantee detail lives in the manifest reason and the ruby test itself; the other compressions are same-fact rewording.
…hold-and-redo # Conflicts: # app/AGENTS.md
…tity Rebase onto latest BasedHardware/omi main without syncing the fork main. - BasedHardware#3328: stop daily wear-your-Omi pushes; Android FGS shows Reconnecting only when a BLE retry is scheduled - BasedHardware#5363: reject decoded WAV on WAL /v2/sync-local-files uploads - BasedHardware#12765: enroll fails closed until voiceprint stores; honest enroll analytics (skip/continue vs upload/embedding stored) Cubic short-segment / sequential-embedding notes for the retired utils/stt/speech_profile.py matcher are obsolete after BasedHardware#12935 deleted that module. speech_profile_enroll_events.dart remains the single source for event names and is wired through analytics_manager. Failure-Class: none Verification: - backend pytest test_wear_device_reminder + test_user_speaker_embedding + test_speech_profile_wav_decode: 36 passed - Flutter not available on this Linux cloud VM; Dart unit tests deferred to CI Mobile App Checks Co-authored-by: Apoorv Darshan <[email protected]>
…tity (#12893) Rebase onto latest BasedHardware/omi main without syncing the fork main. - #3328: stop daily wear-your-Omi pushes; Android FGS shows Reconnecting only when a BLE retry is scheduled - #5363: reject decoded WAV on WAL /v2/sync-local-files uploads - #12765: enroll fails closed until voiceprint stores; honest enroll analytics (skip/continue vs upload/embedding stored) Cubic short-segment / sequential-embedding notes for the retired utils/stt/speech_profile.py matcher are obsolete after #12935 deleted that module. speech_profile_enroll_events.dart remains the single source for event names and is wired through analytics_manager. Failure-Class: none Verification: - backend pytest test_wear_device_reminder + test_user_speaker_embedding + test_speech_profile_wav_decode: 36 passed - Flutter not available on this Linux cloud VM; Dart unit tests deferred to CI Mobile App Checks Co-authored-by: Cursor Agent <[email protected]>
## Problem A person label could be written to transcript segments without producing a durable, versioned person profile. The first concrete broken boundary was between label assignment and profile publication: sample storage and embedding storage were separate writes, and the offline cache accepted legacy vectors without a version contract. A second reproduced boundary left an embedding behind when one of several samples was deleted. Adjacent short segments were also verified against only the selected segment text, so valid expanded speech was rejected before persistence. Related issues: #7187, #5625, #4455, #5266. PRs #12893 and #12935 are already merged; this change builds on the current code instead of repeating them. ## Change - Publish a verified person sample, transcript, embedding, `speech_samples_version: 3`, and source conversation/segment IDs in one Firestore transaction fenced by the person update version. - Replace old profiles coherently, delete superseded sample blobs, and invalidate/fence profiles when labels are corrected, samples are deleted, or the person disappears. - Reject foreign-person bulk assignments and prevent adjacent sample expansion from crossing person/user boundaries. - Require version 3 profiles for offline embedding cache loading and make missing-embedding recovery version-fenced. - Add synthetic backend regression coverage for restart/live matching, offline sync, account isolation, same-ID cross-account isolation, correction/deletion, failed re-teaching, and in-flight races. - Add a hermetic mobile journey proving a cached person name renders in later and offline-synced conversations after provider reload. - Update the legacy summary fixture to mock the current duplicate-capture helper used by production. No model, language threshold, production setting, or customer data was changed. ## Verification - `make preflight` — 31 checks passed. - `BACKEND_UNIT_TEST_FILE_LIST=/tmp/omi-speaker-backend-tests.txt BACKEND_PYTEST_WORKERS=4 bash backend/test.sh` — all 12 selected backend files passed (including the new persistence suite). - `backend/.venv/bin/python -m pytest backend/tests/unit/test_taught_speaker_persistence.py backend/tests/unit/test_speaker_identification_language_fallback.py backend/tests/unit/test_speaker_person_embedding_recovery.py -q` — 19 passed. - `(cd backend && PYTHON=.venv/bin/python bash scripts/typecheck.sh)` — 0 errors (5997 existing warnings). - `backend/.venv/bin/python backend/scripts/check_unit_test_discovery.py` — 1166 selected, 56 policy-covered, 0 orphans. - `PATH=/Users/dazheng/fvm/versions/3.44.5/bin:$PATH make mobile-verify ARGS='fast --filter j6'` — 3 executed, 3 passed. - `(cd app && /Users/dazheng/fvm/versions/3.44.5/bin/dart analyze integration_test/journeys/j6_persisted_speaker_name_test.dart)` — no issues found. - `git diff --check` — passed. ## Remaining checks Physical-device microphone capture, provider quality on real voices, and deployment/runtime verification remain for the mobile release lane. This branch is left reviewable locally and has not been merged or deployed. Failure-Class: FC-split-mutation-authority Line-Count-Exception: backend/database/users.py | 2285 -> 2342 | atomic person speech-profile replacement and invalidation transactions Line-Count-Exception: backend/routers/conversations.py | 2231 -> 2249 | authenticated person validation and correction invalidation at the assignment boundary
Summary
Supersedes #12531 (Nathan's speech-profile onboarding fix and UI work). This branch is that PR's head with one commit reverted — the removal of the speech-profile and memory-graph steps from first-run onboarding, which David does not want — merged with current
main, plus the backend change that makes speaker identification actually work (#12765) and the removal of the dead SpeechBrain matcher.Speaker verification was rejecting the owner (#12765)
The verification threshold (
0.45cosine distance) was copied from a clean-studio VoxCeleb figure. An offline bench over real enrollments ings://speech-profiles— 229 users with a current profile plus an older one, 16 with additional recordings, 60 taught persons with ≥2 samples, 400 impostors; embedded withpyannote/wespeaker-voxceleb-resnet34-LM, the model the diarizer's/v2/embeddingserves — measured:Same-session audio matches at either value, which is why the old constant looked fine in demos. 2 s clips had a 17% EER against 10% at 5 s; averaging a few clips beat both first-clip and 2-of-3 voting; enrollment centroids gave no gain. Owner-vs-own-taught-person distances were measured as low as 0.43, so the threshold is raised together with a margin rule.
Changes:
utils/stt/speaker_match.py(new, numpy-only, shared by the live socket and the sync pipeline):SPEAKER_MATCH_THRESHOLD = 0.65,SPEAKER_MATCH_MARGIN = 0.10(nearest must beat the runner-up by this much),select_speaker_match,mean_embedding. The constant's comment carries the measured distributions.routers/listen/speakers.py): pools up to 3 recent clips per diarized speaker and decides on the centroid once 5 s of distinct clip audio has accumulated, instead of the first ≥2 s clip under the threshold sticking for the session.no_matchis only recorded once there is enough evidence.utils/sync/pipeline.py): same threshold/margin policy; all enrolled candidates remain in the ambiguity comparison, then one-person/one-speaker dedup is applied.speaker_id_decisionlog line (surface, best, best/runner-up distance, evidence seconds, accepted), so live decisions can be compared with the offline bench; offline verification does not establish deployed accuracy.backend/scripts/speaker_id_bench/: the bench, reproducible in ~15 min with bucket read access; user audio stays on the machine running it and is deleted after.Dead SpeechBrain matcher removed
get_speech_profile_matching_predictionsand the SpeechBrain ECAPA service behindHOSTED_SPEECH_PROFILE_API_URLhad zero production callers (tests only) but were still deployed and configured. Removed:modal/speech_profile_modal.py,utils/stt/speech_profile.py, the/v1/speaker-identificationroute and its vad ingress path,HOSTED_SPEECH_PROFILE_API_URLin all four chart overlays and.env.dev.template, thespeechbraindependency and the shared-packageCOPYlines in the modal image (nothing undermodal/imports them any more), the dev-harness endpoint/capability and e2e fake, the unusedListenLimits.speaker_id_target_audio, and the test-only helpersis_same_speaker/find_best_match/embedding_to_bytes/bytes_to_embedding. Docs updated.Speech-profile flow from #12531
Settings "Redo" admission fix (
speech_profile_redo),GET /v3/speech-profile/stt-availabilitypre-flight, on-device STT fallback, iOS 26 SpeechAnalyzer, the redesigned speech-profile screens, sentence-based completion, fresh conversation per onboarding-mode session. See #12531 for its full description and test plan. Not carried:4ebcb3d2c7(drop speech-profile/memory-graph onboarding steps) — reverted in3fdd695ae5; first-run onboarding keeps the speech-profile step.Review hardening
Future.timeout: it cannot cancel provider work and allowed overlapping recognition/retries. Polling remains single-flight until the provider settles and ignores results from a closed session.flutter gen-l10nemits zero untranslated-message warnings.Review validation: all 140 local preflight checks passed on the complete committed diff; 396 selected backend tests passed; full Flutter suite: 1,836 passed, five skipped; Dart analyzer ratchet passed; Python typecheck: zero errors. The complete pre-push gate passed, including the desktop Swift debug build and generated-client checks. Native deadline behavioral tests run through the local/CI manifest and exercise pending shared downloads, late completions, and cleanup ordering. The native speech implementation typechecks against the installed iOS SDK with Flutter boundary types stubbed; this is not a full iPhone build or live enrollment test. No private-enrollment benchmark rerun or production data mutation was performed. The changed sync expectations follow the 0.10 margin's measured household-confusion rationale above; clearly distinct speakers and uniqueness remain covered.
Test plan
test_speaker_match.py(20 new),test_speaker_id_pipeline.py(144),test_user_speaker_embedding.py(28),test_parakeet_diarization.py,test_speaker_person_embedding_recovery.py,test_transcribe_speaker_id_queue_pii.py,test_thread_join_elimination.py,test_async_resource_correctness.py,test_runtime_image_contracts.py,test_clean_sweep_migrations.py,test_sync_transcription_prefs.py(64),test_sync_silent_failure.py,test_sync_opus_decode.py,test_sync_pcm_decode.py,test_desktop_transcribe.py,test_listen_runtime_regressions.py,test_transcribe_decisions.py,test_short_audio_embedding.py,test_speaker_sample_migration*.py— all green locallyscripts/typecheck.sh: 0 errorsscan_import_time_side_effects.pyon changed production files: 0 violations;check_dead_code.py --area backend: ok--checkmodes clean; the only delta vsmainis thestt-availabilityroute from Speech Profile Onboarding Fix & UI Improvements #12531data/reports/2026-09-07-speaker-id-offline-bench.mdin the workspace repo)Product invariants affected: none
Failure-Class: new
Line-Count-Exception: backend/utils/sync/pipeline.py | 2535 -> 2537 | Keep all enrolled candidates in the ambiguity margin and log the final dedup acceptance in the existing matching function; two added lines avoid a broader pipeline extraction in this correctness fix.
Line-Count-Exception: backend/utils/stt/streaming.py | 1792 -> 1836 | From #12531:
_primary_streaming_service()alongsideis_stt_available()so the client pre-flight resolves against the configured STT primary; kept main'sopen_provider_selection_circuitin the same region.🤖 Generated with Claude Code