Skip to content

fix: require overlapping shared sentences for capture grouping - #21882

Merged
Git-on-my-level merged 18 commits into
mainfrom
lane/capture-shared-speech
Oct 16, 2026
Merged

Git-on-my-level merged 18 commits into
mainfrom
lane/capture-shared-speech

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

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.md for the contract, bounds and full per-class calibration.

CAPTURE_SHARED_SPEECH_MODE=off|shadow|on defaults 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.

  • 88 synthetic matcher/grouping/storage cases;70 existing group/call cases pass.
  • Canonical inventory suite13tests and mobile-verify9journeys pass (clean98a640e,0failures/0skips).
  • Repository source preflight43checks, full backend typecheck0errors, runtime image source closure and formatting passed on11610e3. Repeat push checks and exact-head terminal CI gate the updated main merge.
  • CI197d787 exposed an unrelated inventory association false positive in 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-only kind:none changelog 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.

Failure-Class: FC-same-speech-captured-twice-surfaces-twice
Failure-Class: FC-same-speech-captured-twice-surfaces-twice
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 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-16T20:04:30.381680Z de037f8 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: 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)

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 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 👍 / 👎.

Comment on lines +236 to +237
outcome = 'applied' if group_id else 'conflict'
record_product_event('capture_group_joined', outcome=outcome)

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 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 👍 / 👎.

Comment on lines +230 to +234
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,
},

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 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 👍 / 👎.

@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: 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".

Comment on lines +297 to +300
expected_group_revision=expected_revision,
join_guard=shared_speech_group_guard,
)
outcome = 'applied' if group_id else 'conflict'

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 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 👍 / 👎.

Comment on lines +254 to +256
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'

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 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.
…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
@Git-on-my-level
Git-on-my-level merged commit 797b8c5 into main Oct 16, 2026
57 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/capture-shared-speech branch October 16, 2026 20:25
Git-on-my-level added a commit that referenced this pull request Oct 16, 2026
…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
Git-on-my-level added a commit that referenced this pull request Oct 16, 2026
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.
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