Speaker diarization and identification stopped working automatically
Problem
Speaker diarization and identification stopped working automatically today (March 31, 2026). It was working fine yesterday.
Symptoms
- New conversations do not automatically start diarization - no speaker labels are being assigned
- Manual assignment works but doesn't persist - if user manually assigns speakers in one conversation, it works for that conversation only
- Speaker assignments do not carry over to next conversation - the system is not remembering identified speakers
- Automatic speaker identification is broken - no automatic recognition across conversations
Expected Behavior
- Diarization should start automatically on new conversations
- Once speakers are identified/assigned, the system should remember them for future conversations via speaker profiles/embeddings
- Speaker identification should work consistently across all conversations using voice embeddings
Timeline
- ✅ Working correctly: March 30, 2026 and before
- ❌ Issue started: March 31, 2026
Technical Context
The manual assignment feature still works within a single conversation, but the persistence and automatic recognition across conversations is broken. This suggests the issue might be related to:
- Speaker profile matching/embedding comparison
- User preference storage for speaker profiles
- Speaker-to-person mapping persistence
- Speech profile lookup or caching
Possible Causes
- Recent backend changes to speaker identification logic
- Database migration affecting
speech_profilesorpeoplecollections - Redis cache invalidation for speaker embeddings
- Breaking change in
utils/speaker_identification.pyorutils/stt/speaker_embedding.py
Priority
High - Core feature regression affecting all users. Speaker identification is a key differentiator for Omi.
Investigation Update
Found the likely root cause. Massive speaker identification refactor on March 28-29, 2026:
Breaking Changes (commits from last 3 days):
March 28:
c4ea57f62- Replace presecond trick with speaker embedding for user identification378ef1441- Remove presecond speech profile trick from streaming module0e738af84- Fix user sentinel mismatch: use 'user' to match speaker_assignment.pybf7788cdb- Extract and store speaker embedding at speech profile upload timebc87e7a2d- Load user speaker embedding from Firestore instead of extracting from WAV each session29581e942- Add user-level speaker embedding storage functions to Firestore
March 29:
9a8ea792e- Implement speaker_map_dirty flag for efficient retroactive speaker assignment335690d69- Fix: only run speaker assignment on current batch, not all segments0904234a8- Flush speaker assignments before conversation rolloverc92d3dbce- Drain in-flight speaker match tasks before conversation rollover
Root Cause Hypothesis:
The old system used "presecond" speech profile trick (extracting user voice from first second of audio).
The new system expects speaker embeddings stored in Firestore at speech profile upload time.
The migration broke persistence because:
- Old users don't have embeddings in Firestore (only WAV files)
- The new code loads embeddings from Firestore (
bc87e7a2d) but may not be falling back to WAV extraction properly - Without embeddings, automatic speaker matching fails silently
- Manual assignment works because it bypasses embedding lookup
Affected Code:
backend/utils/stt/streaming.py- removed presecond extractionbackend/utils/stt/speaker_embedding.py- new Firestore loading logicbackend/utils/speaker_assignment.py- user sentinel changesbackend/database/users.py- new embedding storage functions
Fix Needed:
- Add migration to extract and store embeddings for existing users with speech profiles
- Ensure fallback: if Firestore embedding missing, extract from WAV and cache
- Or: auto-trigger embedding extraction on first conversation after upgrade
Verification:
Check if users with speech profiles uploaded before March 28 have speaker_embedding field in Firestore. If missing, that's the bug.
@beastoin @mdmohsin7 gift for you
@hugoaap-code We investigated this by pulling 48h of production speaker identification logs (Mar 30–31). The system is actively running with consistent volumes across both days — no drop on March 31. Specifically: embeddings are loading (566 unique UIDs on Mar 31), comparisons are running (2,351 on Mar 31 vs 2,318 on Mar 30), and successful matches are happening (e.g. speaker 1 -> USER distance=0.428). The March 28–29 speaker refactor and March 31 translation refactor (fd25ede51) did not break speaker identification — both the embedding loading path (routers/transcribe.py:1716-1749) and the WAV fallback (commit 2b23ddc0c) are working with 0 extraction errors.
Two things we did find: (1) 5,000+ sessions correctly skip speaker ID because those users never set up speech profiles — this is expected, not a bug; (2) one user has corrupted person embeddings causing a dimension mismatch error, which is a data issue not a code regression.
To dig deeper into the specific case, can you share the affected user's UID and the exact timeframe (UTC) when they observed the issue? That way we can trace their specific sessions in the logs.
by AI for @beastoin