Repository navigation
fix(app,backend): disconnect nags, WAL opus sync, speech-profile identity - #12893
Conversation
There was a problem hiding this comment.
1 issue found across 26 files
Confidence score: 5/5
app/lib/utils/speech_profile_enroll_events.dartis currently unused because nothing underapp/libimports it, so the defined event types and names have no runtime effect; wire the file into its consumers or remove it to avoid shipping dead code.
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="app/lib/utils/speech_profile_enroll_events.dart">
<violation number="1" location="app/lib/utils/speech_profile_enroll_events.dart:6">
P3: This new file is dead code in the app: nothing under `app/lib` imports `speech_profile_enroll_events.dart`, so `SpeechProfileEnrollEvent`, `speechProfileEnrollEventName`, and `speechProfileContinuedEventName` are only exercised by their own unit test. The same five event-name strings are already the canonical definitions in `analytics_manager.dart` (`speechProfileSkipped`, `speechProfileUploadSucceeded`, `speechProfileUploadFailed`, `speechProfileEmbeddingStored`, `speechProfileContinued`), so keeping a second copy invites drift between the two. Either wire the production speech-profile flow through this helper and drop the duplicate strings from `analytics_manager`, or remove this file and its test.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| /// `Onboarding Step Speech Profile Completed` used to fire on All Done even | ||
| /// when the upload failed or the user skipped. These events are the ones | ||
| /// that mean a voiceprint actually did or did not land. | ||
| enum SpeechProfileEnrollEvent { skipped, uploadSucceeded, uploadFailed, embeddingStored } |
There was a problem hiding this comment.
P3: This new file is dead code in the app: nothing under app/lib imports speech_profile_enroll_events.dart, so SpeechProfileEnrollEvent, speechProfileEnrollEventName, and speechProfileContinuedEventName are only exercised by their own unit test. The same five event-name strings are already the canonical definitions in analytics_manager.dart (speechProfileSkipped, speechProfileUploadSucceeded, speechProfileUploadFailed, speechProfileEmbeddingStored, speechProfileContinued), so keeping a second copy invites drift between the two. Either wire the production speech-profile flow through this helper and drop the duplicate strings from analytics_manager, or remove this file and its test.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/lib/utils/speech_profile_enroll_events.dart, line 6:
<comment>This new file is dead code in the app: nothing under `app/lib` imports `speech_profile_enroll_events.dart`, so `SpeechProfileEnrollEvent`, `speechProfileEnrollEventName`, and `speechProfileContinuedEventName` are only exercised by their own unit test. The same five event-name strings are already the canonical definitions in `analytics_manager.dart` (`speechProfileSkipped`, `speechProfileUploadSucceeded`, `speechProfileUploadFailed`, `speechProfileEmbeddingStored`, `speechProfileContinued`), so keeping a second copy invites drift between the two. Either wire the production speech-profile flow through this helper and drop the duplicate strings from `analytics_manager`, or remove this file and its test.</comment>
<file context>
@@ -0,0 +1,23 @@
+/// `Onboarding Step Speech Profile Completed` used to fire on All Done even
+/// when the upload failed or the user skipped. These events are the ones
+/// that mean a voiceprint actually did or did not land.
+enum SpeechProfileEnrollEvent { skipped, uploadSucceeded, uploadFailed, embeddingStored }
+
+String speechProfileEnrollEventName(SpeechProfileEnrollEvent event) {
</file context>
There was a problem hiding this comment.
Addressed on the rebased tip: speech_profile_enroll_events.dart is the single source for the enroll event-name strings and is imported by analytics_manager.dart. Production onboarding fires them via speechProfileSkipped / speechProfileContinued (wrapper) and speechProfileUploadSucceeded / speechProfileUploadFailed / speechProfileEmbeddingStored (SpeechProfileProvider.finalize). Keeping the helper avoids string drift; removing it would duplicate the names back into analytics_manager.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks @apoorvdarshan - this is a thoughtful bundle. The embedding-stack unification (#12765), the "a 200 means the voiceprint stored" enroll contract, the honest All Done vs enroll-success telemetry, and the honest Android foreground-service Reconnecting/Disconnected states are all real improvements, and the new backend and Flutter unit tests are appreciated. Requesting changes only for the two CI blockers; the rest is feedback.
Blocking (both checks red on this head):
- Backend unit suite:
tests/unit/test_speaker_person_embedding_recovery.py::test_recovered_embedding_is_usable_for_matchingfails withAttributeError: module 'routers.listen.speakers' has no attribute 'SPEAKER_MATCH_THRESHOLD'. This diff swaps that constant forspeaker_match_outcome(...)inbackend/routers/listen/speakers.py, but the untouched test still readsspeakers_mod.SPEAKER_MATCH_THRESHOLDat its assertion. Easiest fix: keepSPEAKER_MATCH_THRESHOLDin the import list alongside the new names, or update the test tospeaker_match_outcome(...) == 'accept'. - Formatting:
black --checkwould reformatbackend/utils/stt/speaker_embedding.pyandbackend/tests/unit/test_user_speaker_embedding.py(e.g. the newSPEAKER_EMBEDDING_MODEL_ID = os.getenv(...)block uses single quotes). Running the repo formatter on those two files resolves it.
Should fix / confirm:
app/lib/utils/device_disconnect_notification.dart:shouldNotifyDeviceDisconnectis never called from production -app/lib/providers/device_provider.dartonly adds a comment on the disconnect path. As shipped, the #3328 app-side policy is enforced only by its unit test. Please either wire it into the disconnect path (with a persistedlastNotifiedAt), or drop it for now and keep only the backend/Android pieces - an unwired policy helper tends to drift from actual behavior. Same shape forapp/lib/utils/speech_profile_enroll_events.dart: nothing underapp/libimports it, and the same five event-name literals are defined again inanalytics_manager.dart; havinganalytics_managerreference these constants (single source of truth) would remove the drift risk the new test currently can't catch.backend/utils/stt/speech_profile.py: the rewrite replaces one batched hosted call with one/v2/embeddingcall per segment (the sync path runs them sequentially; the async path gathers under a Semaphore(8)). I could not find a production caller ofget_speech_profile_matching_predictions/async_get_speech_profile_matching_predictionsanywhere in this repo (only tests import them) - if that's right, please confirm nothing external depends on the old batch contract, and noteHOSTED_SPEECH_PROFILE_API_URLis now orphaned in four helm values files (charts/pusherandcharts/backend-listen, dev + prod) plusbackend/.env.dev.template; a cleanup (here or a follow-up issue) would help. Also flagging a real behavior change: segments shorter thanMIN_EMBEDDING_AUDIO_DURATION(0.5s) now resolve tois_user: Falsewithout any model decision, where the old classifier saw every segment - fail-closed looks right for identity claims, just want it to be intentional.backend/routers/speech_profile.py: enroll now persists the Firestore voiceprint beforeupload_profile_audio; if the GCS upload subsequently throws, the request 500s with the embedding already stored - the inverse of the inconsistency the new ordering comment describes. Consider handling that edge (or documenting it as accepted) so the stored-state invariants stay explainable.
For maintainers (non-blocking for the contributor): backend/utils/other/notifications.py hard-disables the daily "wear your omi" reminder for all users via should_send_wear_device_reminder() -> False, locked by test. That matches #3328's ask and the helper keeps re-enabling cheap, but a blanket off-switch on a re-engagement channel plus the new fail-closed enroll semantics (503 when the embedding API or Firestore is degraded - users can no longer complete speech-profile upload while identity infra is down) deserve an explicit product sign-off before merge.
No split requested - the three concerns are separable but each is small and independently rollbackable; happy to re-review once the two CI items are fixed.
Automated review on behalf of the Omi maintainers. AI-generated feedback; a human maintainer makes the final call.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
|
Addressed @Git-on-my-level review on
Ready for re-review once CI settles. |
|
@Git-on-my-level ready for re-review — the two CI blockers and the should-fix items from your review are on
CI on the latest head was green when last checked. Happy to address anything else. |
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks @apoorvdarshan - re-reviewed on 2d20dc2. Both CI blockers from my earlier review are fixed and verified: the recovery test now asserts speaker_match_outcome(...) == 'accept' (backend/tests/unit/test_speaker_person_embedding_recovery.py), and formatting is green on this head. The should-fix items landed too: the unwired disconnect-nag helper and its dead-code allowlist entries are gone, analytics_manager.dart is now the sole consumer of the enroll-event name constants, and the enroll write ordering (extract -> persist voiceprint -> upload audio, with the accepted-inverse comment) is documented in backend/routers/speech_profile.py.
A few things I verified on this head beyond the earlier items:
- backend/routers/listen/speakers.py: swapping
best_distance < SPEAKER_MATCH_THRESHOLDforspeaker_match_outcome(best_distance) == 'accept'is behavior-preserving -best_distanceis initialized tofloat('inf')and themath.isfiniterejection matches the old comparison exactly, so only the new telemetry log line changes observable output. - app/lib/utils/wal_sync_upload.dart + app/lib/backend/http/api/conversations.dart: I traced the production callers of
uploadLocalFilesV2- WAL names areaudio_*.binby construction (wal.dart getFileName()), local recordings filteraudio_omibatch*.bin, and no.partsuffix exists in the app, so the newArgumentErrorguard should not fire in practice; the sync gate also wraps_uploaderin a catch that records a retryable failure rather than crashing. - backend/utils/stt/speech_profile.py: decode failures now fail open to
_unknown_match()(is_user: False) instead of raising, short segments skip embedding without claiming the user, and the async path gathers per-segment embeddings underSemaphore(8). The sync path still runs per-segment embeddings sequentially - fine whileget_speech_profile_matching_predictionshas no production caller (still tests-only in this repo).
Remaining non-blocking follow-up: HOSTED_SPEECH_PROFILE_API_URL is now orphaned in backend/charts/pusher/{dev,prod}_omi_pusher_values.yaml, backend/charts/backend-listen/{dev,prod}_omi_backend_listen_values.yaml, and backend/.env.dev.template - worth a small cleanup issue.
For maintainers (non-blocking, pre-merge sign-off): the blanket off-switch on the daily wear reminder in backend/utils/other/notifications.py, the fail-closed enroll semantics (503 while the embedding API or Firestore is degraded), and the removal of the hosted SpeechBrain matching path in favor of the shared /v2/embedding stack are product/infra decisions that deserve an explicit human yes before merge.
Automated review on behalf of the Omi maintainers. AI-generated feedback; a human maintainer makes the final call.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
Both blockers from this review are fixed and verified on the current head (2d20dc2): the person-embedding recovery test asserts speaker_match_outcome(...) == "accept", and formatting is green across the suite. Dismissing as resolved; latest automated review carries the current state.
…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]>
44c4bf7 to
2ad6c69
Compare
|
Rebased onto latest Also restored the fail-closed enroll ordering that had been lost during earlier "align with main" commits: extract + Firestore voiceprint store happen before GCS upload (503 otherwise), matching the PR claim that a 200 means the voiceprint landed. Cubic follow-ups answered in-thread (short-segment / sequential-embedding N/A after #12935; enroll-events kept and wired through |
|
Re-reviewed on What the rebase changed, verified against
Verified per file on this head:
Checks are green on Still maintainer calls before merge, same three as before the rebase: the blanket off-switch on the daily wear reminder (a user-facing product choice — #3328 asks for it, but flipping it back on is now a one-line change someone must own), the fail-closed enroll semantics (users get 503s while the embedding API or Firestore is degraded — right for "a 200 means the voiceprint stored", but it's an availability trade), and re-confirming kodjima33's 2026-09-08 approval on the pre-rebase head Automated review on behalf of the Omi maintainers. AI-generated feedback; a human maintainer makes the final call. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
Re-check 2026-09-09: branch was rebased since yesterday's approval (head now 2ad6c69, was 2d20dc2) — diff shrank from 24 files/741 lines to 16 files/269+/25- as parts already landed on main; CI green, but mergeStateStatus is BLOCKED (stale approval dismissed by the push) and not DIRTY. Re-approving; still not merging per BLOCKED state, confidence unchanged at 4/5.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Re-verified on squashed head 2ad6c69 against latest main:
- No overlap with landed work: every remaining hunk is absent from current main. The parts obsoleted by #12935 (short-segment is_user hard-coding, per-segment sequential embedding HTTP against the retired utils/stt/speech_profile.py) are correctly dropped by the rebase.
- #12765: /v3/upload-audio fail-closed ordering (extract -> Firestore voiceprint store -> GCS upload, 503 on extract/store failure) restored after the rebase and reviewed; app handles the new 503 via completeAfterUploadFailure.
- #3328: wear-reminder kill-switch gates only the wear push, not the daily summary; FGS notification now honest about whether a retry is scheduled.
- #5363: WAL filename guard is fail-fast on app-produced audio_*.bin names.
- CI green on this head (Android Compile Smoke, Backend unit suite, Dart Analyze & Tests, Hermetic E2E).
Merging under maintainer bypass. @mdmohsin7 FYI on the OmiBleForegroundService.kt and device_provider.dart touches — they are comment/notification-state only, no connection-state changes.
## 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
What changed and why
Closes #3328, #5363, and #12765. Rebased onto latest BasedHardware/omi
main(force-pushed same branchfix/mobile-open-issues; did not sync the forkmain)..wavon WAL/v2/sync-local-filesso sync stays framed opus/PCM.bin.POST /v3/upload-audioextracts+stores the voiceprint before overwriting GCS audio (503 on extract/store failure). Onboarding analytics distinguish skip/continue from upload/embedding-stored viaspeech_profile_enroll_events.dart→analytics_manager.Product invariants affected
none
How it was verified
cd backend && source .venv/bin/activate && python -m pytest tests/unit/test_wear_device_reminder.py tests/unit/test_user_speaker_embedding.py tests/unit/test_speech_profile_wav_decode.py -m "not integration and not slow" -q→ 36 passedutils/stt/speech_profile.py; enroll-events thread replied as wired throughanalytics_manager(thread resolve may need a maintainer click — bot lacks resolve permission)Tests
backend/tests/unit/test_wear_device_reminder.py— wear reminder stays offbackend/tests/unit/test_user_speaker_embedding.py— enroll fails closed on extract/store failure; upload skipped until voiceprint landsbackend/tests/unit/test_speech_profile_wav_decode.py— duration guards still pass with store patchapp/test/unit/wal_sync_upload_test.dart/speech_profile_enroll_events_test.dart— name contractsFailure class (fixes)
Failure-Class: none
Cubic review follow-ups
is_user: False— obsolete; matcher module removed by Speaker identification: measured threshold + margin, live clip pooling, SpeechBrain retirement; carries #12531 without the onboarding-step removal #12935speech_profile_enroll_events.dart— kept as single source of event strings; wired viaanalytics_manager+ onboarding/provider call sites