Repository navigation
fix: restore live matcher FIFO scheduling and query cadence - #21281
Merged
Merged
Conversation
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. |
Preserve all owner-recognition diagnostics hooks with FIFO scheduling and add comparison, refusal, budget and stop regression coverage.
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.
Restore live matcher scheduling and query cadence
After #21181's listen rollout, the supplied matched five-hour owner-identification rate fell from 35.5% to 29.6% at similar conversation volume. The analysis identified scheduling and evidence-trajectory changes as plausible contributors, without establishing causality. This PR restores the scheduling/query cadence preceding #21181 while retaining its budget instrumentation and all current authority/stale-generation guards. The separately approved listen deployment rollback is outside this PR. The freshly fetched main snapshot, including diagnostics #21235 (
314037874f), is merged through a normal two-parent merge commit; no rebase or force-push is used.Each provider update gets its own bounded FIFO metadata entry. No untried, near-owner, duration or age priority applies, and same-voice updates are not coalesced. Restore the original runner/task admission order and existing per-voice lock serialization. A dequeued update contributes its own interval to the existing minimum-evidence accumulation; successful extraction clears pending metadata and does not autonomously requeue unselected leftovers. A subsequent provider update is required to drive another query. Already embedded audio stays covered, so overlapping updates cannot fabricate evidence.
The FIFO wrapper snapshots enqueue-time matcher generation and keeps only timing/identity metadata. Generation/conversation and final authority fences remain in place. Thresholds, margins, manual veto, contention, the 12-attempt voice cap, the socket's 16-token burst and 240/hour refill, and the 16-task ceiling are unchanged. This does not include #21222 voice recovery.
Telemetry compatibility
The metric schemas, reservation/extraction accounting, exclusive caps and first-block log from #21181 remain intact. All merged #21235 diagnostics hooks are preserved: profile/begin, match/query decorators, live comparisons, budget observations, evidence pending, scores/publication progress, refusal observations, checkpoint/stop and generation binding.
queue.qsize()counts FIFO provider updates, including separate entries for one voice:omi_speaker_id_budget_exits_total{cap=voice|socket|both}counts exclusive denied reservations. Summing caps equals legacyembedding_budgetexits. Repeated denials are not distinct exhausted owners.omi_speaker_id_embedding_attempts_total{outcome=reserved|succeeded|failed}counts spent reservations and encoding/extraction completions, including failure/cancellation. Completion may lag reservation; failures spend quota without refunds.omi_speaker_id_budget_voices_total{cap=voice|socket|both}counts the first denial per numeric voice/matcher generation;omi_speaker_id_budget_sockets_total{cap=voice|socket|both}counts the first denial of any kind per socket. Each labels that first cap, not every later cap transition.speaker_id_budget_first_blockretains uid/socket/recording/conversation/generation/scoped speaker/attempts/tokens/evidence and pending seconds/cap. One line per first blocked voice-generation, no repeated budget log per update. No text/audio/embedding payloads. UID remains in logs only.Each of the four metric families retains three closed labels: 12 counter series plus 12
_createdseries per target. No user, socket, conversation, generation or speaker labels are added. Owner-target decision events are not a count of GPU calls or true-owner voices; pending reductions alone do not demonstrate recognition improvement.Regression coverage and validation
The real runner pins last-token FIFO in both arrival orders for a tried owner needing its final initial-evidence clip versus an untried non-owner, and for an untried owner versus a tried rejector. A long unresolved turn extracts one centered query, does not self-requeue or spend again without a provider update, and still queries uncovered audio when an ordinary update arrives. Additional checks pin separate short-update extraction, overlap deduplication, a 100-update queue cap, metadata-only entries, and queued generation/conversation rejection.
backend/test.shafter merging main: 479 passed across 16 files, including both FIFO diagnostics cases, all merged live/resolver diagnostics tests and existing scheduling, telemetry, budget, authority and publication regressions.backend/scripts/run-unit-ci.shshards6/2(FIFO diagnostics) and6/4(cadence): 1,293 and 1,395 tests passed, 52 files each; Pyright zero errors. Exact-headmake preflight: 32 checks passed on5c899a76c1234211e128620d90bed8270db7be10in 820.79 seconds. All backend test entrypoints use Google credentials/project unset and a fresh privateCLOUDSDK_CONFIG. Publication uses the full pre-push hook with no skip hatch.Failure-Class: new
Adds
FC-live-speaker-scheduling-regressionwith reusable real-runner guards inbackend/tests/unit/test_speaker_queue_fairness.pyand the existing telemetry/budget suites. The old fairness/coalescing assertions are replaced with the restored cadence contract. The only merge conflict was the old priority-test authority latch; keep the FIFO regressions instead of restoring that retired fixture. New diagnostics tests execute the real FIFO runner: two short updates create two query attempts, one sufficiently evidenced owner comparison, progress/refusal records and a rollover stop with two pending same-voice entries. A second test records a short-window refusal and socket-budget denial before a drain snapshot, without extraction or comparison. Closed rows reject stale FIFO work without painting a successor generation. Diagnostics call/decorator ASTs in matcher, transcripts and conversation controller match current main exactly.Product invariants affected: none (
scripts/pr-preflight --suggestand metadata validation).Reviewer risks
Restoring FIFO also restores its tradeoffs: repeated updates can occupy multiple queue/task slots, same-voice tasks wait on the existing lock, a full 100-entry queue can drop later updates, and a late untried owner has no priority over earlier rejectors. This is deliberately the earlier scheduling behavior; no fairness guarantee or owner-coverage uplift is claimed. Calls and latency can change within unchanged caps, and queries remain bounded at ten seconds. Unselected leftovers require a future provider update, so a voice can remain unresolved when updates stop.
Production recovery must be judged separately with matched owner outcomes, combined single-speaker/identified share, actual reservation volume, contention and latency. No production records/logs or api.omi.me calls were used. #21235 is integrated with its hooks and accounting intact. #21222 is untouched and must be rebased separately later. FIFO pending-queue counts are documented as update counts.