Skip to content

fix(speakers): prove batch speaker windows on the live audio store - #24465

Merged
Git-on-my-level merged 5 commits into
mainfrom
lane/spkclock
Nov 3, 2026
Merged

Git-on-my-level merged 5 commits into
mainfrom
lane/spkclock

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Requested by David

What changed and why

Overlapping live and sync audio can make speaker windows refuse untrusted_clock. This PR proves a window on its own timing store and uses that store for decoded coverage and embedding clips. A final:batch: scope alone cannot choose a store: batch_sync_v1 desktop WAL uploads also project that prefix. The review fix records optional timing provenance at CPU admission and stamps provider_speaker.timing_store during projection. Built-in WAL decoding stamps sync; retained live manifests stamp batch only when every source is .batch.enc / .batch.bin. The original provider scope/id/provider and stamp survive conversation re-scoping; public JSON omits the marker.

Stamped batch windows use only the named store. Unstamped history, unknown/mixed custody and alternate decoder sources retain refusal. Existing job audio_uri values are generic staged artifact references, so no historical lookup or inferred backfill is added. Missing selected-store coverage abstains its affected windows without cross-store fallback. Manual receipts retain precedence.

SPEAKER_BATCH_STORE_ENABLED defaults on inside the existing per-window cohort and controls final:batch: windows on either stamped store; false restores refusal independently of the native sync: switch. No GPU worker, streaming, deployment or privacy-contract change. Charts/monitoring/scripts had no references to the old log event, so the store-neutral conversation_speaker_store event now reports batch_proven and sync_proven.

Product invariants affected

none

How it was verified

Latest verification at 58e5e275c6fa1478671b1490fcbe8f494936f7cd on lane/spkclock, through bin/omi-heavy: BACKEND_UNIT_TEST_FILE_LIST=/tmp/spkclock-suites.txt BACKEND_PYTEST_WORKERS=2 bash backend/test.sh passed 182 tests across test_speaker_sync_store.py, test_pipeline_characterization.py, test_speaker_grouping_review_regressions.py, test_speaker_grouping_shadow.py and test_conversation_speaker_resolution_stage.py, including all 23 characterization cases; the default CPU duration guard passed with no allowlist exception. The overflow regression now uses 300 segments over three units under both protection levels and original/resolved scopes. Timing overflow markers are deduplicated per unit and capped at 1,024 units, 256 KiB plaintext and 384 KiB ciphertext; over-cap units retain refusal without blocking transcript writes. Seven new regressions cover deduplication, total count, aggregate write/read byte bounds, opaque/decoded rewrites and conflicting stamps. All seven and all four shortened long cases fail as assertions against fad2b310b3a2 in the revert check (only additive budget constants retained); fixed source restored. Goldens unchanged. make preflight: all 38 checks passed (103.51s). Normal pre-push gate passed; 0 backend type errors. No production access; .agent-artifacts was not committed.

Local replay on 5 of the owner's long batch conversations (consented, local only) found this change alone moves only 1-3% of speech: resolver budgets, inventory mismatches and unit fragmentation dominate. It is a correctness fix for the store selection; the larger quality change is a whole-conversation final pass, in a separate PR.

  • Selected suites: 536 passed across 11 isolated files. The four requested speaker suites passed 142 tests, including 31 focused store tests.
  • Revert checks: all 11 review regressions fail as assertions against the scope-only behavior at a876a320d519 (additive schema/pure helpers retained for fixture imports); all five original slice regressions fail against 64a551c3dda7. Fixed files restored after both checks.
  • Pinned formatter and generated registry passed; full async blocker scan reported zero blocking findings.
  • make preflight: all 38 checks passed (77.01s). Normal pre-push gate: passed, including 0 backend type errors.

Not verified: real-audio named accuracy and wrong-owner counts. Synthetic fixtures prove source isolation and identity policy only. No production reads, GCP, kubectl or production API calls were used.

Tests

Speaker-store regressions cover stamped WAL windows on .opus.enc only (before and after re-scoping), unstamped/unknown provenance refusal, stamped live windows, selected-store holes, kill switches and manual precedence. Producer tests cover admission provenance, projection/partition propagation, storage round trips, conversation re-scoping and public JSON exclusion. A revert check exercises the review regressions against the original scope-only implementation.

UI evidence

UI-Evidence: none -- backend only

Failure class (fixes)

Failure-Class: FC-transcript-and-audio-on-independent-clocks

🤖 Generated with Claude Code

@Git-on-my-level Git-on-my-level self-assigned this Nov 3, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 9 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@Git-on-my-level
Git-on-my-level merged commit d37ae43 into main Nov 3, 2026
63 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/spkclock branch November 3, 2026 10:03
Git-on-my-level added a commit that referenced this pull request Nov 3, 2026
…#24490)

<!-- claude-projects-attribution: {"github_login":"Git-on-my-level"} -->
_Requested by **David**_

## What changed and why

Batch-authoritative conversations currently stop at the per-unit
acoustic resolver. This adds the existing community-1 whole-conversation
final pass before summarization for conversations with either
private-cloud sync setting, preserving stable segment IDs, text and
manual receipts. Labels use `final:batch:conversation:<id>`.

The adapter assembles each unit's own staged batch PCM and words on its
authenticated job capture clock. It replays the same projection IDs,
including the unsplit record-origin branch and WAL speech-span part IDs.
Stored offsets, playback `audio_files` and lossy Opus re-encode equality
do not place units. Missing/expired/privacy-fenced artifacts,
read-budget exhaustion, conflicting capture clocks or any unplaced
conversation segment leave ALL current resolver labels unchanged, with a
recorded fallback. After complete input coverage, gap words and
mixed-speaker segments abstain. Naming thresholds, manual receipts and
joint owner arbitration are unchanged. Controls include the nested
default-on kill switch, default-100 hash cohort, atomic attempt caps,
one process slot and a 7200-second PCM/timeline ceiling. Every HTTP
attempt charges audio/request caps before dispatch, including transient
retries and compaction retries. Reads have a dedicated invocation budget
of 180 seconds, 320 MiB and 512 objects, including nested
native-manifest sources.

The existing word validator and its closed error types move to a shared
CPU module so Pusher images can load the adapter without importing the
GPU worker. In-tree callers migrate together; worker validation behavior
is unchanged.

Scope: sync-on and sync-off when the unit's existing staged audio/result
artifacts are available. Ordinary staged artifacts are due for cleanup
24h after successful projection (`expire_completed_segment`),
independent of the shorter ADR-0004 temporary-centroid TTL. Enrichment
inside that window is eligible; enrichment at/after expiry abstains even
before physical cleanup. Native-record staging manifests retain their
pinned-source/digest/slice verification. The flag catalog also describes
this staged-artifact eligibility for both sync settings. No
auto-enrollment publication, new retained artifacts, retention
extension, per-unit diarization removal, runtime config change or
deployment.

Why: on 5 of the owner's long batch conversations (local, consented),
prod stored 66-572 speaker fragments each; one whole-recording
community-1 pass gave 2-15 clusters and named about 4x more speech with
the same thresholds. Companion to #24465.

Ramp: the lead sets `BATCH_FINAL_PASS_PERCENT` to 10, then 50, then 100,
expanding after each full observation window with clean final-pass
fallback rate, owner-parity delta, p95 enrichment latency and
diarizer-batch queue depth. Code defaults are on/100; this PR does not
change deployed values. Rollback is `BATCH_FINAL_PASS_ENABLED=false` or
percent zero; published labels persist. Metrics use the existing
final-pass families with `lane="batch"`, plus word-time owner delta.
GPU-hours/day = admitted audio-hours/day × 0.03–0.042 RTF; the default
1200 audio-hour/day cap adds about 36–50.4 GPU-hours/day, excluding idle
pool floors. Per-unit diarization still runs, so this is additive.

Risks: missing/expired/privacy-fenced artifacts, metadata loss,
conflicting overlapping device clocks or exhausted read budgets abstain
for the whole conversation. Native-record manifests still require their
pinned sources. Sync-off requires enrichment before the existing
staged-artifact expiry; no availability guarantee extends that
retention. GPU throughput and enrichment latency need the lead's
measured ramp; no production quality/latency measurement was performed
here.

## Product invariants affected

none

## How it was verified

Validation (heavy commands through
`~/workspace/omi-workspace/bin/omi-heavy run --`):

- Round 3 (`821e9febd5`):
`BACKEND_UNIT_TEST_FILE_LIST=/Volumes/scratch/spkfinal-r3-wj7XiS/suites.txt
BACKEND_PYTEST_WORKERS=4 bash backend/test.sh` passed **307 tests across
8 files** (worker, validation-disposition and all six final-pass
suites). Restored origin/main's unconditional first-attempt quarantine
for staged-WAV decode failures, including when
`BATCH_PIPELINE_WORKER_VALIDATION_DISPOSITION_ENABLED=false` with the
safety net both on and off. `git diff origin/main --
backend/diarizer/batch_pipeline.py` contains only the shared
word-validation extraction; an AST comparison confirms all other worker
code matches main. `make preflight` and `scripts/pr-preflight
--pr-body-file /Volumes/scratch/spkfinal-r3-wj7XiS/pr-body.md` each
passed all 39 checks on the committed head. The normal pre-push hook
passed; no hook bypass was used.
- `BACKEND_UNIT_TEST_FILE_LIST=<fix-suites.txt> BACKEND_PYTEST_WORKERS=4
bash backend/test.sh`, plus the shared native-audio/HTTP adapter suite:
1164 unit tests across 30 files, with the duration guard. This includes
all earlier unit suites, batch artifact/retention receipts, native
capture source materialization, HTTP retry behavior, and main’s speaker
timing-store provenance regressions. Current main was merged; its new
`stamp_speaker` call is preserved in the shared segment builder.
- All 26 newly added regression cases fail when the corresponding
reviewed implementation is restored or its budget enforcement is
bypassed; no collection errors. Further isolated mutations remove only
the HTTP attempt guard or change only the record/WAL part-selection
branch to confirm the tests reject those behaviors.
- Loopback-only Firestore `test_batch_pipeline_live_firestore.py` rerun
through `backend/test.sh` with `BACKEND_PYTEST_MARK_EXPR=integration`:
15 passed, the same 3 baseline failures as the reviewed head. Both
subprocess groups were stopped afterward. No cloud/GCP access.
- `scripts/pr-preflight --pr-body-file
/Volumes/scratch/spkwhole-input/pr-body.md`: passed, 39 checks.
`OMI_PR_BODY_FILE=/Volumes/scratch/spkwhole-input/pr-body.md make
preflight` passed all 39 checks on the merged head. The normal pre-push
hook passed with `~/.local/bin` on PATH; no hook bypass was used.

The three Firestore failures are
`test_finalize_racing_projection_and_replay_preserve_one_visible_record`,
`test_pre_enable_capture_holds_wal_until_finalizer_reserves_owner`, and
`test_true_vad_silence_replaces_unprotected_provisional_speech[True]`:
the existing capture upload/finalization barrier and silence fixture
`hint` keyword. The earlier main-restoration run established the same
15/3 baseline.

## Tests

`backend/tests/unit/test_batch_final_pass.py`: staged PCM admission with
both sync settings; record-origin and WAL speech-span IDs; capture-clock
placement across gaps; whole-pass abstention on incomplete coverage,
read budgets, missing/expired/privacy-fenced artifacts and conflicting
clocks; sync-off reference expiry at the 24h post-projection boundary;
real HTTP retries charged against daily audio, hourly audio and request
caps; manual receipt precedence, rollback and failure paths.
`test_batch_pipeline_artifacts.py` verifies read budgets before object
download and through native-manifest source reads.

## UI evidence

UI-Evidence: none -- backend only

## Failure class (fixes)

Failure-Class: FC-transcript-and-audio-on-independent-clocks


Line-Count-Exception: backend/utils/conversations/speaker_resolution.py
| 1545 -> 1557 | Connect the existing enrichment entrypoint to an
isolated batch final-pass adapter after speaker evidence finishes; all
new audio, mapping and budget logic lives outside this oversized file.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/24490?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/24490?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24490&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. -->
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