Repository navigation
fix(speakers): make cross-conversation speaker labeling viable on mobile (canonical identity, one manual-assignment owner, live names, summary refresh) - #15247
Merged
Conversation
Decode explicit speaker_id before the legacy label fallback and retain it through local reloads. Display numbers no longer change when a speaker is labeled as self. Validation: flutter test --no-pub test/unit/transcript_speaker_identity_test.dart test/unit/local_segment_store_test.dart (9 passed). Failure-Class: FC-split-mutation-authority
Hydrate the destination allocator inside atomic intake after deduplication. Scope provider IDs to retry-stable audio content without rewriting labels or historical segments. Validation: pytest test_sync_cross_job_assignment.py test_stt_speaker_identity.py test_taught_speaker_persistence.py (45 passed). Failure-Class: FC-split-mutation-authority
Persist MANUAL segment decisions and speaker defaults with generations; fence profile correction and overlay manual decisions on live and sync writes. Only acknowledged edits paint mobile state or wake best-effort teaching. Durable enrollment remains deferred. Validation: 83 focused backend tests; 41 trust-boundary checks; 4 projection assignment tests; 102 capture/composition Flutter tests passed. Synthetic transactions and HTTP route teaching only; no remote or acoustic acceptance. Failure-Class: FC-split-mutation-authority
Keep transcripts, sample version, and display color after an acknowledged rename. Validation: 3 PeopleProvider tests passed, including provider and persisted-cache metadata checks. Failure-Class: FC-split-mutation-authority
Subscribe transcript and photo timeline names to PeopleProvider, derive readiness from stored sample/vector evidence, and refresh profiles at new conversation boundaries. Add one select localization key in all 49 locales via l10n.py. Generate schema and clients with repository generators. Validation: 51 readiness/teaching/runtime tests, 46 lifecycle tests, and 23 Flutter transcript/people tests passed. No physical acoustic acceptance or durable enrollment worker. Failure-Class: FC-split-mutation-authority
Show the existing reprocess action beside the transcript only after a changed acknowledged label on summarized completed content. Keep retry available on failure and deduplicate in-flight requests; guard conversation selection across awaits. Validation: 16 Flutter provider/widget tests and one backend production formatter-to-stub-summary test passed. No LLM service called.
…ection Wire name-only suggestions into the existing sheet without losing the proposed name or overwriting manual labels. Drop malformed and stale events; forward live/sync language. Share deterministic legacy segment IDs between reads and manual writes. Document best-effort enrollment and capability limits. Validation: 107 capture/transcript tests and the name-sheet widget regression passed; 45 language/teaching/listen tests passed. Backend runner timing failures fixed by collection-time imports; legacy-ID read/write transaction regression included. Restore protected capture spine fixtures and use the production snapshot-install boundary for tests. Failure-Class: FC-split-mutation-authority
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Live capture now opts into speaker-wide assignment as explicit sheet state so the first bubble names later same-speaker speech; detail stays selected-only unless the user checks the control. Failure-Class: FC-split-mutation-authority Co-authored-by: Cursor <[email protected]>
Speaker-wide commands keep a constant-size speaker default, segment entries stay sparse overrides, and enhanced conversations encrypt the receipt the same way as the transcript. Failure-Class: FC-split-mutation-authority Co-authored-by: Cursor <[email protected]>
Assign routes keep main's paywall and unresolved-target wire strings while still parsing is_user without treating "false" as true, and every selector invalidates projections through the real owner. Failure-Class: FC-split-mutation-authority Co-authored-by: Cursor <[email protected]>
When combine_segments swallows a bubble, its id is removed and any manual override moves onto the survivor so preserve_unseen cannot resurrect the unlabeled clone. Failure-Class: FC-split-mutation-authority Co-authored-by: Cursor <[email protected]>
Manual speaker receipts no longer split a capture: later overlapping WAL still joins the labeled conversation, which stays the canonical survivor rather than a donor. Failure-Class: FC-split-mutation-authority Co-authored-by: Cursor <[email protected]>
In-flight match tasks keep their locks and re-check generation plus conversation id before mutating, and empty-profile sessions signal speaker_id_done without adding teardown wait. Failure-Class: FC-split-mutation-authority Co-authored-by: Cursor <[email protected]>
A successful live relabel now websocket-sends the changed bubbles instead of the whole transcript, and a failed persist backs off instead of spinning a full snapshot every 0.6s. Failure-Class: FC-split-mutation-authority Co-authored-by: Cursor <[email protected]>
Speaker-wide assign still labels every matching segment, but extraction now receives at most three ids ranked longest-first so mixed diarization cannot pick the first cluster member. Failure-Class: FC-split-mutation-authority Co-authored-by: Cursor <[email protected]>
People list skips a malformed row instead of 500ing, response-shaped payloads keep a claimed voice_readiness, and deleting a sample no longer paints unknown while a refresh is in flight. Failure-Class: FC-split-mutation-authority Co-authored-by: Cursor <[email protected]>
Acknowledged detail labeling emits taggedSegment again, the summary action has its own copy, and transcript/timeline rows receive Person from a single build-time lookup instead of decoding people per bubble. Failure-Class: FC-split-mutation-authority Co-authored-by: Cursor <[email protected]>
Assign no longer dumps the Conversation model to pick extraction candidates, so the display-projection dump pin stays exact and ranking stays on the labeled transcript already returned by the owner. Failure-Class: FC-split-mutation-authority Co-authored-by: Cursor <[email protected]>
Stubbed utils trees are not packages, so module-scope imports of the receipt policy and allocator failed collection in CI. Register the real modules and give fake listen hosts refresh_for_conversation plus an empty speaker task set. Failure-Class: none Reason: test-harness isolation only; production import graph unchanged. Co-authored-by: Cursor <[email protected]>
Decoding a missing receipt as {} and writing it back made unlabeled
recordings look labeled, so later connected chunks merged into the
first survivor instead of the earliest timeline.
Failure-Class: FC-split-mutation-authority
Co-authored-by: Cursor <[email protected]>
Empty-profile sessions must keep consuming the queue after a later refresh, absorbed ids must travel as a named map, and flush backoff must use the fields __init__ already sets. Failure-Class: FC-split-mutation-authority Co-authored-by: Cursor <[email protected]>
The tuple-unpacking __iter__ on CombineSegmentsResult types as a union, so pyright rejected the three production unpack sites (13 errors) and the pre-push typecheck refused the branch. Production callers now read the named fields; the listen-runtime fake returns the real result type instead of a bare tuple. Verified: scripts/typecheck.sh 0 errors; 189 tests passed across the five affected files via backend/test.sh. Failure-Class: none Reason: type-level call-site repair for a result type introduced in this PR; no runtime behavior change. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Git-on-my-level
marked this pull request as ready for review
September 21, 2026 02:24
Git-on-my-level
added a commit
that referenced
this pull request
Sep 21, 2026
…nting an empty stub (#15330) * fix(backend): preserve protected rows during empty recording cleanup Keep locks, deletion tombstones and sync revision ownership ahead of empty-live-row cleanup. Content continues to use the existing codec-aware transactional fence. Validation: BACKEND_UNIT_TEST_FILE_LIST=/tmp/omi-stt-selected-tests.txt bash backend/test.sh — 340 passed, including 33 recording-session cases. Existing resume assertions stay unchanged; fixtures now include their real source/device/finished-at metadata. Failure-Class: FC-split-mutation-authority * fix(backend): reuse durable live continuations across reconnects Keep an immutable original recording binding and transactionally adopt its compatible active continuation. Reconnects inside the shared silence boundary reuse the continuation; expired empty and unexposed losing generations use lifecycle-owned fenced cleanup before STT admission. Reject deleted, discarded, locked and other-device rows. Keep existing explicit WAL targets authoritative. Tests reproduce newest-first/interleaved legacy hints, the remaining partial-flap limit, same-origin 35-second reconnects, exact 120-second rollover, protected content and legacy principals. Validation: BACKEND_UNIT_TEST_FILE_LIST=/tmp/omi-stt-selected-tests.txt bash backend/test.sh — 340 passed. Hermetic E2E: 120 passed, 3 skipped, 2 xfailed. Sync Cloud Tasks emulator gauntlet passed. Live provider/client acceptance was not run; only hermetic service seams are authorized. Failure-Class: FC-split-mutation-authority * refactor(backend): keep reconnect eligibility in the pure continuity policy Move the unchanged resumable-continuation predicate out of database storage and into the shared continuity module. Async callers now depend on the pure rule; transactional metadata access stays on the persistence executor. This addresses the installed pre-push async-boundary guard without an exemption. Validation: BACKEND_UNIT_TEST_FILE_LIST=/tmp/omi-stt-selected-tests.txt bash backend/test.sh — 340 passed after the move. * test(backend): keep listen resume coverage on the continuity-eligible path The reconnect-continuity change now requires source/device/timeout on resume and resolves a durable continuation before a rollover mint. The four skipped tests still protect marker persistence, client-id reads, and the existence-read skip; their hosts and fixtures needed those fields to reach that path. Co-authored-by: Cursor <[email protected]> * fix(backend): load speaker profiles when a listen reconnect resumes #15247 refreshes conversation-scoped speaker profiles on mint. Continuity makes resume the common reconnect path, so that load must happen there too or a reused conversation would start a new socket with empty profiles. Co-authored-by: Cursor <[email protected]> --------- Co-authored-by: Cursor <[email protected]>
Git-on-my-level
added a commit
that referenced
this pull request
Sep 21, 2026
…t boundary (#15345) * Protect labeled sync conversations during assignment Exclude labeled donors before widening the interval; preserve an existing labeled anchor and treat explicit retargeting as terminal supersession. Validation: BACKEND_UNIT_TEST_FILE_LIST=../.local/final-files.txt bash test.sh; test_sync_cross_job_assignment.py: 29 passed (full selected suite recorded in .local/REPORT.md). Co-Authored-By: Claude Opus 5 <[email protected]> * Plan live transcript merges against the committing manual receipt Keep fresh STT input unmerged until the transaction reads current speech and receipt coverage. Protect selected IDs, speaker defaults, clears and opt-outs across every text-transfer branch. Return accepted client IDs and removals from the same attempt. Fix forward absorption and transitive remapping together with that protection. Validation: BACKEND_UNIT_TEST_FILE_LIST=../.local/merge-files.txt bash test.sh passed, including all five required import-isolation suites. Native tests cover stale input, attempt replay, partial transfers and client/storage ID agreement. Existing remap tests that expected expanding a manual label were replaced by these production-boundary regressions, based on reproduced R3/R5(a) in merged PR #15247. Latency: .local/benchmark_live_merge.py measured planner p95 0.091 ms at 1000 stored + 8 fresh segments; 12.245 ms at 10000 + the 1000-segment runtime buffer cap. SDK contention multiplies computation up to 5x; expiry restarts can combine to 15x. These are CPU/local wall measurements, not Firestore latency. Co-Authored-By: Claude Opus 5 <[email protected]> * Preserve current manual speaker decisions in lifecycle commits Both processing writers decode the committing receipt, overlay it on their encoded snapshot, and encode at the current stored protection level. Extend the existing lifecycle static tripwire to inventory transcript owners and reject an unguarded new snapshot writer. Validation: BACKEND_UNIT_TEST_FILE_LIST=../.local/final-files.txt bash test.sh: 648 passed across 19 selected files, including 16 new lifecycle receipt cases and existing lifecycle/processing contracts. backend/scripts/check_conversation_lifecycle_writes.py passed. Summaries still require explicit refresh; stale non-sync processor content remains out of scope. Co-Authored-By: Claude Opus 5 <[email protected]> * Migrate speaker receipts atomically with transcript protection Read the current document in each migration transaction and re-encode its transcript and receipt together. Stored protection metadata outranks live caller hints. Reject non-object receipts at the write boundary while retaining tolerant reads for existing malformed shapes. Validation: BACKEND_UNIT_TEST_FILE_LIST=../.local/final-files.txt bash test.sh passed; 11 storage regressions use real standard/enhanced codecs, both migration directions, legacy absence, an edit after the initial scan, repeat migration and malformed write inputs. No cloud migration was run; e2ee codec handling remains outside scope. Co-Authored-By: Claude Opus 5 <[email protected]> * Handle speaker assignment transport failures through acknowledgement Return false on assignment transport exceptions without painting optimistic identity or offering summary refresh. Remove the unused unassignConversationTranscriptSegment method instead of maintaining a second mutation path. Validation: cd app && flutter test --no-pub test/providers/speaker_summary_refresh_test.dart: 4 passed. Transport failure leaves identity unchanged and an acknowledged retry succeeds. No strings or wire schema changed; device UI was not exercised. Co-Authored-By: Claude Opus 5 <[email protected]> * Keep translation and inference patches from restoring retired segments Field-only writers intersect their updates with current persisted IDs and preserve current speech text, spans and ordering. Translation publishes accepted results rather than the stale input. Remove the unused sync import and document the complete writer contract and deferred cache wake. Validation: BACKEND_UNIT_TEST_FILE_LIST=../.local/resurrection-files.txt bash test.sh: 48 passed across nonowning writer, manual assignment and listen runtime suites. Full selected run: 648 passed. Lifecycle checker and async blocking scanner passed; no live service or customer data was used. Co-Authored-By: Claude Opus 5 <[email protected]> * fix(tests): drop patches of the sync writer import this PR removed Removing the dead `update_conversation_segments` import from utils/sync/pipeline.py made three dedup tests fail at `mock.patch` setup: they patched it by that name and asserted it was never called. The import was already dead at the merge base — imported, never invoked — so the assertion could not have failed for a behavioural reason. Replace it with a structural guard so the invariant those patches encoded survives: sync intake must not acquire a second transcript writer that bypasses the manual-assignment receipt. The guard reads the source instead of importing the module; importing the real module inside the call phase cost 1.56s against the runner's 0.30s CPU budget, and a text check also catches a reintroduced import that was never loaded. Validation: the file passes via test.sh (46 passed, exit 0, no duration-guard failure), and a sweep of all 37 test files that patch names on the modules this PR changes passes 1152 tests. Failure-Class: FC-fixture-mock-signature-drift Co-Authored-By: Claude Opus 5 <[email protected]> --------- Co-authored-by: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Goal: label a speaker once — in a conversation or across conversations — and have the name show up in live transcription and in summaries, on mobile. An audit of the mobile app and the backend speaker pipeline (independently verified by a second model, which also refuted one of the audit's claims) found that the matching policy from #12935 and the profile transaction from #14842 are sound, but the identity and mutation boundaries around them are not:
speakerIdby parsing the provider label and drops the wirespeaker_id. Since #12097 the backend allocates conversation-local ids while the label restarts atSPEAKER_00after any reconnect/STT failover. Repro: expected id 2, got 0.[0, 0].Problem and change
Mobile decoded provider labels instead of canonical speaker IDs, offline chunks reused independent IDs, and competing REST/live/socket mutations could lose manual corrections. Failed mobile saves could still look successful. This change preserves canonical mobile identity without rewriting provider labels, allocates scoped WAL identities, and routes all three assignment APIs through one transactional owner. The owner persists explicit MANUAL segment overrides and speaker defaults with segment IDs and a generation, invalidates affected profiles and client projections, and protects saved decisions from stale live/sync snapshots. Mobile paints and notifies only after acknowledgment, honors selected versus whole-speaker scope, and keeps failed saves open.
Transcript and photo timeline names follow PeopleProvider. Rename preserves voice metadata. People exposes evidence-derived ready / saved_sample_awaiting_embedding / not_learned / unknown states. Verified audio alone does not imply usable recognition or a running job. Profiles refresh at the next conversation boundary. Saved changed attribution offers an explicit summary reprocess action; failure retains the label and retry. Name-only suggestions use the existing sheet, malformed events are ignored, and detection receives the actual language.
Live enrollment remains best-effort. REST extraction and the acknowledged delayed Pusher request remain working. Pusher publishes audio manifests during capture, but a crash between assignment and dispatch, an attempt before manifest/tail availability, or extraction/provider failure can still lose teaching. No enrollment job, outbox, lease, retry worker, or reconciliation guarantee is added. Persisted MANUAL provenance is the receipt for the separately stacked durability follow-up.
Verification
Product verification uses local synthetic tests. Focused pre-commit results: canonical decode/local store 9 Flutter tests; sync identity/teaching 45 backend tests; manual owner/routes/listen/sync 83 backend tests plus 41 trust-boundary and 4 projection tests; capture/composition 102 Flutter tests; metadata 3 Flutter tests; readiness/teaching/runtime 51 backend tests plus 46 lifecycle tests; mounted transcript/people 23 Flutter tests; summary action/provider 16 Flutter tests plus 1 production formatter-to-stub-LLM test; language/teaching/runtime 45 backend tests. Final validation is listed below.
Final commands:
BACKEND_UNIT_TEST_FILE_LIST=<the five previously CI-red files> bash backend/test.sh— 350 passed across the five previously CI-red files (test_sync_v2.py176,test_sync_cloud_tasks.py91,test_sync_transcription_prefs.py66,test_listen_process_pending_shutdown.py13,test_conversation_archive_filter_contract.py4), exit 0 (review round 2).python3 backend/scripts/check_unit_test_discovery.py— 1195 selected, 0 orphans, exit 0 (review round 2).bash backend/test.sh(no file list) is not re-run this round:test_mentor_notifications.pyreaches live Google HTTPS through this Mac's ADC and hangs. Review round 3 used file lists only.test_transcript_segment.py,test_speaker_match.py,test_transcribe_decisions.py) — 569 passed, exit 0.bash app/test.sh— hermetic app suite 2488 passed, 5 skipped, exit 0 (review round 2). No Flutter test files were touched this round.bash app/scripts/analyze_ratchet.sh— passed, exit 0 (several lint codes under baseline; no baseline raise).OMI_PR_BODY_FILE=<this body> make preflight— 42 checks passed, exit 0 in 140.35s.scripts/failure-class validate --pr-body-file <this body>— ok, exit 0 after7e4513376e(declarationFC-split-mutation-authority).scripts/pr-preflight --suggestis covered by the preflight product-invariants check; no path-matched locked invariant besides the voluntary INV-UI-1 citation. INV-MEM-4/INV-TASK-2 authority remains unchanged.Tests execute production wrappers, providers/widgets, HTTP handlers, formatter and strict transaction seams. Audio/storage/STT/embedding/LLM boundaries use synthetic fakes. The strict Firestore fixture proves ordering and write policy, not real distributed contention.
The name-only expectation replaces the previous ignore behavior according to the existing
person_id_for_clientwire contract (backend/utils/transcribe_decisions.py) and the accepted F9 scope: an empty person ID with a name is a suggestion, never an automatic assignment. Existing static serialization inventories only remove the retired whole-array dumps; they are not claimed as behavioral coverage.Schema/clients regenerated with
backend/scripts/export_openapi.py --app-client --write, public/integration export,generate_dart_models.py --all,generate_swift_openapi_types.py, andgenerate_ts_openapi_types.py. Cached fake Firestore/Redis dependencies were used locally. One select localization key added usingapp/scripts/l10n.py addwith real translations for all 49 locales. Diff accounting against localorigin/mainbb6bde8: handwritten production 787 additions / 558 deletions across 31 files; tests 895 / 34 across 16 files; localization 797 / 48 across 99 ARB/generated Dart files; other generated schema/clients 35 / 3 across 6 files; docs/guard metadata 74 / 12 across 5 files. Rebased locally over the connected-component sync update and added bridge/retry/manual-curation regressions. Dart formatted at line length 120; Python viascripts/backend-python-format --write.Commit consolidation preserved the exact validated tree (
8ace33da42b4194ddecde7cbea85cca66d52d51f). Review-round-1 fixes added eleven local commits on this branch. No product-tree repro copies or unstaged changes. No skip hatch or ratchet-baseline increase was used. Four exact file-size exceptions below are required by the real diff.Invariants and failure class
INV-UI-1: no new purple; edited timeline uses neutral colors. INV-MEM-4 and INV-TASK-2: no new memory/task write authority; manual teaching does not create memories or tasks, and opt-in reprocessing retains existing routes and policies.
Failure-Class: FC-split-mutation-authority
Reusable behavioral guard:
backend/tests/unit/test_manual_speaker_assignments.py, together with canonical mobile decode, WAL identity, mounted people-refresh, readiness and summary-action tests. Repairs the same competing identity/profile authorities as prior-art #14842. No ratchet baseline is raised.Follow-ups and limits
speaker_idadaptation: installed old mobile builds remain affected until updated; macOS/Windows/web domain adaptation is not completed by regenerated wire clients. Allocator/egress label rewriting needs its own cross-client/hash migration.Not run: physical acoustic acceptance, real voice/provider/LLM accuracy, device installation, production/dev backend, remote account/storage operations, or distributed Firestore contention.
Line-Count-Exception: backend/database/conversations.py | 2526 -> 2676 | Keep the transactional speaker command at the existing conversation codec and projection boundary; pure manual policy is extracted to utils/manual_speaker_assignments.py.
Line-Count-Exception: backend/utils/sync/pipeline.py | 2498 -> 2506 | Pass retry-stable speaker scope and detected language through the existing STT intake coordinator.
Line-Count-Exception: backend/routers/users.py | 2435 -> 2436 | Derive stored voice readiness before replacing sample paths with playback URLs, so URL availability cannot misreport learning state.
Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 2889 -> 2900 | Live labeling writes a speaker-wide default through the existing capture assign owner so later bubbles of the same speaker_id are named.
Review round 1
Adversarial review requested changes on live labeling scope, receipt size/protection, locked/unresolved wire details, merge-vs-receipt, labeled sync rows, matcher rollover, silence-flush payload, teaching candidate choice, people list/readiness, and app polish. Each finding maps to a local fix commit:
efc1d85f93make live labeling speaker-wide including later speech15e77e4194store sparse protected speaker receipts467d95fd64restore locked 402 and unresolved 409 detailsbe4d0ffc85move receipts off absorbed merge identities0bebd03d75append later chunks into labeled recordings8c75f57fc3drop matcher writes after conversation rolloverbc6254a16edeliver only identity-changed silence-flush segmentscba75e10b9teach from the longest bounded clips;8abc0744e3rank those clips from stored segments without dumping Conversationc3486308c1trust list deserialization and sample-delete readinessf8a4925823restore tagging analytics and resolve people onceLive enrollment remains best-effort as originally declared. No skip hatch or ratchet-baseline increase was used.
Review round 3
Coordinator review of fix round 1 required three production repairs. Local commit
7e4513376e:load_and_runexited the matcher loop for the whole socket session, so a first-use label plus laterrefresh_for_conversationnever consumed the queueshould_queue_speaker_embedding'shas_person_embeddingsis read live fromspeaker.person_embeddings; teardown with zero tasks still skipsspeaker_id_done.intoon a list subclass, solist(...)/ copies silently dropped the remapCombineSegmentsResultunpacks as the existing 3-tuple and carriesabsorbed_intoas a named field;update_conversation_segments(..., absorbed_into=)is the explicit keywordgetattrfor fields already set in__init__TranscriptProcessorthrough__init__Review round 4 (coordinator)
The pre-push typecheck rejected round 3:
CombineSegmentsResult.__iter__types as a union, so the three production unpack sites produced 13 pyright errors.e8ffb991ffreads the named fields at those call sites and makes the listen-runtime fake return the real result type.scripts/typecheck.sh— 0 errors; five affected backend files — 189 passed.Independent coordinator verification of the final tree (not the delegates' reports): 19 backend files through
backend/test.sh— 658 passed, 0 failed, including all five files that were red on the first CI run; seven touched Flutter test files — 127 passed.