Repository navigation
fix: require overlapping shared sentences for capture grouping - #21882
Conversation
Failure-Class: FC-same-speech-captured-twice-surfaces-twice
Failure-Class: FC-same-speech-captured-twice-surfaces-twice
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: 1bfd882f38
ℹ️ 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".
| candidate = capture_record(conversation) | ||
| if candidate is None: | ||
| return | ||
| speech_mode = shared_speech_mode(uid) |
There was a problem hiding this comment.
Update the owning pipeline map for the grouping contract
This adds three rollout variables and changes capture-group selection across backend/listen/pusher finalization paths, but backend/docs/listen_pusher_pipeline.mdx still describes only the prior shared_speech.py matcher, its configurable thresholds, and the incumbent call policy. That leaves the repository's owning overlap env/wire contract inaccurate for rollout and incident response; document the new mode/cohort variables, host coverage, matcher behavior, and replacement of complementary-call grouping in that map in this change.
AGENTS.md reference: backend/AGENTS.md:L157-L159
Useful? React with 👍 / 👎.
| outcome = 'applied' if group_id else 'conflict' | ||
| record_product_event('capture_group_joined', outcome=outcome) |
There was a problem hiding this comment.
Preserve re-summary shadow submissions on group expansion
When mode == 'on' and this join adds the arriving capture to an existing group, the replacement path records the join but never invokes submit_resummary. The incumbent path explicitly submits that EXP-003 materiality question when exactly one side was already grouped, while the later submit_same_scene call is a different experiment decision and cannot replace it. Consequently, enabling this rollout silently removes re-summary samples for the selected cohort and biases the experiment readout; retain the pre-write group comparison and submission around successful expansions.
Useful? React with 👍 / 👎.
| expected_windows={r.conversation_id: (r.started_at, r.finished_at) for r in (candidate, other)}, | ||
| expected_fingerprints={ | ||
| candidate.conversation_id: own_fingerprint, | ||
| other.conversation_id: fingerprint, | ||
| }, |
There was a problem hiding this comment.
Fence lock-partition changes in the join transaction
When one capture is locked or unlocked after these decrypted snapshots are read but before join_capture_group commits, the matcher approves the old equal is_locked values while the writer fences only windows and transcript fingerprints. Its transaction rechecks deletion, discard, and completion status, but not lock-partition equality, so this race can persist a group spanning locked and unlocked captures despite the new matcher's explicit compatible-lock-partition requirement. Pass the observed lock state into a transaction-time precondition, as is already done for windows and transcripts.
Useful? React with 👍 / 👎.
Failure-Class: FC-same-speech-captured-twice-surfaces-twice
Failure-Class: FC-same-speech-captured-twice-surfaces-twice
Failure-Class: FC-same-speech-captured-twice-surfaces-twice
Failure-Class: FC-same-speech-captured-twice-surfaces-twice
Failure-Class: none
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a90a14dc4
ℹ️ 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".
| expected_group_revision=expected_revision, | ||
| join_guard=shared_speech_group_guard, | ||
| ) | ||
| outcome = 'applied' if group_id else 'conflict' |
There was a problem hiding this comment.
Refresh group state after the first applied join
When one completion matches multiple previously ungrouped captures, the first successful write creates a group at revision 1, but the cached own/own_group state remains ungrouped for the next loop iteration. That iteration therefore passes expected_group_revision=0, so the transaction rejects it and the remaining matching capture is never added unless another finalization happens. Refresh the cached group snapshot—or update its full membership and revision—after an applied join before evaluating the next candidate.
Useful? React with 👍 / 👎.
| if not incumbent and capture_group_containment_mode() == 'on': | ||
| containment = measure_capture_containment(own, row, mode='on') | ||
| incumbent = containment.would_join and containment.basis == 'full' |
There was a problem hiding this comment.
Preserve attribution for incumbent containment replay
When CAPTURE_GROUP_CONTAINMENT_MODE=on and the trigram rule rejects a pair that the incumbent containment rule would accept, this replay always reports current_would_join=false: get_shared_speech_snapshot deliberately strips is_user and speaker fields, while measure_capture_containment requires is_user is True to build its eligible utterances. This biases the rollout comparison against the incumbent containment policy; retain the attribution needed for this replay or report the incumbent verdict as unknown instead of false.
Useful? React with 👍 / 👎.
Failure-Class: none Preserve invalid-payload rejection while making the generated wire decoder association visible to the existing schema inventory.
Failure-Class: none
…peech # Conflicts: # config/feature-flags.yaml
…peech # Conflicts: # config/feature-flags.yaml
…peech # Conflicts: # app/lib/backend/http/api/users.dart
…peech # Conflicts: # backend/docs/listen_pusher_pipeline.mdx
…peech # Conflicts: # backend/docs/feature-flag-registry.md
…1931) Declare explicit shared-speech off values on the four production Cloud Run services before shadow qualification. Set `CAPTURE_SHARED_SPEECH_MODE=off` and `CAPTURE_SHARED_SPEECH_PERCENT=0` on backend, backend-sync, backend-sync-backfill and backend-integration. The mode already resolves to off, so incumbent behavior, IO and logs remain unchanged. GKE and every other runtime setting remain unchanged. The current deploy action defaults to merging environment variables, and the sidecar attachment preserves extra environment entries. A rollback to a feature-bearing source that merely omits the new keys would retain a later shadow value. This release gives the normal `release_sha` rollback an explicit off/0 target while retaining the recent Firestore incident controls. [Action contract](https://github.com/google-github-actions/deploy-cloudrun/blob/v3/action.yml#L83-L91). #21882 is merged; the regular 6d64800 Cloud Run train carries the reviewed feature dark. #21930 remains unmerged. Deploy this explicit-off baseline through `bin/omi-deploy-prod wait-eligible` then `cloud-run`, approving only this owner's run, and complete its >=15minute watch. Then merge the separate Cloud Run-only shadow config and prepare rollback to this off source. Stop at shadow; do not activate on for any account. No dedicated Pusher/listen deployment or workflow changes. Validation: regenerate source composition and registry, compare parsed documents after removing exactly the eight authorized literals, runtime preflight, repository preflight and exact-head CI. The feature completed five read-only agentctl codex/gpt-6-luna reviews with no final feature blockers. This PR changes literals and the runbook only, with no material code changes requiring another Luna review under the coordinator's instruction. ## CI parser repair and rollout hold Exact-head CI on the preceding merge passed the containment assertions but exceeded the unchanged1-second CPU ceiling while parsing the expanded runtime manifest (1.01seconds). Use PyYAML's C-backed SafeLoader when available, retaining the Python SafeLoader fallback. All assertions and timing budgets remain unchanged. One-off parity checks produced identical values for the full manifest, registry and four chart fixtures; the existing policy file passed64tests with the same1.0/0.1fail/warn limits. A fresh read-only agentctl codex/gpt-6-luna review of exact95f75c869f7ad2ee57deb83189755b0023ae6454 found no blocking P1/P2 issues and independently verified seven parsed inputs plus composition; outcome is recorded in the review comment. Deploy this explicit-off baseline under David's standing grant through the normal checked-in Cloud Run workflow, whose existing backfill service profile is40instances (live snapshot32). This PR does not change that workflow or enable shared-speech computation. The release includes reviewed upstream repeat-work cuts. Measure the postdeploy worker against the captured degraded baseline and retain the prior off source as rollback. Shadow remains held until the worker watch qualifies; its rollback must use this deployed explicit-off source, rather than the older omitted-key source. ## Product invariants affected - [INV-MEM-4](product/invariants/memory-promotion-authority.md): canonical promotion remains the sole Long-term authority. All intake, consolidation, promotion, scheduler and projection settings are preserved; only shared-speech off literals are added on four Cloud Run hosts. Failure-Class: none
Enable deterministic shared-speech shadow evaluation on the four production Cloud Run processing services: backend, backend-sync, backend-sync-backfill and backend-integration. Set `CAPTURE_SHARED_SPEECH_MODE=shadow` and `CAPTURE_SHARED_SPEECH_PERCENT=100` at those service overrides only. The UID allowlist stays empty. Shadow preserves incumbent grouping and adds bounded evaluation with identifier/numeric decision logs. Pusher and backend-listen retain their off default and receive the implementation through their regular release train. No account is activated in on mode. Existing groups, transcripts, memories and effects retain their existing behavior. Jev and smart merge settings are unchanged. This follows #21882 and the explicit-off rollback baseline #21931 (merged8b24990a68bd00539d36ed5f09f2e12d7e80047d), under David's coordinator-authorized Cloud Run dark → shadow qualification. The feature completed five read-only agentctl codex/gpt-6-luna review rounds, with no final feature blockers. A sixth read-only review of the explicit-off baseline and its safe YAML test-loader repair found no P1/P2 issues; that unchanged code is now in main. This PR changes literal configuration/rendered documentation only and leaves that reviewed implementation unchanged; the coordinator requires another Luna review only for material code changes. Calibration remains insufficient for activation: David TP4/13 and FP0/6; September benchmark TP1/56 and FP0/40, with zero held-out positives accepted. After deployment, watch at least15minutes against the predeploy baseline and compare at least3hours of shadow decisions to the incumbent using counts only. Validation: regenerated the canonical runtime manifest and feature-flag registry. Removing exactly the eight authorized Cloud Run fields reproduces both prior parsed source and compiled manifests; dev/GKE/all other settings are identical. Runtime-env preflight passed315tests; PR preflight passed20checks, and the normal push gate passed. Exact-head CI at48a1bb2890ba4e2ece1197a53de270f3585f88cb completed32successful checks and25automatic out-of-scope skips, with no failure/pending/cancellation; re-check after a fresh main fetch before merging. Deploy through `bin/omi-deploy-prod wait-eligible` then `cloud-run`, approving only this owner's run. The actual eligible explicit-off rollback source is now `aa87e9fe37f12a55978b8567db9d41fa28a6ce39` (contains #21931 plus current Firestore controls and queued-epoch repair), served100% on allfour via regulartrain [38976700010](https://github.com/BasedHardware/omi/actions/runs/38976700010). Its exact normal-workflow rollback commands are written before any shadow dispatch; the owner did not dispatch or approve that other operator’s train. An older release that omits the keys does not reset shadow because the deploy action merges environment variables. The explicit-off watch22:56–23:11UTC completed with5minute ingestion grace, complete queries, allfour explicitoff/0/emptyallowlist, and zero matcher activity/errors. Allfour overall5xxrates were below the recent baseline (backend0.0127%vs0.0219%;sync0.0473%vs0.0511%;backfill1.2653%vs1.5431%;integration0.0159%vs0.09%). Backfill remains degraded. A separate memory-search timeout burst8/9requests occurred in the first5minutes with no later requests on that route; predeploy had0requests, so causality cannot be established and recovery is not claimed. This concern remains tracked; sampled traceback module frames did not implicate new shared-speech modules. Owner assessment qualifies bounded non-mutating Shadow with the exactOffrollback ready, while retaining those concerns in the watch. Never enableOn. Full timings, revisions and aggregate watches are recorded in the task report. ## Product invariants affected - [INV-MEM-4](product/invariants/memory-promotion-authority.md): canonical promotion remains the sole Long-term admission authority. Regeneration preserves every memory intake, consolidation, promotion, scheduler and projection setting. The only runtime changes are eight shared-speech shadow literals on four Cloud Run services; shadow performs no new group or memory writes. Failure-Class: none This is non-mutating rollout configuration with no new failure-class implementation.
Overlapping captures can currently group on matching text found anywhere in their transcripts, while same-source duplicates are excluded. Add a default-off deterministic rule requiring ordered, time-aligned sentences and enough matched speech inside the actual overlap. It uses the existing reversible capture-group writer; transcripts, summaries, memories, tasks and source records remain independent.
The matcher ignores speaker labels and tolerates isolated bad timing by excluding that line from evidence and charging its words as unmatched vocabulary. Hard storage/CPU limits abstain. A single-snapshot reader bounds decryption/decompression before parsing, excludes mutable correction overlays, and fences all member fingerprints/windows, group revision, eligibility and locks at commit. New entrants must independently match every existing member. See
backend/docs/operational/capture-shared-speech.mdfor the contract, bounds and full per-class calibration.CAPTURE_SHARED_SPEECH_MODE=off|shadow|ondefaults off, with an empty UID allowlist and 0% cohort. Shadow preserves incumbent grouping and logs identifiers/numeric verdicts only. On can admit proven same-source duplicates and reject unsupported automatic folds, but is not qualified by this evidence. Existing groups remain intact; Separate stays sticky. Jev and smart merge remain separate.Calibration
Original timed transcripts matched all 29 David cards locally. Exclude 10 unsure labels; none folds. Among 19 decisive pairs (13 same/6 different), TP4/FP0: precision100% (95% Wilson51.0–100), recall30.8% (12.7–57.6). Cross-source TP2/5, FP0/2; same-source/same-device TP2/8, FP0/4. Both high-bag-overlap negatives remain apart.
September agent benchmark:96 decisive pairs (56 same/40 different), TP1/FP0: precision100% (20.7–100), recall1.8% (0.3–9.5). Held-out TP0/20, FP0/14. No folds on its8 excluded pairs. Captures correlate and the benchmark's older same-scene target differs; do not pool these cohorts or infer fleet safety from zero observed errors. Concurrent common broadcast speech remains a semantic limitation. Private data stays local; only aggregates are published.
Review and validation
Five agentctl reviews used codex/gpt-6-luna with read_only access. Boundary evidence, all-member eligibility/lock races, mutable corrections and pre-matcher unbounded decoding findings were fixed. Final core review9a90a14 found no feature blockers. Final API-boundary review98a640e8172 found no blockers and confirmed equivalent validation/type promotion. Dark/shadow qualified; on unqualified. Subsequent changes are the documented internal changelog marker and upstream merges/registry rendering, with no material owned feature change. Main independently landed the canonical recap decoder fix (#21925); this branch now takes that upstream file exactly.
getDailySummaries. Main subsequently fixed the canonical typed-client boundary in fix(app): migrate #21829 decode site to typed client (unbreak backend unit inventory) #21925, and this branch adopts that upstream source unchanged. The inventory gate remains unchanged. The internal-onlykind:nonechangelog fragment makes no user-facing behavior claim.Authorized production qualification
David's coordinator narrowed shipping to the four Cloud Run hosts: backend, backend-sync, backend-sync-backfill and backend-integration. After exact-head green CI and merge commit, use workspace
bin/omi-deploy-prod wait-eligible/cloud-run, approving only this owner's run. Prepare previous eligible release_sha rollback before dispatch and watch >=15min for5xx, fixed error signatures and effectiveoff.Then a separate runtime_env config PR enables shadow on Cloud Run only, followed by another Cloud Run deploy/watch and >=3h clean shadow comparison. Stop at shadow; no account may be enabled on. Pusher/listen remain off and receive dark code via their regular train owned by others; no dedicated deployment is dispatched. The documented context-qualified Pusher Helm fallback is incident-only.
Updated main througha4cce4c3099. Preserved all314 upstream flag entries unchanged and all3 shared-speech entries, placing ours beside the existing capture-group flags to avoid recurring independent top-of-file additions. Rendered with
--as-of 2026-10-16; no feature predicate changed. Related:#14835.Product invariants affected
none
Failure-Class: FC-same-speech-captured-twice-surfaces-twice
UI-Evidence: none -- Equivalent API payload validation at an existing generated decoder; no rendered UI changes.