Repository navigation
fix(people): naming or correcting a person in your own transcript is free again - #20252
Merged
Merged
Conversation
…free again #20190 applied the named speaker-ID entitlement to the manual transcript routes. Free-plan users naming another person got a 403 ('Naming other people needs a paid plan') from assign-speaker and the segment assign routes, which had always been free; the new 'not this person' rejection was gated the same way. In production after the deploy, 9 of 18 assign-speaker requests were refused; none were before. The entitlement stays where it was ruled: automatic naming (tag prompts and earlier voice matches). Labeling and correcting your own transcript never consults it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Oct 2, 2026
MCP: let assistants label transcript speakers (assign_speaker) and add people (create_person)
#20257
Open
Git-on-my-level
added a commit
that referenced
this pull request
Oct 2, 2026
…dence follows its label (#20320) ## Summary Follow-up to #20190 and #20252. A review of the speaker-label work found that learned voice evidence could outlive the decision that authorised it, and that automatic naming of other people was plan-gated on some surfaces and not others. This PR closes those gaps and makes "earlier matches" compete against every known voice. It changes no routes, wire models, thresholds, flags or stored-data format requiring migration. Product ruling applied (David, 2026-10-02): automatically naming other people is a paid feature on every surface; free plans get automatic identification of the account owner only. Naming, correcting and rejecting labels by hand stays free, and a free manual tag may still teach a voiceprint. ## Change - **Entitlement at candidate selection.** Live matching, sync speaker identification, conversation-wide resolution, the transcription shadow, spoken-introduction detection and earlier matches no longer load or score non-owner voiceprints for a free plan. Owner recognition, manual edits, same-stream carry of a manual label and every answer to an already-served card, including one that names a person, are unaffected. The plan is read once per live conversation or sync batch; a plan change is observed at the next conversation or batch. A failed read stays closed for that call and is retried. - **A wrong "this is me" can be undone.** Owner confirmations now record their source segments and decision generation. Correcting or rejecting those segments removes the contribution and rebuilds the owner voiceprint in the same transaction. Older confirmations, which only record their conversation, are removed for that conversation on correction. One conversation holds at most one of the five slots. - **Delayed teaching honours the current decision.** An owner-teaching task that runs after the user re-tagged the same segments with training turned off no longer publishes. - **Person samples are fenced to their source.** Publication rereads the conversation inside the transaction and refuses if it was deleted, the label changed, or training consent was withdrawn. An unrelated edit elsewhere in the conversation (tagging a second speaker) does not void the attempt. - **Earlier matches compete.** A cached voice is offered for a person only when that person beats the owner and every other usable voiceprint under the existing threshold and margin; near-ties abstain. - Owner clip download moved off the storage pool its own child downloads use. - **Audit follow-ups (2026-10-03).** Naming a person on a served card is free: the answer route no longer refuses a free plan (ruled by David; automatic suggestions stay paid). A speaker-level receipt entry stamped with a capture scope governs teaching only inside that scope, for people and for the owner, so a label carried in one scope cannot authorize another scope's audio in a merged conversation. Owner publication rechecks its own contributing segments in the transaction instead of requiring an unchanged receipt generation, so tagging another voice no longer discards valid owner teaching. A plan change taking effect at the next conversation is the ruled behaviour, not a gap. ## Evidence Offline replay on one hand-labeled account (aggregates only; the production embedding model's stored vectors; real backend policy functions). It is one account with few repeat people, so none of this is a population false-accept rate. | Measured | Baseline | Candidate | | --- | --- | --- | | Earlier-match offers, 26,243 candidate/query pairs | 584 offered, 453 wrong | 136 offered, 41 wrong (36 correct offers lost) | Measured and deliberately **not** shipped: - Pooling separated owner turns: 56 of 61 selections usable against 52 of 61; too small a gain to change the rule without acoustic validation of the four new clips. - A voiced-speech floor: 58 of 62 ten-second plans hold under ten seconds of voiced audio, so adding the floor alone would reject nearly everything. - Several exemplars from different conversations: owner recall 85.3% against 73.5% at the current threshold with equal retained audio, but impostor accepts rise from 8.8% to 11.5%; needs calibration on more than one account. - Replacing the transcript check with acoustic consistency: 12 of 54 uniformly wrong-voice pairs pass, so it cannot stand in for placement. - Corrected audio placement: transcript-check passes rise from 134 to 251 of 882 windows; still too low to ship a recovery rule. - Pooling short live fragments: 719 against 694 of 1,426 speaker groups reach five seconds, on a stored-segment proxy without real event timing. ## Tests - New `backend/tests/unit/test_voiceprint_authority.py`: free/paid/downgrade matrix across live, sync and resolution; delayed opt-out; correction and rejection retracting owner evidence; duplicate delivery; publication after delete, tombstone, label change and consent change; publication surviving an unrelated edit; entitlement read failure; carried-label teaching inside and outside its capture scope; owner publication surviving a tag on another voice and denied on revocation, opt-out and rejection. `test_speaker_tag_prompts_service.py` now asserts a free plan can name a person on a served card. - `test_speaker_voice_matches.py`: owner and duplicate-person competition. - 27 affected unit files pass through `backend/test.sh`; all four unit shards passed locally through `backend/scripts/run-unit-ci.sh --all` before the final review commit; backend typecheck reports 0 errors; the pusher import graph gains no torch or onnxruntime dependency. - Not run: anything against a live backend or device, Firestore contention, or a Docker image build. ## Rollout notes - Behaviour change for free plans: other people stop being named automatically in live, sync and reprocessed conversations. Existing labels are not removed, and manual tags keep working. - Backend only; deploy Cloud Run, listen and pusher together so all three apply the same rule. ## Product invariants affected none ## Failure class Failure-Class: FC-stale-selection-used-as-write-authority Teaching read a label, did slow audio work, then wrote a voiceprint without re-reading the label's authority. The publication and correction transactions now reread the source and write only for still-authorised segments. Guard: `backend/tests/unit/test_voiceprint_authority.py`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/20320?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
Git-on-my-level
added a commit
that referenced
this pull request
Oct 2, 2026
…ips there (#20390) ## Summary Labeling a speaker teaches a voiceprint only when the clip cut for that label is the audio that was actually spoken. On live conversations it usually is not: text is timed from the provider stream, stored audio from chunk arrival, and reconnects or provider failover pull the two clocks apart. On one hand-labeled account, `started_at + segment.start` lands within 1 s of the speech for 20% of 1,416 labeled runs and more than 10 s away for 68%. In production the first 13 hours after #20190/#20252 stored 11 of 105 person teaching attempts (text_mismatch 38, insufficient_speech 29). This PR makes new live conversations carry where each segment's audio was captured, and makes every teaching reader use it. ## Change - **Persist the receiver's capture window on live segments.** The receiver already computes a capture-clock window per segment for transient speaker identification and then drops it. Legacy (v2-off) persistence now stores it in two private fields, `audio_capture_start` / `audio_capture_end` (absolute Unix seconds). Text, speaker, `start`/`end` and ordering are unchanged; the fields are absent when unknown, cleared when a text merge spans a capture gap, kept out of the client schema and stripped from every client frame. `AUDIO_TIMELINE_V2` is untouched. New counter `omi_live_audio_capture_windows_total{outcome,reason}` shows what share of new segments are placeable. - **One placement module** (`utils/conversations/audio_placement.py`). `locate()` returns a trusted window only for audio-timeline v2 manifests and `sync:`-timed segments and refuses otherwise. `candidate_window()` gives verified readers the capture-clock position when every contributor recorded one with a consistent offset, else the legacy origin. Person teaching, the owner clip, tag-prompt clips and the text search all go through it. A capture window is a better candidate, not proof: every teaching path still runs the 0.9 transcript containment check before publishing. - **Bounded text-anchored recovery for teaching**, default off (`SPEAKER_TEACHING_TEXT_PLACEMENT`): after a text mismatch, search at most 32 s around the candidate using the verification transcript's word times, re-verify at most 12 s. Containment gate unchanged. - **Manual merge keeps source clocks.** The manual merge writer offset each donor by the prior transcript end plus a wall gap while copying audio at unchanged absolute timestamps, shifting later donors' text early. It now rebases from source wall-clock origins. - **Conversation-wide resolution never names from unplaced text.** Unplaced or abstained segments no longer inherit a cluster's name through a shared old speaker id. ## Evidence Offline replay on one hand-labeled account (aggregates only; one account, so no population claim): - Stored live conversations cannot be re-placed from metadata: strict `locate()` returns 0 of 1,416 runs (it refuses rather than guesses), and bounded text search recovers 13 of 748 mismatched windows, all 13 within 1 s. Old conversations stay as they are; this PR fixes forward. - Synthetic replay through the real receiver and persistence: capture windows stored for 0 of 18 segments before, 11 of 18 after (receiver had a window for 14 of 20 inputs; gaps and partial sentence repair clear it by design). All 18 stored payloads are byte-identical to before once the two new fields are removed. - A burst/clock-jump fixture shows the capture clock and the stored-chunk clock can still disagree (known metadata 2 of 2, exact stored-audio matches 0 of 2). That is why the capture window is used only behind transcript verification and `locate()` does not trust it. Not measured: production availability of capture windows (the new counter will show it) and the change in production store rates. ## Tests - New: `test_live_capture_windows.py`, `test_live_capture_persistence.py`, `test_live_capture_lifecycle.py`, `test_audio_placement.py`, `test_audio_placement_merge.py`, `test_teaching_placement.py`, `test_audio_capture_candidate.py`; additions to `test_conversation_speakers.py` and `test_merge_validation.py`. - `BACKEND_UNIT_TEST_FILE_LIST` over 19 related files via `backend/test.sh`: all pass. `scripts/typecheck.sh`: 0 errors. - TranscriptSegment and Conversation JSON schemas compared equal to pre-change snapshots; no generated client changed. - Not run: anything against a live backend or device, Docker image build. ## Rollout notes - Backend, listen and pusher should deploy together: the fields are written on the live path and read by teaching in the backend. - No migration or backfill. Existing conversations behave as before (legacy origin candidate). - Turn off: `LIVE_SPEAKER_CAPTURE_CLOCK=false` stops new windows being attached (it also changes the existing live matching path; use its established procedure). The text search is off unless `SPEAKER_TEACHING_TEXT_PLACEMENT` is set. - Watch: `omi_live_audio_capture_windows_total` persisted share; `omi_person_voice_learning_total` and the owner sample outcomes for text_mismatch falling on new conversations. ## Product invariants affected none ## Failure class Failure-Class: FC-transcript-and-audio-on-independent-clocks Teaching read transcript coordinates as if they addressed stored audio. This records the capture position at write time, routes every teaching reader through one placement gate that refuses unknown clocks for trusted use, and keeps transcript verification in front of every publication. Guards: `test_live_capture_persistence.py`, `test_audio_placement.py`, `test_audio_capture_candidate.py`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/20390?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
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.
Summary
#20190 put the named speaker-ID entitlement on the manual transcript routes. A free-plan user who named another person in their own transcript got
403 Naming other people needs a paid planfromPATCH /v1/conversations/{id}/assign-speaker/{n}and the segment assign routes. Those routes had always been free. The new "not this person" rejection was gated the same way.Measured in production after #20190 deployed (about five hours, all users, counts only): 9 of 18
assign-speakerrequests returned 403. In the five hours before, 49 succeeded and none returned 403.Change
_assign_manual_speakerand fromPOST .../speakers/{speaker_id}/reject.Tests
Route tests now run on a free plan (the subscription lookup returns none) so a gate that comes back on these routes fails them:
test_transcript_owner_teaching.py,test_taught_speaker_persistence.py, andtest_speaker_rejections.py::test_not_person_is_free_on_every_plan. Run throughbackend/test.shwith a file list: six files, all passing.Product invariants affected
none
Failure class
Failure-Class: none
A plan gate ruled for automatic naming was copied onto a manual route. No existing class describes it and it does not warrant a new one; the guard is the free-plan route tests above.
🤖 Generated with Claude Code