Repository navigation
fix: name sync-off batch speakers with expiring encrypted centroids - #23607
Conversation
Reuse authoritative batch grouping and naming without retained audio. Register owner-encrypted Omi-v2 evidence before upload, enforce capture and completion expiry, and cover scheduled and privacy erasure. Failure-Class: FC-unit-label-as-conversation-identity
Require the effective registered deadline before and after decrypting temporary voice evidence, including post-completion shortening. Failure-Class: FC-unit-label-as-conversation-identity
Discard the immutable centroid object if target deletion fences its post-upload publication. Keep uncertain uploads in the registered outbox. Move the unchanged artifact factory out of admission so shared Pusher readers do not acquire a diarizer source dependency. Migrate callers and the existing two env-read baseline entries without expanding the surface. Cover owner/person naming with evidence serving, upload acknowledgement loss, and target deletion during upload. Failure-Class: FC-unit-label-as-conversation-identity
Refuse centroid creation when bucket soft delete, default holds, retention or unreadable metadata cannot prove the approved physical deletion path. Do not change bucket policy or IAM from processing. Qualify the existing bucket and runtime metadata read access before the lead rolls this out. Failure-Class: FC-unit-label-as-conversation-identity
Remove an unused import after moving shared storage composition and the redundant type assertion on the reader's typed deadline. Failure-Class: FC-unit-label-as-conversation-identity
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 690f860ea7
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if receipt['enrichment_required']: | ||
| if (receipt.get('speaker_scope') or '').startswith('final:batch:'): | ||
| prepare_voice_evidence(self, item, binding, canonical) |
There was a problem hiding this comment.
Prepare voice evidence in the asynchronous follow-up path
For jobs admitted with asynchronous projection, this hook never runs: Projector._persist_read() calls _assign(..., finish=False), and ProjectionFollowups.finish_part() independently performs enrichment without calling Projector.finish_part() or preparing voice evidence. The production configuration in backend/deploy/runtime_env.yaml enables BATCH_PIPELINE_ASYNC_PROJECTION_ENABLED, so those sync-off jobs proceed to enrichment and cleanup without creating any centroids, leaving the new resolver with no evidence and speakers anonymous. Add the preparation step to the asynchronous follow-up path before it marks enrichment.
Useful? React with 👍 / 👎.
| # Never populate the cross-conversation process embedding cache. | ||
| return extract_embedding_from_bytes(clip, 'batch_voice.wav', timeout=min(3, remaining), use_cache=False) | ||
|
|
||
| payload = schema.extract(wav, payload['diarization']['turns'], item.capture_at, embed) |
There was a problem hiding this comment.
Exclude recorded overlap regions before extracting centroids
When speakers talk simultaneously, the production diarization payload's turns are already an exclusive projection: diarizer/batch_pipeline_flight.py::diarization_payload() assigns each interval to one speaker and records actual simultaneous activity separately in overlaps. Passing only turns means the extractor's subtraction of other labels cannot detect those intervals, so mixed-speaker PCM is embedded and counted as exclusive evidence. For example, activity A=0–8s and B=4–10s can become exclusive turns A=0–8s and B=8–10s, incorrectly counting all eight seconds for A instead of four. Subtract diarization.overlaps before constructing clips so contaminated vectors and inflated evidence do not drive grouping or naming.
Useful? React with 👍 / 👎.
| and any( | ||
| r.get('conversation_id') == conversation_id | ||
| and r.get('speaker_scope') == f"final:batch:{job.get('segment_id')}" |
There was a problem hiding this comment.
Resolve trusted conversation redirects when binding voice evidence
If a projected conversation has been absorbed by another sync conversation before follow-up, Projector.finish_part() follows its redirect through finish_sync_bridges() and passes the survivor ID to prepare_voice_evidence(). At that point the persisted projection receipt still contains the donor ID: ProjectionStore.mark_enrichment() only rewrites it to the survivor after preparation. This exact-ID check therefore makes publish() reject and discard the newly uploaded evidence; enrichment subsequently marks the receipt ready, so preparation is not retried. Validate the donor-to-survivor binding through the existing privacy-fenced redirect chain, or checkpoint the canonical binding before publishing, so legitimate sync merges do not permanently lose their speaker evidence.
Useful? React with 👍 / 👎.
Verify permanent-erasure bucket policy before extraction and again before registration/upload. Preserve an object after an uncertain publish result so a committed reference remains readable and registered erasure still applies. Bound transient centroid copies and extraction CPU work, and isolate provider partition identity from the clustering import graph. Failure-Class: FC-unit-label-as-conversation-identity
Preserve weighted grouping semantics while keeping only one accumulator per provider-label unit. Skip sentences with zero measured evidence and verify the live-array bound on a 1,500-sentence synthetic transcript. Failure-Class: FC-unit-label-as-conversation-identity
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| { | ||
| 'uri': uri, | ||
| 'cleanup_after': datetime.fromtimestamp(due, timezone.utc), | ||
| 'conversation_ids': list(set(metadata['conversation_ids'] + [conversation_id])), |
There was a problem hiding this comment.
Clear the staging marker when publishing voice evidence
After a successfully completed unit's centroid is deleted at completion +1h, its metadata still contains write_pending_until: neither this publication update nor cleanup_completed_artifacts() removes it. Once the marker passes the two-hour orphan grace, batch_pipeline_staging.reap_one() selects that receipt and raises KeyError('uri') because cleanup already removed its URI. In the inspected Serving._maintain() path, staging reaping precedes artifact cleanup inside the same try, so this persistent receipt prevents subsequent scheduled artifact deletion across the namespace until the receipt expires. Remove the pending marker on successful publication, or ensure cleanup retires it before removing the URI.
Useful? React with 👍 / 👎.
| if row is None or segment.end - segment.start < 1: | ||
| continue |
There was a problem hiding this comment.
Use label-level evidence for speakers with short replies
When a speaker contributes only subsecond replies interleaved with another speaker, this filter discards every reference to their centroid even if extraction accumulated enough exclusive speech to identify them. For example, ten 0.8-second turns produce an eight-second centroid, but load_vectors() returns no vectors for that label; resolve_sync_off() consequently leaves the speaker anonymous and cannot link their groups across units. The one-second transcript threshold is appropriate when embedding individual segments, but these embeddings already represent pooled label-level audio. Admit that evidence independently of individual reply duration, and adjust the corresponding MIN_EMBED_SECONDS filter in resolve_conversation_speakers() for this precomputed-centroid path.
Useful? React with 👍 / 👎.
Conflict-only resolution: config/feature-flags.yaml keeps both new entries (BATCH_SYNC_OFF_CENTROIDS_ENABLED from this lane and BATCH_PIPELINE_EMPTY_ASR_SAFETY_NET_ENABLED from #23603); the generated feature-flag registry was re-rendered from the union and verified with scripts/check_feature_flag_registry.py. No other semantic changes.
Sync-off users currently receive anonymous speakers across batch upload units because the retained-audio resolver cannot read their cleaned-up audio. Reuse #23581's constrained cross-unit grouping and calibrated naming from bounded temporary Omi-v2 centroids extracted before existing staged audio cleanup.
David approved this design on 2026-10-25 ~14:45Z (ADR-0004; anx
qualfix-sync-off-centroid-decision). Existing batch admission stays unchanged.BATCH_CONVERSATION_SPEAKERS_ENABLEDremains the parent kill switch; the additionalBATCH_SYNC_OFF_CENTROIDS_ENABLEDsub-switch defaults on. Lead owns merge and rollout; this PR is handed off unmerged.Privacy: vectors are biometric-like derived data. The separate
voice_evidenceartifact contains normalized 256d Omi-v2 float32 vectors, original local labels, measured exclusive speech seconds, schema/space, capture time and expiry only. No audio, transcript, names or person IDs; noaudio_filesentry, audio-retention extension, global voice bank, profile teaching or durable centroid cache. Standard and enhanced protection both use owner-derived AES-256-GCM. AAD binds owner/unit, original audio generation, admitted clocks/conversation, protection/privacy generation, schema/space and capture expiry. Limits are 32 labels/64 KiB per unit and 1,024 labels/2 MiB per conversation pass. Names never merge groups; manual receipts remain authoritative.The registered deletion outbox precedes upload, including unknown outcomes. Hard expiry is capture +24h, shortened to at most successful batch completion +1h (which can precede conversation finalization). Reads check current unit/conversation binding, privacy generation and expiry before and after IO and before label projection. Registration after racing completion inherits its shortened deadline; uploads stop before their maximum uncertainty window would exceed expiry. Existing scheduled cleanup and account/conversation purge cover the artifact kind; audio incident holds do not extend optional vectors. Retention docs and the approved ADR are updated.
Creation additionally fails closed unless bucket metadata proves zero-second soft delete, no default hold and no retention period. A DELETE cannot permanently erase an object during a soft-delete retention window (GCS bucket contract). Metadata denial/unknown policy leaves speakers anonymous. Lead must qualify the existing staging bucket and runtime metadata-read access before rollout; no bucket or IAM write is part of this PR. The shared factory moves out of admission to keep the reader deployable in Pusher; its two existing env reads are relocated unchanged, with no flag-budget expansion.
Validation (synthetic fixtures only; exact final results will be updated before handoff):
BACKEND_PYTEST_WORKERS=4 BACKEND_UNIT_TEST_FILE_LIST=/Volumes/Ephemeral/scratch/qualfix2/selected-tests.txt "$OMI_WORKSPACE_ROOT/bin/omi-heavy" run -- nice -n 19 bash test.sh. Includes parent/sub-switches, both protection levels, AAD tampering, full 32-label float32 budget, capture/shortened TTLs, upload-time target deletion, bucket-policy refusal before extraction and policy changes before upload, publication commit with response loss, bounded per-label arrays, no cache/audio dependency, and owner/person naming with speaker evidence off/serve. Prior CI import and metric-enum failures are covered locally.firebase emulators:execand the targeted integration files; fake storage holds encrypted synthetic bytes only. The final bucket-metadata precondition is also covered by unit tests.E2E_PYTEST_TIMEOUT=300s "$OMI_WORKSPACE_ROOT/bin/omi-heavy" run -- nice -n 19 bash backend/testing/e2e/run.sh -v --tb=short: 135 passed, 3 skipped, 2 xfailed in 100s at main-merged parent3476a077c75b. The following pooling-only correction has the full 530-case targeted unit receipt. An earlier run hit the default 120s wall limit without an assertion failure; the documented 300s limit completed normally.backend/scripts/typecheck.sh: zero errors at the final candidate.OMI_PR_BODY_FILE=<body> make preflight: 38 gates passed, including all runtime image source closure, serving-query/privacy guards, import purity and the line-count ratchet.d770e2a7e53b99cd8172184fafca4cd3a8dd9b65, including streaming weighted pooling. Real bucket policy/runtime metadata qualification remains with the lead.Initial-head CI also exposed an unrelated goals fixture missing
models.goal; it already failed at the PR base and was repaired independently in #23608. Lead ruling fa4928 was applied by merging origin/main; no firmware change is included in this PR's diff. Final-head CI is green atd770e2a7e53b99cd8172184fafca4cd3a8dd9b65: all workflows terminal success, no failed/pending checks, PR OPEN/CLEAN/MERGEABLE. Backend unit run 40213625064, emulator proofs 40213625063, hermetic E2E 40213625050. The Sync Cloud Tasks gauntlet passed without a rerun. This is CI qualification; live bucket policy and production acceptance remain with the lead.INV-DATA-1: all customer references remain on the existing batch customer-data plane; no migration, bucket, key or IAM change. No production access, user data, runtime flag flip, historical repair or deploy performed.
Deploy needed after lead merge: Cloud Run backend, backend-sync, backend-sync-backfill and backend-integration (projection/enrichment/maintenance), plus Pusher's shared finalizer. Existing hosted Omi-v2 embedding service is reused; no GPU model change. Rollback: set
BATCH_SYNC_OFF_CENTROIDS_ENABLED=false(or the parent false); already registered erasure continues and existing/manual labels are preserved.Failure-Class: FC-unit-label-as-conversation-identity
UI-Evidence: none -- backend speaker attribution and temporary encrypted storage only.