Repository navigation
fix(listen): preserve acoustic owner continuity across reconnects - #21051
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Git-on-my-level
force-pushed
the
lane/owner-recog-reconnect
branch
from
October 9, 2026 10:42
c96062e to
0fa9e28
Compare
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. -->
…nnect # Conflicts: # backend/routers/listen/speakers.py
Failure-Class: FC-independent-owner-voice-accepts
Failure-Class: FC-independent-owner-voice-accepts
…nnect # Conflicts: # backend/docs/listen_pusher_pipeline.mdx
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.
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
b2f6d2fe26b6with 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_unavailablelive 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)):19571162160c186dc7f4ba66a7595c059ecad061: Backend Unit Tests.Measurement: supplied rollover counts imply 48.4%
noneamong 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 inbackend/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.