omi icon indicating copy to clipboard operation
omi copied to clipboard

“Recognize me” (speech profile speaker ID) not applied after profile re-record + app reset; manual speaker tagging in one convo “activates” it for the rest of the day (likely cache/flag not set on upload path)

Open hugoaap-code opened this issue 9 months ago • 1 comments

Note: The specific docs/code pointers and suspected backend mechanisms mentioned below were suggested by Vetor, the AI help agent (not discovered independently by the reporter).

Report type: Bug
Area: transcription, diarization, speech profile, speaker assignment, caching/flags

What’s broken

Diarization is working (it correctly detects multiple speakers/segments), but the “Recognize me” feature (speech-profile based speaker identification that should map one diarized speaker to the user) fails.

This persists even after:

  • re-recording the speech profile (multiple times)
  • resetting the app

Expected behavior

After a successful speech profile re-record/upload (and after app reset), new conversations should consistently map diarized speakers to the user when the user speaks.

Actual behavior

  • Conversations are diarized into multiple speakers correctly.
  • However, the system does not tag the user as the speaker via “Recognize me”.
  • Re-recording the speech profile and resetting the app do not reliably restore “Recognize me”.

Reliable workaround (and why this is suspicious)

Workaround pattern:

  1. Start a conversation and record a short multi-speaker interaction (or any convo where the user speaks).
  2. In the transcript UI, manually tag the user as the speaker for the relevant diarized speaker/segments.
  3. End the conversation.
  4. Subsequent conversations for the rest of the day correctly recognize/tag the user automatically.

This strongly suggests that:

  • The upload/re-record path is not fully “activating” the speech profile for speaker ID, even if it stores it.
  • The manual tagging workflow triggers a backend path that sets a “profile available/processed/active” flag and/or invalidates a stale cache, after which speaker assignment starts working again.

Hypothesis

There is likely a backend state issue where the “speech profile processed/available” state is not being flipped/refreshed from upload alone, but is set when the user manually tags a speaker (which may trigger a reprocess or speaker-assignment rerun).

Possible root causes:

  • A backend “profile activation” flag/cache isn’t set on profile upload, only on later processing.
  • Redis cache still indicates “no active speech profile” even after upload (stale key, missing invalidation).
  • The include_speech_profile flag/dual-socket path isn’t being applied because speech_profile_processed never becomes true.
  • Manual tagging triggers a reprocess that sets the missing flags (or routes through a different speaker assignment pipeline).

Pointers to docs + code paths to inspect (from Vetor)

Docs references:

  • docs/doc/developer/backend/transcription.mdx
    • look for include_speech_profile, speech_profile_processed, dual-socket / profile inclusion behavior
  • docs/doc/developer/backend/backend_deepdive.mdx
    • Redis/GCS speech-profile flags and related caching
    • look for flags like set_user_has_soniox_speech_profile, speech_profile_processed and anything indicating profile readiness

Code/testing references:

  • Speaker assignment logic and tests:
    • backend/tests/unit/test_speaker_assignment.py
  • Speech profile upload/router:
    • backend/routers/speech_profile.py (or equivalent)
    • any “speech profile router” used by upload/re-record
  • Conversation processing / reprocess hooks:
    • backend/utils/conversations/process_conversation.py (or equivalent)
    • anything triggered by manual speaker tagging that might rerun assignment
  • Storage/cache utils:
    • backend/utils/other/storage.py (or equivalent)
    • Redis key writes/reads for “has speech profile”, “processed”, “ready”, “active”

What to check in logs/telemetry (suggested)

Compare a “broken” convo vs “fixed after manual tag” convo and verify:

  • Does the transcription request include include_speech_profile=true in both cases?
  • Is speech_profile_processed false before manual tag and true after?
  • Are Redis flags indicating profile readiness missing or stale until manual tagging happens?
  • Does manual tagging trigger a reprocess job or speaker assignment rerun that sets/refreshes keys?
  • Are there multiple code paths for speaker ID (upload path vs reprocess path) that diverge in flag-setting?

Repro steps (as observed)

  1. Re-record speech profile.
  2. Reset app (optional, still fails even with reset).
  3. Start new conversation, record multi-speaker audio.
  4. Observe diarization works, but “Recognize me” doesn’t tag the user.
  5. Apply workaround:
    • manually tag the user as speaker in transcript
    • end conversation
  6. Start a new conversation:
    • observe “Recognize me” now works for subsequent conversations (typically for the rest of the day).

Workaround

Manual speaker tagging in one conversation, then end convo. Subsequent convos correctly recognize/tag user for the rest of the day.

Requested fix

Ensure speech profile re-record/upload path reliably:

  • flips the correct “profile ready/processed/available” backend flags, and
  • invalidates any stale Redis cache keys, so that “Recognize me” works immediately without requiring a manual-tag “kick”.

hugoaap-code avatar Feb 17 '26 16:02 hugoaap-code

Investigated the code paths end-to-end. The hypothesis in the issue (that manual tagging triggers a backend path that sets a missing activation flag) doesn't hold — the expand_speech_profile call in the manual tagging endpoint is commented out (# thinh's note: disabled for now in conversations.py:408). Manual tagging just updates is_user/person_id on segments in Firestore, no profile reprocessing or flag-setting happens.

The core speech profile flow is:

  1. get_user_has_speech_profile(uid) — checks GCS blob existence (real API call per session)
  2. Speech profile audio downloaded from GCS and sent to STT socket as preseconds
  3. speech_profile_complete event fires when profile send finishes
  4. Segments after that point get speech_profile_processed=True
  5. can_assign gates speaker assignment on having at least one speech_profile_processed=True segment

This flow works correctly when the profile exists and loads successfully. The reporter's observation that manual tagging 'fixes it for the rest of the day' is likely a timing coincidence (GCS caching, STT service warmup, or client-side state) rather than a causal fix.

The real diarization/speaker-ID accuracy issues are tracked in #5470. Closing as not-planned since the specific bug mechanism described doesn't match the code.

atlas-agent-omi avatar Mar 11 '26 14:03 atlas-agent-omi