Repository navigation
Conversation
extract_speaker_samples stores a person's speech sample, then extracts the speaker embedding inside a try/except that only logs. When that extraction fails, the person keeps quality-verified samples with no embedding and nothing ever recomputes it: the listen session's loader requires a stored embedding, so it skips that person on every later session and they can never be matched, however many times the user teaches them. The user's own profile already self-heals from exactly this state — if its stored embedding is missing it re-extracts from the profile audio and writes it back. People had no equivalent, which is why a user sees their own voice recognised and no one else's (BasedHardware#10434). Give people the same fallback: when a person has samples but no stored embedding, rebuild it from their first stored sample and persist it. Scoped to speech_samples_version >= 3, whose samples already passed verify_and_transcribe_sample when stored, so this restores a lost embedding without reopening the quality gate that deliberately drops bad samples. Failures stay contained so one unreadable sample cannot break loading the other speakers. Refs BasedHardware#10434. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Thanks for this — clean fix and a great root-cause writeup. The asymmetry between the user-profile self-heal path and the person path is exactly the kind of latent bug that's easy to miss, and your A few observations from review:
This touches user-data persistence (speaker embeddings for taught people), so I'm flagging it for human maintainer sign-off before merge rather than approving directly. The implementation looks sound to me. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
This PR tagged the *embedding* llm_inferred and claimed that made an inferred enrolment undoable. It did not. extract_speaker_samples stores the speech sample first, at speech_samples_version 3, and SpeakerMatcher._recover_person_embedding exists to rebuild a missing embedding from samples[0] whenever a person has v3 samples and none stored -- that is the BasedHardware#10453 self-heal. So clearing an inferred embedding meant the next listen session rebuilt it from the same unvetted sample. The mistake resurrected itself, silently. Attribution now travels with the sample as well, as a path-keyed set on the person document rather than a third array parallel to speech_samples and speech_sample_transcripts: those two already have to be padded and popped in lockstep, and another index-alignment invariant is another way for them to drift the way BasedHardware#10453 did. Recovery refuses to rebuild from an inferred sample. Passing verify_and_transcribe_sample proves the audio is clean, not that it belongs to the person a model named. The user-taught path is untouched and its existing test still passes unmodified. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
What
A taught person can become permanently unmatchable, so the user sees only their own voice recognised — no matter how many times they teach anyone else.
Refs #10434.
Root cause
extract_speaker_samplesstores the sample, then extracts the speaker embedding inside atry/exceptthat only logs:When that fails, the person keeps their (quality-verified) samples with no embedding, and nothing ever recomputes it. The listen loader requires a stored embedding, so it skips that person on every later session — and
maybe_migrate_person_samplesreturns early for anyone already at v3, so re-teaching doesn't rescue them either.The asymmetry that makes the symptom so lopsided: the user's own profile already self-heals from exactly this state — if its stored embedding is missing it re-extracts from the profile audio and writes it back (
speakers.py, thehas_speech_profilebranch). People had no equivalent. Hence: own voice always recognised, everyone else never.Fix
Give people the same fallback. When a person has samples but no stored embedding, rebuild it from their first stored sample and persist it.
Deliberately scoped so it does not reopen the quality gate. Recovery only runs for
speech_samples_version >= 3. Those samples already passedverify_and_transcribe_samplewhen stored (the transcript that gates v3 is produced by that verification), so this restores a lost embedding rather than resurrecting a rejected one. The migrations intentionally drop embeddings for samples that fail quality, and that behaviour is untouched — which matters, because the failure mode of getting this wrong is misidentification, worse than non-identification.Failures stay contained: one unreadable sample returns
Noneand the remaining speakers still load.Tests
backend/tests/unit/test_speaker_person_embedding_recovery.py:compare_embeddings(matches underSPEAKER_MATCH_THRESHOLD), not merely non-NoneSuites:
test_speaker_id_pipeline.py+ the new file → 112 passed.Scope, honestly
This closes one deterministic path to the reported symptom — the one I could establish from the code. I can't see the reporter's account state, so I can't confirm it's the only contributor. A person can also stay unmatchable if migration fails repeatedly (
maybe_migrate_person_samplesreturns the person unchanged on failure), which is a separate question about whether quality-rejected samples should ever be retried — a product call I've deliberately not made here.Product invariants affected
none (verified with
scripts/pr-preflight --suggest)Failure-Class: none
No registered class covers "a derived artifact is lost by a swallowed exception and never rebuilt"; the durable guard is the recovery path plus its tests.