Skip to content

feat(people): speaker tag prompts — teach Omi voices from the last 48 hours - #18483

Merged
Git-on-my-level merged 16 commits into
mainfrom
feat/people-tag-prompts
Sep 24, 2026
Merged

Git-on-my-level merged 16 commits into
mainfrom
feat/people-tag-prompts

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

What

A "Google Photos style" speaker tagging card. At most once a day, the conversations list shows a small card that plays a few short, clean clips from the last 48 hours and asks:

  • "Is this you?": free for everyone. It trains the owner's voiceprint.
  • "Is this Sam?": confirms an automatic match nobody has reviewed yet (paid, named speaker-ID).
  • "Who is this?": names an unknown voice (paid, named speaker-ID).

Each answer becomes a normal manual speaker assignment. It is also a verified voice sample, so recognition improves for that user over time. The first time the card appears, it shows an inline switch, "Remember voices of people you name" (on by default). The same switch and "Ask me to tag voices" live in Settings → Identifying Others.

Product rulings (David, 2026-09-24):

  • Clips come only from the last 48 hours.
  • The owner check is free.
  • Saving other people's voice profiles is on by default and can be turned off in Settings, with an easy inline switch the first time.
  • User-friendly language.
  • Privacy-safe instrumentation and quality measurement.

Design record: omi-knowledge-base/projects/people-intelligence-foundation/README.md §6–7.

How

Backend (routers/speaker_tag_prompts.py, utils/speaker_tag_prompts/, database/voice_profiles.py, models/speaker_tag_prompts.py)

  • Selection (selection.py) is pure. It considers conversations from the last 48 hours that have stored audio (private cloud sync). A candidate is one diarized speaker's longest clean stretch: consecutive segments with no other voice between them, at least 5 s, clipped to 10 s, and never already decided by a manual receipt. Ranking:

    1. "Is this you?" on the loudest unnamed voice when the owner was never recognised or has no voiceprint.
    2. Unreviewed person matches.
    3. Unreviewed owner labels.
    4. The unnamed voices that talked the most.

    Caps: at most 4 prompts per set, 2 per conversation, 2 owner checks. Answered prompt ids are remembered for 7 days.

  • Pacing is owned by the server: a 20 h cooldown after a set is shown, a 7-day back-off after three unanswered sets in a row, and a 2 h cache of empty scans so repeated app opens don't rescan 30 conversations.

  • Answers go through the existing assign_conversation_speaker transaction. A prompt answer is indistinguishable from a tag-sheet edit. Rejecting an automatic label writes an explicit unknown decision.

  • "That's me" now trains the owner voiceprint. Before this PR, owner tags never added a sample. The clip must be only the owner for 5–10 s and pass verify_and_transcribe_sample. It is then pooled: speaker_embedding = normalized mean of the enrollment voiceprint (kept as speaker_embedding_base, refreshed when another writer replaced it) plus the last 5 confirmations. This targets the 71% cross-session owner false-reject measured in the speaker-ID bench.

  • The "save other people's voices" opt-out (users/{uid}.save_other_voice_profiles, default on) is enforced inside extract_speaker_samples. That is the one function every teaching path reaches (tag sheet, tag prompts, live socket), so it can't be bypassed.

  • Clip endpoint: GET /v1/speaker-tag-prompts/clip returns at most 12 s of the user’s own stored audio as base64 WAV JSON. It is rate limited.

  • Entitlement: named_speaker_prompts_allowed() = valid paid plan. Free users only get owner checks.

Mobile (SpeakerTagPromptCard, SpeakerTagPromptsProvider, api/speaker_tag_prompts.dart, VoiceProfileSettingsSection)

  • The card sits above the conversation list. It uses generated wire DTOs (new speaker_tag_prompts group) and has a Key on every control.
  • 21 new strings across all 49 locales, added via scripts/l10n.py.

Instrumentation (privacy-safe by construction)

  • Prometheus, closed-enum labels only: omi_speaker_tag_prompt_{requests,served,sets,answers,quality,voice_samples}_total and omi_voice_profile_setting_changes_total.

  • The quality counter turns answers into recognition-quality observations with no names, text, audio, embeddings or ids:

    • owner precision: owner_auto_confirmed / owner_auto_rejected
    • person precision: person_auto_confirmed / person_auto_corrected
    • misses: owner_missed, person_missed_known

    These are biased toward what was asked, so read them as trends per kind.

  • Backend PostHog: Speaker Tag Prompts Shown, Speaker Tag Prompt Answered, Voice Profile Setting Changed (enums and bools only).

  • Mobile typed events (C7 registry), with a new speaker-tag-prompts-funnel consumer: viewed, clip played (and whether it loaded), answer submitted (kind, answer, clip played, first time, succeeded), closed (answered/total), setting toggled (setting, source).

Review

A Devin Fusion review pass (fixes verified and adjusted in refactor(people): harden…):

  • Clean clips now reject any time overlap with another diarized voice.
  • Owner clips accept a single voice only.
  • The opt-out is re-checked inside the person-profile write transaction.
  • Pacing writes are transactional.
  • Owner pooling creates a missing user doc.
  • The mobile provider ignores stale responses after an account switch.

Screenshot pass (rendered widgets):

  • On iOS, the "Someone new" name dialog had no Material ancestor for its text field (it became a Cupertino dialog after the shared-dialog switch), so it would have thrown. It's now wrapped like the other text-field dialogs, with an iOS widget test.
  • Suggested-name chips now rebuild when the People list finishes loading after the card; before, a cold start could leave them missing.
  • UI cleanup: every trailing control on the People page (delete icons, switches) now sits on one 16pt edge, and voice samples are labelled Sample 1, 2, … instead of "Voice Profile", then "Sample 1". On the card, all answers are the same pill shape with 44pt targets, and "1 of 3" moved beside the question so the header no longer wraps.

Not in this PR (follow-ups)

  • Cross-conversation voice grouping (ask once for "the same unknown voice in 6 conversations"). This needs persisted unnamed-speaker embeddings. Until then, prompts are per conversation speaker.
  • A "Don't ask about this voice" suppression, which depends on the grouping above.
  • The macOS desktop surface. This PR ships backend + mobile.

Product invariants affected

  • INV-DATA-1: not changed. app/lib/main.dart only registers one more ChangeNotifierProvider. No Firebase project, account, or API endpoint selection is touched, and new calls use the existing Env.apiBaseUrl + executeApi path.

Line-Count-Exception: backend/database/users.py | 2356 -> 2362 | the "save other people's voices" opt-out must be re-read inside the existing person speech-profile write transaction to close the race with in-flight extraction; moving that transaction out of users.py is a separate refactor

Verification

  • Backend (BACKEND_UNIT_TEST_FILE_LIST=… bash backend/test.sh):
    • new: test_speaker_tag_prompt_selection.py, test_speaker_tag_prompts_service.py, test_voice_profiles_db.py (StrictFirestore transaction), test_speaker_tag_prompts_router.py
    • updated: test_taught_speaker_persistence.py (+ opt-out test), test_speaker_identification_language_fallback.py
    • 163 existing files that import speaker ID, routers, or rate limits: green.
  • Mobile: test/providers/speaker_tag_prompts_provider_test.dart, test/widgets/speaker_tag_prompt_card_test.dart (21 tests) and the C3 spine suite (138).
  • Contracts:
    • python3 scripts/check_event_registry.py
    • scripts/openapi_runner.sh scripts/export_openapi.py --surface app-client --check
    • generate_dart_models.py --group speaker_tag_prompts
    • python3 scripts/l10n.py check
  • Not verified on a device or against a live backend. The clip endpoint and owner-sample pooling are unit-tested with fakes only.

🤖 Generated with Claude Code

Git-on-my-level and others added 7 commits September 24, 2026 13:09
… 48 hours

Once a day, a small card on the conversations list plays a few short, clean
clips from the last 48 hours and asks "Is this you?", "Is this <name>?" or
"Who is this?". Answers reuse the manual speaker-assignment transaction and
feed the existing voice-sample quality gates, so each one improves speaker
recognition for that user over time.

- Owner check is free; naming other people follows the named speaker-ID
  entitlement (paid plans).
- "That's me" now trains the owner voiceprint: a verified clip is pooled with
  the enrollment voiceprint (last 5 confirmations).
- Saving other people's voices is on by default with a new setting to turn it
  off; the first prompt shows the switch inline. The switch is enforced in
  extract_speaker_samples, the one path every teaching flow reaches.
- Server-owned pacing: 20h cooldown after a shown set, 7-day back-off after
  three unanswered sets, 2h cache of empty scans.
- Privacy-safe instrumentation: Prometheus counters with closed-enum labels
  (requests, served, answers, quality outcomes, voice samples, setting
  changes), backend product events without names/text/ids, and typed mobile
  events with a registered funnel consumer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…N clip payload

The mobile API boundary forbids new nullable HTTP helpers, so every speaker
tag-prompt call now goes through executeApi and the provider handles each
failure explicitly. executeApi decodes bodies as text, so the clip endpoint
returns base64 WAV in a typed SpeakerTagPromptClip instead of raw bytes.
The typed conversation screen harness registers an inert prompts provider.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Findings from a Devin Fusion review pass, verified and adjusted:
- Clean clips must not overlap another diarized voice in time; a clean run
  wins over a longer overlapping one for the same voice.
- Owner clips: one diarized voice only; verification text comes from
  segments overlapping the clip window (a cropped long turn still counts);
  only segments the answer actually assigned are sampled.
- Owner pooling creates the user document when missing.
- The "save other people's voices" opt-out is re-checked inside the person
  profile write transaction, closing the race with in-flight extraction.
- Pacing state writes (shown / dismissed / answered) are transactional so
  concurrent requests cannot lose counts or answered ids.
- Mobile provider ignores responses from a previous account session and
  stale clip loads (generation + playback tickets).

Reviewer-proposed changes not taken: a started_at scan (new composite
index) — created_at >= started_at, so the existing indexed created_at range
already covers every conversation that started in the window; and a
StrictFirestore change that broke existing DELETE_FIELD assertions.

Co-Authored-By: Devin <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Own PCM16 trim/WAV helpers in clips.py instead of importing private
speaker_identification functions; public speaker_id_of; typed talk-time
map; explicit Optional handling in the owner-sample path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mintlify

mintlify Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
omi 🟢 Ready View Preview Sep 24, 2026, 7:36 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

Git-on-my-level and others added 6 commits September 24, 2026 14:57
…e prefix

The app-client schema inventory gate requires OpenAPI-backed routes to
decode through wire.Generated* parsers; qualify the generated imports and
inline the object guard on the clip and voice-profile-settings calls.

Co-Authored-By: GLM (zcode) <[email protected]>
…rompt card

INV-UI-3 (new from main's UX consistency pass) ratchets hand-rolled UI in
changed files: swap color/font literals for OmiColors/OmiType, the raw name
AlertDialog for OmiAlertDialog, and extend OmiDialogAction with an optional
key so tests can still target the rendered save button.

Co-Authored-By: GLM (zcode) <[email protected]>
…rated model

The app client schema inventory gate (raw OpenAPI response decode migration)
fails on separateConversationFromCaptureGroup, which still read body['status']
from a raw jsonDecode. Pre-existing from #17297 and currently red on
origin/main, so this PR cannot go green without it.

- Add StatusResponse to the conversation wire group and regenerate
  conversation_wire.g.dart (GeneratedStatusResponse).
- Decode the separate ack via wire.GeneratedStatusResponse.fromJson;
  behavior unchanged (same enum mapping, same catch-all fallback).

Verification: tests/unit/test_app_client_schema_inventory.py 12 passed;
dart generator + utf8 contract + inventory suites 40 passed;
flutter test capture_groups_test.dart (17) and conversation_hub_actions_test.dart (10) passed;
dart analyze clean; generate_dart_models.py --all --check clean.
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Monitor run: fixed the inherited backend unit failures (schema-inventory gate) — 289a13e

Root cause. Backend unit shard 3/4 / Backend unit suite failed on test_inventory_openapi_route_response_decode_migration_complete: separateConversationFromCaptureGroup in app/lib/backend/http/api/conversations.dart still read body['status'] from a raw jsonDecode. That function pre-dates this PR (landed in #17297) and origin/main was failing the same gate at the same lines, so this PR inherited a repo-wide red gate — no open PR carried the fix.

Fix (separate commit, per opportunistic-fix guidance).

  • Added StatusResponse to the conversation wire group in backend/scripts/generate_dart_models.py and regenerated conversation_wire.g.dart (GeneratedStatusResponse).
  • Migrated the separate ack to wire.GeneratedStatusResponse.fromJson(...) — behavior unchanged (same enum mapping, same catch-all fallback).

Verification.

  • test_app_client_schema_inventory.py 12 passed; generator + utf8-contract + inventory suites 40 passed.
  • flutter test: capture_groups_test.dart (17), conversation_hub_actions_test.dart (10) passed; dart analyze clean; generate_dart_models.py --all --check clean; full bounded pre-push gate passed.
  • Post-push: Backend unit shard 3/4 and Backend unit suite now pass on 289a13e; 0 failing checks (5 long-tail CodeQL analyses still running at time of writing).

Note for maintainers: origin/main's own Backend Unit Tests run is red on this same gate; merging this PR's commit resolves it for main as well.

Git-on-my-level and others added 3 commits September 24, 2026 20:29
…k on iOS cold start

The "Someone new" dialog is a CupertinoAlertDialog on iOS, which has no
Material ancestor, so its TextField threw. Wrap it in a transparent
Material like the other text-field dialogs. Suggested-person chips now
watch PeopleProvider so they appear when the people list loads after
the card. Both covered by widget tests that fail without the change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…card

- People page: person rows, sample rows and the voice switches share one
  16pt trailing edge, so the delete icons line up; samples are numbered
  Sample 1, 2, ... instead of "Voice Profile" then "Sample 1".
- Tag-prompt card: answers are uniform 44pt pills, and the "1 of 3"
  progress sits beside the question so the header subtitle no longer wraps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the l10n ARB overlaps by taking main's strings and re-adding only
this branch's speaker tag-prompt and voice-settings keys, then regenerate
the localizations. Drop planDeprecationMessage, which main removed in
#18436 and an earlier merge on this branch had brought back.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 4ec7cb4 into main Sep 24, 2026
65 checks passed
@Git-on-my-level
Git-on-my-level deleted the feat/people-tag-prompts branch September 24, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant