Skip to content

fix(sync): enforce cohort dedupe and measure widening gates - #23925

Merged
Git-on-my-level merged 6 commits into
mainfrom
lane/syn003-gate-telemetry
Oct 29, 2026
Merged

Git-on-my-level merged 6 commits into
mainfrom
lane/syn003-gate-telemetry

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Problem

SYN-003 W5 timing triage attributes 1,084.3 s (99.9%) of the 1,085.5 s live-row overlap to legacy intake appends, 0 s to batch projection, and 1.2 s to a donor bridge. All of that snapshot overlap was written in W5. This is timing attribution, not a measured lexical would-drop fraction. The fleet safety-WAL switch bypassed the cohort incoming capture-proof + lexical policy. W5 also could not certify widening gates 4 or 5: 76 nonempty batch assignments into seven existing live rows produced zero fresh-append observations, and ordinary stamp growth was not measured. Explicit targets rejected for device mismatch also created sync rows without discovery, reporting created_unknown/discovery_skipped.

Fix

  • Consume append, ordinary stamp and refusal markers once at the shared post-commit assignment boundary, before indexing/followup, for legacy intake and batch projection. Receipt replays and failed commits emit nothing new; repeat observations carry zero appended seconds.
  • The admitted lineage policy composes with the shipped fleet safety-WAL fuzzy dedupe on live targets: capture-proven lexical drops run first, then exact retries, then the unchanged fleet matcher on the survivors. Both passes contribute to final append, live-overlap and repeat-drop seconds. Non-cohort users retain the fleet path. Capture-refactor serving proposals remain subordinate to lineage lexical novelty checks and may not drop a lexical abstention. The incoming proof helper now uses the existing committed-transcript run/lifetime validator for persisted source-frame receipts, instead of the WAV-context validator that always abstained without WAV context. Receipt-only evidence remains unproven; audio trimming still requires WAV context.
  • Attach numeric speech observations to each content plan after dedupe, using final survivors and the frozen eligible original-live timing union. Fleet safety dedupe and lexical-dedupe-off paths remain measurable. Invalid/over-budget timing is unknown. The bounded lineage_admitted boolean lets widening readers exclude non-cohort fleet observations without identifiers. An abandoned live plan cannot leak measurements onto a sync size rollover.
  • Restart rejected explicit-target assignments for one bounded metadata discovery, rechecking caller/privacy/deletion fences. Hints are observation-only and cannot become targets; gate 3 observes real clear/overlap/unknown lookup results.
  • Keep the Cloud Tasks concurrency probe inside the worker-owned paid STT leaf. Current main (fix(backend): hold sync full processing until merges settle #23919) defers full note processing for merge settlement, so a gate at that later processor cannot test the upload worker lease. The gauntlet still requires HTTP 409 for the concurrent delivery and exactly one STT invocation. Early responses and gate failures report bounded HTTP/status and stage booleans, with no response text, paths or fixture identities.

Finite zero-length donor intervals now contribute 0 s without invalidating the bridge; inverted/nonfinite timing stays unknown. They remain stored and never become deletion proof.

The missing measurements came from caller-owned emission and dedupe-owned timing. The shared consumer and real batch-entry regression tests prevent that class across writers and policies. Existing SYNC_LINEAGE switches, allowlist and batch admission retain their semantics. No content or identifiers enter telemetry.

Validation

  • 6,693 passed across 195 files through backend/test.sh: sync, lineage, live-dedupe, batch pipeline/projection, capture, safety-WAL and processing-hold suites, including the gauntlet diagnostic/wiring regressions.
  • 10,306 passed across 396 files: the exact PR CI shard-4 contract, backend/scripts/run-unit-ci.sh --changed-files <paths> --shard 6/4, selecting the full 2,367-file backend suite before sharding.
  • The original test_revision_does_not_zero_live_slop remains unmodified and passes. Its new cohort variant uses no capture proof and checks one append line with 0 appended seconds, 0 live-overlap seconds and 16 repeat-drop seconds. The capture-proven repeat plus novel-speech regression remains intact and passes in capture off, shadow and serve modes.
  • The full local npm run test:sync-cloud-tasks-stack:emulator gauntlet passed with main fix(backend): hold sync full processing until merges settle #23919 integrated and the processing hold enabled. Before moving the probe, the same merged code reproduced CI's failure: the worker correctly returned HTTP 200 / done after STT while full note processing stayed held. The provider-boundary regression failed before the probe fix and passes after it.
  • make preflight: 36 checks passed. Full backend typecheck: 0 errors.
  • Tests and preflight run at nice -n 15 through workspace bin/omi-heavy, retaining file isolation and normal timing/network guards. Ambient Firebase/service-account credentials are removed; unit tests use /dev/null ADC, a synthetic project and the CI-default Redis port, while integration uses isolated loopback Firestore/Redis and deterministic provider leaves. No production endpoint or GCP tier was used.

Rollout and rollback

Ships on, no new flag, no cohort widening. Existing gating remains unchanged. Rollback: revert this PR. No production data or GCP access was used, and this PR does not deploy or rewrite historical observations. Markers remain transient, with at-most-once emission attempts and no durable outbox; lost observations still block widening as unknown.

Product invariants affected

none

Failure-Class: new

New class: FC-commit-observation-bypassed-by-writer; its reusable guards exercise the real batch entry point, policy independence, replay/failed-commit silence, invalid timing, and rejected-target discovery with fence rereads.

View guided diff Turn on auto-fix

🤖 Generated with Claude Code

Run proof-gated lineage incoming dedupe ahead of fleet fuzzy policy for the
existing cohort, using committed transcript proof rather than WAV context.
Share post-commit append/stamp observations across intake and batch writers,
and restart rejected targets for bounded observation-only discovery.

Failure-Class: new
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 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-29T00:07:35.533005Z 2c97ea0 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.

Run lineage lexical and exact-retry passes before the unchanged fleet fuzzy matcher on their survivors. Preserve capture-refactor proposal precedence and measure the final combined plan.

Failure-Class: new
Full note processing now waits for merge settlement on main. Hold the STT leaf inside the Cloud Tasks lease so the concurrency gauntlet still proves Redis fencing and exactly one paid invocation.

@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: 2c97ea04be

ℹ️ 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 +676 to 677
survivors,
fuzzy_live_overlap=fleet_live_dedupe,

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 Estimate the fleet clock before removing lexical anchors

For cohort uploads with partial capture proof, passing only lexical survivors to the fleet matcher can disable deduplication that previously succeeded. _fuzzy_survivors in backend/utils/sync/merge_dedupe.py requires two exact-text anchors to estimate the clock offset; the preceding lexical/exact-retry pass can remove those anchors. A synthetic three-line replay with capture proof for the first two lines produces zero survivors on the previous fleet-only path, but this composition appends the third duplicate because only one anchor remains. Estimate the offset from the original incoming batch and reuse it when filtering the survivors so stronger capture proof does not cause other repeated speech to be appended.

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit b8ed4da into main Oct 29, 2026
57 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/syn003-gate-telemetry branch October 29, 2026 00:21
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