Skip to content

fix: restore live matcher FIFO scheduling and query cadence - #21281

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/matcher-scheduling-restore
Oct 12, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/matcher-scheduling-restore

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

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 legacy embedding_budget exits. 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_block retains 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 _created series 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.

  • Credential-isolated backend/test.sh after 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.
  • Negative control against unchanged fix: attribute speaker budget blocks and schedule queued voices fairly #21181 through the same harness: the tried-owner-first case, untried-owner-behind-rejector case, and long unresolved buffer fail (3 failed, 2 passed). All pass on the restored scheduler.
  • Relevant backend/scripts/run-unit-ci.sh shards 6/2 (FIFO diagnostics) and 6/4 (cadence): 1,293 and 1,395 tests passed, 52 files each; Pyright zero errors. Exact-head make preflight: 32 checks passed on 5c899a76c1234211e128620d90bed8270db7be10 in 820.79 seconds. All backend test entrypoints use Google credentials/project unset and a fresh private CLOUDSDK_CONFIG. Publication uses the full pre-push hook with no skip hatch.

Failure-Class: new

Adds FC-live-speaker-scheduling-regression with reusable real-runner guards in backend/tests/unit/test_speaker_queue_fairness.py and 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 --suggest and 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.

View guided diff Turn on auto-fix

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T07:13:46.103374Z 5c899a7 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

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.
@Git-on-my-level
Git-on-my-level merged commit 830b3c6 into main Oct 12, 2026
61 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/matcher-scheduling-restore branch October 12, 2026 07:52
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