Skip to content

fix: preserve original batch speaker evidence and measure identity availability - #25467

Merged
Git-on-my-level merged 13 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/q12-speaker-evidence
Nov 16, 2026
Merged

Git-on-my-level merged 13 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/q12-speaker-evidence

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Problem and resulting behavior

Sync-on batch speaker resolution can lose verified acoustic evidence when later playback inventory no longer matches the original units. A first successful resolver snapshot can also outlive transcript growth. This change reconstructs current segment membership from the original generation-pinned unit/result/capture references, feeds bounded per-label Omi-v2 evidence to the existing constrained cross-unit linker, and refuses stale processing completion after late append or merge.

Per-label extraction replaces per-sentence extraction; it adds no second STT, diarization or final-pass inference pass. It preserves distance <0.50, owner/person margin >=0.10, >=5 measured seconds, manual authority, same-unit cannot-links, and shared-unit/privacy/erasure/expiry refusals. Overlapping capture windows cannot multiply measured evidence. Existing donor/merged reference refusals remain closed; this does not rebind units from another row. No audio custody receipt or reclamation behavior changes.

Serving and rollback

BATCH_ORIGINAL_IDENTITY_EVIDENCE_ENABLED defaults on. Set it to false to restore the existing playback-manifest resolver. The change uses the existing encrypted sync-on conversation cache; no new biometric artifact, enrollment, retention policy, capacity setting or production configuration. Sync-off evidence behavior and integration's existing final-pass-disabled exception remain unchanged. Metrics ship on independently of this switch.

Measurement

Adds durable, duplicate-suppressed observations of current committed identity revisions: segment count, segment-span seconds, word count, proven word seconds and timing-coverage denominator, with only owner/known_person/unknown labels. Summary-only enrichment and restart do not count a new recording; later membership or identity changes produce explicitly separate revision observations. All replicas mirror durable shards, so queries deduplicate with max before increase; freshness and missing series are explicit. Adds bounded proof-refusal, final-pass disabled/dependency-unavailable, and replacement embedding attempted/successful/cached counters, using existing metric export conventions. Revision/attempt families are read directly from GMP and retained explicitly by the sync scrape profile; they have no in-cluster dashboard/alert consumer and are excluded from the Stackdriver exporter bridge. The existing conversation-family bridge is unchanged.

Expected improvement is more supported original-unit speech reaching the existing linker with fewer repeated sentence embeddings. After a separately authorized deploy, compare fresh-revision segment/word-time availability and timing coverage, proof-refusal rates, extraction attempts per speech hour, processing latency and measured inference cost. Higher label share or lower fragmentation alone is not recognition accuracy or savings. Verify exports/freshness for every processing role and qualify false-owner precision on separately authorized labeled audio before claiming product gain. Runbook: backend/docs/operational/batch-identity-evidence.md.

Validation

Synthetic unit tests exercise the actual resolver, pinned reconstruction and persistence guard: late append after first resolve, rebased/merged membership, mixed live/WAL provenance, replaced generation, generation race, source privacy, erasure/shared/merged/expired refusals, manual overrides, unchanged distance/margin/evidence thresholds, attempt cap, overlap deduplication, no additive extraction/diarization, cache reuse, storage-only metadata and bounded labels. Durable metric tests cover duplicate delivery, repaired identity, growth, restart, stale/incomplete refresh, direct-GMP retention and bridge exclusion. Existing resolver, owner diagnostics, voice-evidence, matching, final-pass/retry and flag-budget contracts are run file-by-file with cloud credentials unset through omi-heavy. Final exact results are recorded in the implementation report.

Current-revision observation runs inside the exception-isolated owner-recognition completion callback, so optional observation import/invocation failures cannot interrupt capture accounting or persistence callbacks. The transport correction passed 28 config-related unit files individually (1,031 passed, one skip), including both existing sidecar/monitoring contract files unchanged. The PR-added availability test proves direct-GMP retention, bridge exclusion and bounded sync retention.

The reason-label boundary uses closed owner-recognition enums with unchanged accepted label values and ignores invalid inputs as before; no debt-list entries were added. Stale membership resets typed ConversationSpeakers metadata, not conversation lifecycle status.

No production access, private-audio replay, deploy or device acceptance. No app UI changes. The summary-rendering files and sync-merge/projection-session files owned by the other lanes are untouched. The shared database/conversations.py change is limited to the processing membership fence.

Product invariants: INV-MEM-4 remains intact: no canonical promotion or enrollment authority changes. INV-TASK-2 remains intact: no task capture or derived-effect writer changes.

Line-Count-Exception: backend/database/conversations.py | 5090 -> 5110 | Keep the current-membership veto in the canonical processing transaction before identity or notes can be committed.
Line-Count-Exception: backend/utils/conversations/speaker_resolution.py | 1567 -> 1702 | Wire the original-unit replacement into existing receipt and final-pass ordering with unchanged matching policy and no second inference pass.
Line-Count-Exception: backend/utils/conversations/process_conversation.py | 3455 -> 3463 | Observe the current committed identity revision at the existing successful persistence boundary; observation failure cannot fail processing.

Failure-Class: none

🤖 Generated with Claude Code

Git-on-my-level and others added 7 commits November 16, 2026 13:23
…visions

Replace sync-on batch sentence extraction with generation-bound unit label evidence, fence stale membership settlement, and export durable identity availability with bounded refusal outcomes.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… settled

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Observe each committed revision with one transaction attempt and declare the fixed-shard refresh planning budget.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Use public reconstruction helpers, single-assignment reason constants and typed Prometheus collectors. Runtime matching and proof policy are unchanged.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Exclude identity membership metadata from JSON and OpenAPI while retaining it in Python-mode persistence dumps.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T10:09:57.810843Z 8889121 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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ea5981a773

ℹ️ 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".

abstained = {
s.id
for s in conversation.transcript_segments
if s.id not in evidence.vectors or s.id not in keys or text_window_refusal(s.start, s.end) is not None

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep proven short segments eligible for their batch-label group

When an original label contains both a long utterance and a sub-second reply, batch_identity_evidence.load() proves both segments' word membership but deliberately omits the short reply from vectors. This condition then marks that reply abstained. resolve_conversation_speakers() removes abstained segments before its existing provider-label inheritance step, leaving the reply unidentified and potentially splitting it from the same original voice. This remains visible when the whole final pass is disabled or during an identity-only retry. Track proven membership separately from embedding availability so short, proven members can inherit their label's resolved group.

Useful? React with 👍 / 👎.

Comment on lines +865 to +869
if resolution.status == 'resolved' and resolution.input_membership_sha256 != membership:
# A terminal whole-pass obligation may suppress new inference, but
# its old snapshot cannot certify newly appended/rebased text.
resolution.status = 'unavailable'
resolution.participant_speaker_ids = []

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Stamp membership on speaker-only final-pass results

After a successful deferred speaker pass, final_pass_retry.run_only() persists the result of run_batch_final_pass() directly, bypassing this wrapper's membership assignment. The shared final-pass writer still constructs ConversationSpeakers without input_membership_sha256, so this check declares that successfully resolved result stale even when the transcript is unchanged. On subsequent processing, the settled final-pass obligation causes resolve_direct() to use skip_automatic=True, clearing the resolution status and participant IDs without allowing inference to restore them. Populate the membership key at the shared final-pass result boundary as well.

Useful? React with 👍 / 👎.

if not check():
raise PermissionError('batch evidence changed')

revalidate()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reserve time for evidence revalidation before the deadline

If artifact reads or extraction exhaust the deadline after earlier units have succeeded, the handler above attempts to retain a partial result, but this unconditional revalidation invokes checks that use ArtifactReadBudget(deadline, 0, 0) with the same expired deadline. The reference reader immediately raises ArtifactReadLimit, causing _resolve_original_batch() to discard the result and skip uploading the successful embeddings. Long recordings, especially under the five-second identity-retry budget, therefore cannot make incremental progress across attempts. Stop extraction early enough to reserve bounded time for the required revalidation.

Useful? React with 👍 / 👎.

Comment on lines +213 to +214
for refusal in set(diagnostics.values()):
reason(refusal)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Count each accumulated proof refusal only once

When an early unit has a projection mismatch, or reference loading records no_job, diagnostics retains that reason while subsequent valid units are processed. Because this loop is inside the unit loop, it emits the same earlier refusal again after every later unit; one missing reference alongside three valid units produces three no_job increments. resolver_reason() directly increments the new proof-refusal counter, so the reported refusal rate depends on unrelated successful-unit count rather than actual refusals. Emit accumulated reasons once after iteration, or emit only newly encountered refusals for each unit.

Useful? React with 👍 / 👎.

Git-on-my-level and others added 3 commits November 16, 2026 14:46
Run current-revision identity observation through the existing owner-recognition completion callback. Keep optional observer imports and invocation inside an exception boundary so capture accounting and persistence callbacks still complete.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve both the original identity-evidence kill-switch budget and main's reconnect rollout/grace budget entries. Keep main's auto-merged changes, including AI-profile scheduling, alongside isolated identity telemetry.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Retain the newly merged sync dedupe and monitoring corrections without changing the resolved speaker-evidence budget or isolated identity observation.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 477780a594

ℹ️ 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".

bool(existing.get('transcript_segments_compressed')),
require_decryption=True,
)
return expected == transcript_membership(current)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Compare equivalent transcript views in the membership fence

When a batch conversation with a confirmed transcript correction is reprocessed, get_conversation() projects the corrected text through home_titles.project_home() and transcripts.project(), so the resolver stamps a digest of that corrected text. This helper instead hashes the strictly decoded stored transcript, which deliberately retains the original text. The digests therefore differ without any concurrent change, and persist_processing_result_with_lifecycle() rejects every attempt as stale, preventing regenerated notes from being committed. Compare the same canonical or correction-projected transcript representation on both sides.

Useful? React with 👍 / 👎.

def load(uid, conversation, deadline, *, cache, clip_seconds, extract, max_attempts, reason):
# Import only on this admitted path; reconstruction is shared with the
# final pass, but its GPU runner, budget reservation and admission are not.
from utils.conversations import final_pass_batch as batch

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Move the shared reconstruction import to module scope

load() adds a function-local import of the final-pass implementation, and the new membership and observation helpers introduce the same pattern. This directly violates backend/AGENTS.md's “All imports at module top level — never inside functions” rule. Declare these dependencies at module scope; if importing the whole final-pass implementation would introduce unwanted initialization or a cycle, extract the shared read-only reconstruction helpers into an import-safe module rather than using function-local imports.

AGENTS.md reference: backend/AGENTS.md:L168-L168

Useful? React with 👍 / 👎.

Comment on lines +3 to +4
Sync-on authoritative batch resolution defaults to original-unit evidence under
`BATCH_ORIGINAL_IDENTITY_EVIDENCE_ENABLED`. Set it to `false` to restore the

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add the required speaker-pipeline change note

backend/AGENTS.md requires speaker and conversation-lifecycle changes to “add a note under docs/listen_pusher_pipeline/changes/ in the same PR.” This default-on evidence path and membership fence qualify, but repository-wide documentation searches for the new switch find only this operational runbook and the flag registry, not a dated pipeline change note. Add the required note and link the corresponding pipeline contract section so this behavior and rollout change are included in the maintained pipeline history.

AGENTS.md reference: backend/AGENTS.md:L164-L164

Useful? React with 👍 / 👎.

Comment on lines +1610 to +1611
conversation.speaker_resolution = ConversationSpeakers(status='unavailable', version=RESOLUTION_VERSION)
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve owner-safe abstention on unavailable original evidence

If a conversation mixes a batch unit with automatic sync_embedding owner claims from two independent sync: scopes, this unavailable-endpoint return leaves both claims intact. Previously the no-audio branch called _without_resolution(), which specifically withdrew such competing automatic claims through its len(sync_owners) > 1 guard; the new no-vector and error exits bypass that cleanup too. With the final pass disabled and speaker evidence in its default shadow mode, those uncorroborated owner labels now reach summarization and memory attribution. Reuse the owner-safe abstention logic for unavailable-original-evidence outcomes.

Useful? React with 👍 / 👎.

Comment on lines +148 to +150
vector = extract(
clip, 'batch_voice.wav', timeout=min(10, deadline - time.monotonic()), use_cache=False
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Retain valid unit evidence after an embedding request fails

If a later unit's embedding request raises httpx.HTTPStatusError while budget remains, that exception is not handled by load()'s ArtifactReadLimit/TimeoutError handler. It escapes into _resolve_original_batch()'s whole-pass handler, discarding earlier verified vectors and skipping the upload of already-computed cache entries. Unlike the previous _embed_missing() path's per-clip failure isolation, one transient request failure now prevents otherwise usable identification when the final pass is disabled or during an identity-only retry, and subsequent attempts repeat successful model calls. Abstain on the failed label while retaining and revalidating successful evidence.

Useful? React with 👍 / 👎.

Remove nine unconsumed families from the four in-cluster exporter bridges. Retain their explicit names in the sync GMP scrape for direct runbook queries, leaving the conversation-family bridge unchanged. Verify direct retention and bridge exclusion in the PR-added availability test; keep the existing transport contract files unchanged.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 45b796a1bb

ℹ️ 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".

Comment on lines +1211 to +1212
if batch_resolution and original_evidence_enabled():
_resolve_original_batch(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve non-unit evidence in mixed batch conversations

For a sync-on conversation containing both an authoritative batch unit and ordinary live or sync: segments, this conversation-wide return replaces evidence extraction for every segment. However, batch_identity_evidence.load() enumerates only batch_unit_scope() units, so _resolve_original_batch() abstains the non-unit segments even when their retained playback windows are fully verified. The previous manifest resolver could embed and link those segments, and final_pass_batch._run() also restricts its covered set to batch units, so the final pass cannot recover them. Preserve the existing bounded window extraction for non-unit members while replacing extraction for batch-unit members; otherwise mixed conversations lose previously available identity and grouping coverage.

Useful? React with 👍 / 👎.

)
retained = [r for r in (conversation.speaker_match_scores or []) if r['stage'] != 'resolution']
conversation.speaker_match_scores = match_scores.merge(retained, result.match_scores)
resolver_reason('resolved' if result.coverage >= MIN_RESOLVED_COVERAGE else 'partial')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve existing resolver metrics on the replacement path

With the new switch enabled, sync-on batch calls return before the existing OMI_CONVERSATION_SPEAKER_RESOLUTION_TOTAL, OMI_CONVERSATION_SPEAKER_RESOLUTION_REASONS_TOTAL, and OMI_CONVERSATION_SPEAKER_RESOLUTION_VOICES emissions, and this helper never emits them. resolver_reason() updates different diagnostics, so the default-on cohort disappears from the existing completion/partial-rate counters and input-versus-resolved voice histogram used by backend/docs/runbooks/batch-conversation-speakers.md. This makes rollout comparisons misleading rather than showing the replacement path's outcomes. Emit the existing outcome, reason, and voice observations from the new path as well, including unavailable exits.

Useful? React with 👍 / 👎.

Git-on-my-level and others added 2 commits November 16, 2026 16:08
Keep main's privacy and provider metric filters intact while retaining the nine direct-GMP identity families. Preserve every main registry entry and keep the unchanged identity switch in the active flags list.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep metric values and invalid-input refusal unchanged while routing closed enum members through reason_label. Rebuild stale speaker-result metadata with its typed model without changing conversation lifecycle status.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d41741c17

ℹ️ 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 details.get('reason') == 'diarizer_unconfigured':
from utils.observability.owner_recognition_diagnostics import final_pass_availability

final_pass_availability('dependency_unavailable')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid recounting dependency failures during terminal reporting

For a diarizer_unconfigured failure in the normal direct or queued speaker-pass flow, this increments dependency_unavailable when the pass fails, and settlement then calls final_pass_retry._terminal(), which invokes record_final_pass_failure(**result) again inside terminal_metrics(False). That context only disables count_terminal(), so this new availability counter increments twice for one invocation while admitted increments once. This inflates the dependency-failure rate used by the new rollout measurements. Emit this observation at the invocation boundary, or suppress it during terminal-result reporting.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8889121a9e

ℹ️ 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".

used_windows = []
segments = {s.id: s for s in conversation.transcript_segments}
try:
for item, pcm, words, validate in batch.decode_unit_evidence(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid spending the read budget again on cached unit PCM

Even with time left on the deadline, an unchanged sync-on recording exceeding the 128 MiB artifact budget cannot make progress across retries when the final pass is disabled. decode_unit_evidence() downloads each unit's result and PCM before the centroid-cache lookup, so every attempt rereads the same cached prefix and stops at the same byte limit. A synthetic 72-unit, 91-minute input remained at 55 covered units across three attempts, with 55 cache hits and no new embeddings on attempts two and three. Unlike the previous pending-only read path, the remaining units can never acquire evidence. Revalidate cached references and geometry without fetching their PCM, or otherwise prioritize unresolved units while retaining verified cached evidence.

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit 1ed16ca into BasedHardware:main Nov 16, 2026
68 of 70 checks passed
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