Skip to content

fix(speakers): keep calibrated live owner near misses pending - #21052

Merged
Git-on-my-level merged 1 commit into
mainfrom
lane/owner-recog-nearmiss
Oct 9, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
lane/owner-recog-nearmiss

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Live owner rejections already retry on fresh audio. This PR distinguishes a calibrated near miss from a completed no-match: a rejected nearest owner in [0.65, 0.70) with runner-up gap >=0.10 is unknown / pending. It assigns no identity, retains the existing three-clip evidence window and model budgets, and withdraws stale automatic labels during revalidation. Manual, carried and channel labels remain authoritative.

No safe acceptance lift was found. Acceptance stays strictly <0.65 (the current code rejects equality), margin >=0.10, finished-conversation threshold 0.50. The example distance 0.737 remains outside the calibrated band. Owner recognition remains free on every plan; automatic non-owner naming remains paid.

Local measurement

Only the supplied private local files were read; no cloud credentials, production API, audio inference or upload. No private data, transcript text, identifiers or embeddings are committed. Counts below are aggregates.

Production decision distribution

Before/after files contain 37,339 / 33,719 decision log rows; 0 malformed rows. Histograms count nearest-owner decisions, including abstentions, rather than ground-truth owner speech. Bins are half-open.

Slice <.50 .50–.65 .65–.70 .70–.75 .75–.80 .80–.90 >=.90
Before, all owner-best (31,928) 3,673 1,978 933 1,424 2,064 7,656 14,200
After, all owner-best (29,218) 3,409 2,714 1,249 1,630 2,191 6,759 11,266
After, evidence 5–<8 s 2,450 1,960 804 1,000 1,326 3,899 6,801
After, 8–<12 s 661 522 289 402 526 1,720 2,600
After, 12–<20 s 255 204 123 192 280 940 1,535
After, 20–30 s 43 28 33 36 59 200 330
After, 1 clip 513 158 58 45 82 260 408
After, 2 clips 1,370 729 209 215 293 803 1,230
After, 3 clips 1,526 1,827 982 1,370 1,816 5,696 9,628

There are 0 owner-best decision rows below 5 s. Before/after owner-best accepts: 3,804 / 4,110. Among (session, conversation, speaker) groups with repeated owner-best observations: 2,716 / 4,086 groups; 862 / 821 flip accepted/rejected; 809 / 779 contain reject→accept. No logged provider scope is available, so these are observational identity proxies. Rounded log replay classifies 856 / 1,170 rejected rows into the new pending band; exact runtime distances can differ at boundaries. Local log windows differ from the supplied 11.9-hour metric window and do not reproduce its totals. These logs have no truth labels.

Frozen labeled protocol

765 precleaned production-model vectors: 349 owner, 416 non-owner, 62 conversations. Seeds 1101–1105; original stratified two-fold split with swapped calibration/test. Calibration-only galleries; exclude query and all held-out conversations from enrollment. Owner gallery: longest eligible >=8 s clip per earliest up to 5 calibration conversations; non-owner: 1. Fixed unsupervised AHC .70, absorption .60; time-sort each inferred voice and score the normalized equal mean of its latest <=3 clips, with >=5 s evidence. Label each snapshot by its newest query clip, never pool by truth.

This is a rolling-centroid decision proxy, not replay of the live diarizer or sticky-accept scheduling: offline AHC sees the entire conversation, and snapshots continue after accepts. Per repetition 339 owner / 369 non-owner snapshots meet the evidence floor; 55/708 windows contain mixed identities. Global production-embedding curation, one account, proxy enrollment and correlated repeated folds limit generalization. Wrong-owner means a non-owner query accepted as user, not all wrong-person naming.

Seed Incumbent owner accepts /339 Incumbent wrong-owner /369 Implemented deferral: delta accepts / wrong-owner
1101 276 20 0 / 0
1102 282 26 0 / 0
1103 278 17 0 / 0
1104 272 32 0 / 0
1105 279 21 0 / 0

Mean incumbent and implemented rates: 81.8% owner acceptance / 6.3% wrong-owner with enrolled gallery; 85.0% / 8.3% with owner-only gallery. Deferral cannot promote an identity by construction, including on each held-out fold.

Diagnostic pooled distance/margin sweep, before cross-voice arbitration (mean counts per repetition; denominators 339/369; these fixed-grid diagnostics do not select deployment thresholds):

Distance / margin Owner accepts Wrong-owner
.50 / .10 262.0 17.0
.65 / .10 285.8 24.8
.70 / .10 286.8 27.4
.75 / .10 287.2 27.4
.65 / .20 264.2 18.4
.70 / .20 264.4 18.4
.75 / .20 264.4 18.4

At .65/.10, by pooled evidence seconds (same pre-arbitration diagnostic):

Seconds Owner accepts / owner snapshots Wrong-owner / non-owner snapshots
5–<8 15.8 /19 4.4 /22
8–<12 34.6 /42 5.2 /65
12–<20 82.4 /92 10.8 /161
20–30 153.0 /186 4.4 /121

Calibration searched owner-only extensions at distance {.65,.70,.75,.80}, evidence {5,8,10,12,15,20} s, margin {.10,.15,.20,.25,.30}, minimum clips {1,2,3}; require no more calibration wrong-owner than incumbent, maximize owner accepts, then fewer wrong-owner and stricter settings. Seven folds chose no extension; three chose .70 with (20 s,.10,3 clips), (12 s,.15,2), (20 s,.20,3). Held-out enrolled-gallery lift: 0 accepts / 0 wrong-owner in every fold. Owner-only gallery: +1 correct / +1 wrong-owner across the repeated diagnostics. Extension was rejected; test labels did not retune it.

Deferral was predeclared separately after that negative result. Calibration ceiling candidates {.70,.75,.80} maximize owner near-miss snapshots followed by an incumbent accept in the same inferred voice, then fewer pending non-owner snapshots, then smaller band. All ten calibration folds chose .70, including the designated first seed-1101 calibration fold. Held-out coverage: 6 owner pending snapshots, 3 later recoveries, 13 non-owner pending snapshots across correlated repeats. These recoveries already happen under current retries: zero incremental recall is claimed. The first designated held-out fold has 0 owner pending / 2 non-owner pending, so deployment-band evidence is weak.

Validation and review

  • BACKEND_UNIT_TEST_FILE_LIST=<focused list> bash backend/test.sh: 127 passed across speaker policy/live matching and owner telemetry. Tests execute the matcher, synthetic pending→accepted recovery, threshold/margin boundaries, outside-band rejection, optional score snapshots and withdrawal of automatic projections while preserving manual/carried/channel labels.
  • backend/scripts/run-unit-ci.sh --changed-files <list>: 304 selected test files passed; type checking reported 0 errors. make preflight: 31 checks passed; draft metadata preflight passed. The production pending predicate also reproduced all 3,540 held-out proxy decisions without promoting any identity.
  • No live serving endpoint was exercised; validation uses the actual hermetic matcher and transcript projection with mocked audio embeddings/storage, plus local cached-vector measurement.

Risk: this changes pending/rejected metric composition and internal evidence status, so compare accept counts and ground-truth review rather than treating fewer rejections as improved recognition. Budget exhaustion or missing finished audio can leave a voice unresolved. Revert this PR to restore the old evidence-state distinction; there are no enrollment writes, backfills, new flags, or budget changes. Review that the shared predicate supplies only evidence state, automatic retractions reach every segment, and the localized speakers.py hunks merge mechanically with the budget lane.

Why a shared primitive: owner_near_miss drives live status, counters, decision logs and score snapshots; no new static guard/check is added.

Failure-Class: none

This is calibrated evidence-state handling after a negative threshold experiment; it does not fix independent owner-voice acceptance or change attribution authority.

Product invariants affected

none

View guided diff Turn on auto-fix

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@Git-on-my-level
Git-on-my-level merged commit 5b42496 into main Oct 9, 2026
60 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/owner-recog-nearmiss branch October 9, 2026 11:19
Git-on-my-level added a commit that referenced this pull request Oct 9, 2026
…led PCM (#21047)

Follow-up to #20964 (merged a02bee4; deployed to production listen
2026-10-08 21:08Z). Long-lived pendant sockets exhaust the lifetime
embedding caps, and one unavailable pooled PCM interval aborts otherwise
usable speech.

Before measurements supplied with the incident (not independently
queried):

- `embedding_budget`: 106k exits in 11.9h (8.9k/h), over twice all live
decisions (~47k).
- 2026-10-09 06:00–08:00Z: 130 of 1,004 live sessions hit the budget;
budget exits were 25% of all speaker-ID log lines.
- `no_pcm`: 1.4/h → 1,280/h.
- Live owner pending decisions: 1,018/h → 1,199/h.

Replace lifetime socket exhaustion with a monotonic-wall-time token
bucket: initial/capacity 16, refill 240/3600 attempts per second (one
per 15 seconds). Attempts over t socket-hours are bounded by floor(16 +
240*t): ≤256 in the first hour and ≤240/hour asymptotically, at ≤10s
query PCM per attempt (≤2,560s first-hour and ≤2,400s/hour steady-state
query audio). An arbitrary one-hour window can use up to 256 including
saved burst credit. Idle credit caps at 16; failures spend tokens;
reservation precedes awaits. Conversation/profile churn and client audio
timestamps cannot mint tokens. Reconnection still creates a new socket
budget, as before; this is not an account-wide cap.

Keep 12 attempts per voice per conversation. Reset uncarried IDs on
rollover; carried manual mappings and validated automatic owner carry
retain their attempts. Profile refresh within the same conversation
preserves attempts. Accepted voices stop spending. All rejected voices,
including far/noisy rejections, retain fresh-audio recovery
opportunities within the 12-attempt allowance and socket bucket. Later
clean clips can evict noisy evidence and re-arbitrate owner claims,
withdrawing a competing automatic owner mapping. Failed one-second
reconnect evidence is also allowed to accumulate normal full-length
owner evidence. Retained evidence can still be re-arbitrated or
rechecked against a recovered owner without more model calls.

Skip unavailable PCM intervals; emit `no_pcm` only for an entirely
unusable pool and recheck actual remaining PCM duration. Metric names,
labels and exit reasons stay unchanged; the proposed `decided_voice`
reason and early stop were removed after the independent review. Merged
`origin/main` including #21052 (`5b42496d5c`) without rebasing or
rewriting the published branch. Its calibrated `[0.65, 0.70)` owner near
misses remain `unknown` / `pending`. Acceptance thresholds, margins,
carry eligibility and paid non-owner naming/free owner recognition are
unchanged.

Failure-Class: none
The existing classes do not cover permanent exhaustion of a
socket-scoped live embedding budget or aborting a pooled extraction on
one unavailable interval. The fix is implemented in the matcher
admission primitive with behavioral regression tests, rather than adding
a separate guard.

## Product invariants affected

none (as reported by `scripts/pr-preflight --lane local --suggest`).

## Validation

- Focused policy/budget/carry/pooling/exit assertions passed through
`backend/test.sh`, including #21052's pending-band tests. The revised
budget suite passed all 24 cases with the unchanged default 0.30s CPU
guard.
- Selected all 61 speaker/owner-recognition/owner-profile unit files
through `backend/test.sh`. All 1,491 cases passed their assertions. The
parallel run loaded the pre-optimization churn test and flagged its CPU
time; it also flagged unchanged mixed-cache and speaker-learning cases
at 0.34–0.60s. The final budget file passed the default 0.30s guard; the
two unchanged timing-offender files passed serially with the documented
CI 1.0s ceiling (50 cases). No timing policy or allowlist is changed in
this PR.
- `OMI_PR_BODY_FILE=/tmp/owner-budget-pr.md make preflight`: 31 checks
passed. PR-body metadata validation and required pre-push contracts also
run before publication. The failure-class history ratchet skips on the
shallow local clone.
- Regression tests execute real `SpeakerMatcher.match` and WAV encoding:
original far/noisy recovery, near-threshold recovery, competing
automatic owner withdrawal, and replay of the failed one-second
reconnect state described by #21051. #21051 is not merged into this
branch; the replay is not a composed reconnect implementation test.
- No Google credentials, production data or `api.omi.me` calls.

## Reviewer risks

- The smaller burst can delay a busy early conversation after 16
attempts; refill recovers one attempt every 15s. Long-lived sockets can
now spend recurring hourly cost, unlike the lifetime cap.
- Rejected voices can still exhaust their 12-attempt allowance before
later clean speech; the socket bound prevents conversation churn from
minting free budget. Review the far/noisy and near-threshold recovery
regressions and competing-owner withdrawal.
- Check carry-attempt accounting around profile/donor awaits, generation
fencing and owner contention. Existing carry and entitlement regression
tests remain part of validation.
- No production deployment or recognition-quality measurement is
performed by this PR.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/21047?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="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/21047?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F21047&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
Git-on-my-level added a commit that referenced this pull request Oct 10, 2026
…1051)

Reconnects reset diarizer ids and evidence, leaving short owner replies
unknown. Preserve same-account/device owner continuity acoustically
while keeping enrollment thresholds, margins, joint arbitration and paid
non-owner naming unchanged.

Use one accepted owner centroid, enrolled-profile digest and donor
receipt provenance in the existing private authenticated per-user
encrypted cache: 120-second TTL, 16 KiB cap, atomic consumption and
device/writer revision fencing. A reconnect needs two fresh seconds and
the stricter 0.35 session-distance gate as well as the enrolled profile.
Shortened accepts cannot seed another handoff; absent, expired, corrupt,
different-device or changed-profile evidence retains ordinary
five-second recognition. Preserve #21047's refilling budget/retry
behavior and #21052's pending near-miss band.

Retain rollover peers only as competition until they provide five fresh
seconds. An accepted short owner's proof survives capsule expiry while
its original donor and receiving authority remain valid. Read receiving,
original acoustic donor and immediate rollover donor authority in one
projected Firestore transaction, bounded to three documents; fence the
matcher generation and rebuild/arbitrate/publish without another await.

One shared publication gate applies already-known receiving
rejections/retractions, then denies every publication or renewal if
final authority is unavailable. Earlier positive receipts cannot create
or refresh manual, automatic, carried or shortened owner labels. The
acquisition, retained-evidence reevaluation, mapped-voice renewal and
rollover paths all use this gate; idle refresh also stops when
reevaluation cannot publish. No cache refresh follows a failed final
read. Existing labels without a known rejection remain unchanged on read
failure; observed corrections retract them. Failed carry releases the
old per-conversation attempts without replenishing the socket budget.

Merged origin/main at `b2f6d2fe26b6` with an ordinary merge, preserving
upstream owner-retry changes and pipeline documentation. Translation,
dream inventory and Swift CI repairs are already upstream; this PR
contains no app/desktop repair diff. The success-path failover fixture
now dispatches the real final-authority transaction against its strict
store; the rollover test rebuilds continuity when rebinding its host so
the account id agrees with the store. Both retain all their original
assertions.

Spent-attempt telemetry: a spent query vetoed by unavailable final
authority emits exactly one bounded `authority_unavailable` live match
exit; zero-seeded labels and the closed reason inventory include it. No
acoustic rejection is synthesized and the negative-only publication gate
is unchanged. The reviewer reproduction is extended across two/five
seconds and known/absent receiving rejection, asserting one exit, no
live decision, no identity/cache publication, retraction of a known
stale manual mapping, and unchanged short-probe reconnect accounting.
All four new cases failed before the telemetry fix and now pass. The six
targeted suites pass 332 tests, including the full 72-case authority
matrix, rejection/renewal protections, reconnect/rollover suites,
bounded exit inventory and current-main owner retry telemetry. No
identity, arbitration, cache, threshold or budget behavior is changed by
this accounting fix.

Validation (all local test commands use `env -u
GOOGLE_APPLICATION_CREDENTIALS -u GOOGLE_CLOUD_PROJECT
CLOUDSDK_CONFIG=$(mktemp -d)`):
- The 72-case matrix crosses earlier positive/negative/absent receipts,
manual/automatic/carried publication, two/five seconds, healthy/failed
snapshots and a real receiving correction committed during the
transactional read. It failed 32 cases before the gate and now passes
all 72. Actual assignment/rejection operations and strict transaction
reads exercise the behavior, not mocked decisions.
- Mapped two/five-second owners and idle refresh additionally check that
failed authority cannot change an uncorrected mapping, renew the speech
gap or write a capsule. Existing known-rejection regressions continue to
require manual/automatic retraction.
- Current telemetry-focused validation: all 332 tests across six suites
pass through backend/test.sh, including the full authority matrix, exit
inventory, reconnect/rollover and current-main owner retry telemetry.
Typecheck has zero errors; all 34 make preflight checks pass. Exact head
`19571162160c186dc7f4ba66a7595c059ecad061`: [Backend Unit
Tests](https://github.com/BasedHardware/omi/actions/runs/38012356343).


Measurement: supplied rollover counts imply 48.4% `none` among automatic
owner outcomes, not proven identity loss. Archived-scope drops are the
leading code-based hypothesis; bounded rollover reasons expose the gate
taxonomy. `omi_owner_reconnect_total{outcome,reason}` separates
lookup/acoustic attempts, accepts and rejections. Gap choice,
denominators and carry reasons are documented in
`backend/docs/owner-continuity.md`.

Risks and reviewer focus: inspect the single negative-only publication
gate and every caller, especially a stale positive manual receipt
followed by a failed transaction and a receiving correction. Review
encrypted consume/revision ordering, the three-document read bound, and
competition-only carry across plan changes. Two seconds/0.35 lack
production false-accept calibration. Strict synthetic tests prove
binding and control flow, not live Firestore contention/retries or
real-audio calibration. No Google credentials, production data or
production API calls; no deployment or product-acceptance claim. Leave
unmerged for owner review.

Failure-Class: FC-independent-owner-voice-accepts

## Product invariants affected

none

Line-Count-Exception: backend/routers/listen/speakers.py | 1147 -> 1425
| Keep rollover accounting and joint arbitration integrated while
isolating encrypted handoff/cache I/O and centralizing negative-only
final authority across acquisition, rollover and revalidation.
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