Skip to content

fix(sync): dedupe live repair speech and resolve overlapping generations - #20427

Merged
Git-on-my-level merged 39 commits into
mainfrom
lane/sync-lineage-dedupe
Oct 3, 2026
Merged

Git-on-my-level merged 39 commits into
mainfrom
lane/sync-lineage-dedupe

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Round 11 — fixes complete, pushed and full CI green; DRAFT for independent review

Fixes 1–4 are separate commits: c99a0c0701, 3a084d1a14, f8fa58ecc3, fd6b87c72a. Pushed HEAD is 9d8c5a64f4c7fc9775c2c7a43e3b84318ce623bd after merging current main d4062b9ee8 and restoring unintended hook formatting; app/ is byte-identical to merged main. Final merged-head local gates passed: 491 tests, 17/17 killed mutations, canonical pyright zero errors, make preflight 49 checks and PR metadata preflight 46 checks. First guarded push exited 0 after Bounded pre-push gate passed; local/remote equality confirmed, no CPU retry or exit 141. Full final-head CI is GREEN, including the explicitly dispatched --all four-shard backend suite, guardrails, PR-selected units, static contracts, emulator proofs, hermetic E2E/stack gauntlets, metadata/hygiene and CodeQL. No CPU-only reds or reruns. PR remains DRAFT/MERGEABLE for independent review; deployment/admission/widening remain coordinator-owned.

Summary and safety

  • Fix 1 migrates the ten stale allowlist assertions to SYNC_LINEAGE_S1_REQUIRED=true without weakening S1 checks: absent S1 retains pre-lineage whole-batch routing; explicit valid-S1 variants preserve per-segment, allowlist/master, retry and enrichment-debt coverage. Its local fail-closed test guard denies real Firestore getters/constructors while StrictFirestore injection remains available.
  • Fix 2: committed mode never calls receipt-only source_map.snapshot() when proof is unavailable. Missing notes, conflict/incomplete state and real 4096-byte envelope overflow persist explicit unknown evidence while speech still commits. Flag-off keeps the existing owner-filtered receipt snapshot byte-identical.
  • Fix 3: source frames are proven only by recognized Deepgram word or finalized Soniox token intervals, each <=2 seconds, max 256 intervals per segment. Map independently through accepted sends, round inward, merge only overlap/touching ranges, and fill ZERO positive gaps. Segment-only spans abstain. Private timing fields do not enter transcript queues or persistence. The omitted-middle-phrase test drives the real producer mapping and sync/VAD/STT/intake path and asserts the new speech actually persists.
  • Fix 4: stop note work at 512 stored notes and 512 examined callback entries, mark incomplete, preserve earlier notes and leave speech admission to the existing bounded transcript queues. Large invalid/duplicate callbacks are also bounded; an already-full note map does not consume the next callback iterable.
  • No Flutter, speaker_resolution, audio_placement, smart-merge, assignment/bridge, workflow or other-worktree edits in this round. No production reads, deploy, admission flip or widening performed.

All round-11 backend tests run only via backend/test.sh file lists, with ADC/service-account vars removed, fresh CLOUDSDK_CONFIG, synthetic project, FIRESTORE_EMULATOR_HOST=127.0.0.1:8085 and loopback metadata endpoint. No bare pytest or real Firestore is permitted. The old stopped saved-row ambiguity witness is NOT rerun; only the already fully stubbed real-process deferral witness is used. New mutation execution adds a fail-closed Firestore constructor/getter guard and records runtime bytecode installation/restoration plus source hashes.

Environment deviation disclosed: the owned .venv disappeared during initial fix-3 validation, which incorrectly used the fenced shared object-store interpreter. That result is not accepted as landing evidence. The owned worktree .venv was recreated from its own lock with sync-python-deps.sh; all final fix-3 tests were rerun there. No shared-checkout change was needed for recovery. No repository archives/copies are created in scratch; evidence is logs.
Historical round-9 safety incident remains disclosed: an optional ambiguity mutant reached an unstubbed Firestore lookup with ambient read-only credentials. It was stopped; COULD NOT DETERMINE whether its read RPC completed, and no returned data was observed. It is not a passing proof. This round uses the stricter isolation above and does not repeat that witness.

Final design

  • Live counts socket-local decoded samples (backend/utils/audio_timeline.py); WAL/VAD starts from the phone-clock basename (backend/utils/sync/pipeline.py). Missing frames, reconnects and provider clocks defeat a universal offset or created_at winner. No clock rewrite here.
  • Speech and committed_transcript_v1 proof commit in the same existing transaction; acknowledge only after a successful live merge. Proof contains source positions, receipt wall windows and bounded root/epoch lifetime history, never transcript text/uid/row/segment IDs.
  • Before VAD/STT, require same provenance/root/epoch/channel/rate, conflict-free complete lifetime history, actual decoded geometry and observed WAL-wall agreement at BOTH intersection edges within 2 seconds. Time agreement rejects incompatible lifetimes; it never establishes identity itself. Receipt alone cannot authorize consumer suppression.
  • Missing/malformed/conflicting/overflowed proof keeps audio. Pre-live, missed, untranscribed and omitted-phrase frames remain; span-only providers intentionally lose suppression recall. Opus decodes before trim. Kept discontinuous intervals stay separate; <=250ms whole-frame context per side may retain edge repeats. Marked trimmed derivatives bypass only the existing 1-second VAD floor, preserving new subsecond speech. Fully committed audio skips providers/enrichment; prior retry enrichment debt still completes.
  • Lexical fallback is dormant on the production intake seam without observed WAL-lifetime context. Exact delivery retry dedupe additionally requires an existing shared nonempty sync: scope; repeated text alone is not identity.
  • Strict AND tolerant multiple-canonical overlap stays pending unless one compatible stamp names exactly one canonical. No created_at guess. Three bounded rereads, then retryable failure/re-upload, not a new duplicate row.
  • Default-on SYNC_LINEAGE_S1_REQUIRED gates per-segment routing on separate admission, complete validated claims for exact uploaded basenames and observed decoded maps. Absent/invalid S1 keeps pre-lineage whole-batch routing, even after eventual allowlist widening. OFF/typo broadens eligibility; it is NOT rollback.
  • Bounds: 32 runs, 16 root/epoch entries, 512 notes, 16 acknowledged generations, 4096-byte envelopes. No new serving query/index shape. Logs remain content-free kept/dropped/context seconds, append/repeat/debt, capped lineage filters/id_probe/span buckets.

Verification so far

Fix 1: 10 failed, 60 passed -> 92 passed; shared lineage 78 passed; WAL 58 passed (round-10 logs). Fix 2: 4 failed, 46 passed with AssertionError: receipt snapshot must not run while committed coverage is enabled -> 50 passed, 13 warnings in 7.99s.
Fix 3 strengthened whole-span mutant: E AssertionError: assert 'new-word-3' in ['live words'] and E AssertionError: assert [] == ['new-word-0'...-word-5', ...]; 2 failed, 58 passed, 56 warnings in 10.85s. Restored owned-env seven-file suite: 215 passed, zero failed. Evidence: .agent-artifacts/sync-lineage-dedupe/r11-fix{2,3}-*.log.
Fix 4 before/after: 6 failed, 49 passed, 13 warnings in 11.72s with E assert 10000 <= 512 -> 55 passed, 13 warnings in 12.24s. Real enqueue still rejects oversized speech batches through its existing capacity error without note-side text loss.
Final merged-head canonical 11-file list: 491 passed, zero failed. Full backend/scripts/typecheck.sh: 0 errors, 12465 warnings, 0 informations. make preflight: 49 checks passed; PR metadata preflight: PR preflight passed: 46 checks in 392.31s. Import purity/module isolation and pinned formatting pass. Logs: r11-merged-{green,pyright,make-preflight,pr-preflight,format,import-purity,stub-check}.log. No guard or CPU timing limit changed.

Executed mutation table — final merged HEAD 9d8c5a6

Exact lead-authored command: backend/.venv/bin/python .agent-artifacts/sync-lineage-dedupe/r11-run-mutations.py --expected-head 9d8c5a64f4c7fc9775c2c7a43e3b84318ce623bd --output-prefix r11-merged. Every row below ran via canonical file-isolated backend/test.sh, with fail-closed Firestore constructors/getters. Each baseline=0, mutant=1 on semantic assertions, restored=0; source SHA256 and installed/restored runtime bytecode hashes are recorded. 4053 backend/config source hashes unchanged and tracked production diff empty. Metadata: r11-merged-mutation-results.log; verbatim logs: r11-merged-mutation-<name>-{baseline,red,restored}.log.

Mutation Baseline / mutant / restored Verdict
disable_audio_suppression 0 / 1 / 0 KILLED
ambiguous_legacy_none (fully stubbed real-process deferral) 0 / 1 / 0 KILLED
drop_new_speech 0 / 1 / 0 KILLED
ignore_audio_flag 0 / 1 / 0 KILLED
ignore_live_dedupe_flag 0 / 1 / 0 KILLED
ignore_listen_flag 0 / 1 / 0 KILLED
ignore_s1_required_flag 0 / 1 / 0 KILLED
ignore_dark_write_flag 0 / 1 / 0 KILLED
ignore_master_flag 0 / 1 / 0 KILLED
ignore_uid_allowlist 0 / 1 / 0 KILLED
leak_text_ids 0 / 1 / 0 KILLED
accept_receipt_without_committed_transcript 0 / 1 / 0 KILLED
accept_cross_lifetime_root 0 / 1 / 0 KILLED
bind_upload_without_s1_evidence 0 / 1 / 0 KILLED
receipt_fallback_in_committed_mode (real live persistence) 0 / 1 / 0 KILLED
whole_span_inference (saved omitted speech) 0 / 1 / 0 KILLED
cap_overrun 0 / 1 / 0 KILLED
New-row verbatim red -> restored: E AssertionError: assert 'source_position' == 'unknown' -> 4 passed, 13 warnings in 7.00s; E AssertionError: assert 'new-word-3' in ['live words'] -> 1 passed, 13 warnings in 5.82s; E assert 10000 <= 512 -> 1 passed, 13 warnings in 9.49s. Guarded push succeeded first try (exit 0), remote equality confirmed; evidence r11-push-attempt1.log. Full final-head CI GREEN: https://github.com/BasedHardware/omi/actions/runs/37156881867 (workflow_dispatch, authoritative --all across all four shards + guardrails + rollup); PR-selected unit https://github.com/BasedHardware/omi/actions/runs/37156847467; static https://github.com/BasedHardware/omi/actions/runs/37156847509; hermetic E2E and Listen/Pusher + Sync Cloud Tasks gauntlets https://github.com/BasedHardware/omi/actions/runs/37156847404; source/hygiene repo checks https://github.com/BasedHardware/omi/actions/runs/37156847566; final metadata https://github.com/BasedHardware/omi/actions/runs/37156957511. Emulator proofs, source-closure, OpenAPI, prod/dev config and CodeQL also pass; mobile/desktop/web execution skips are expected from the net diff. All runs are on 9d8c5a64f4; no failed jobs or CPU-only reds/reruns. No exit-141 transfer this round. Verbatim CI watch/check logs are r11-ci-full-watch.log and r11-ci-prchecks.log.

Flags, services and deploy sequence

C = Cloud Run backend/backend-sync/backend-sync-backfill/backend-integration. L = GKE backend-listen.

  • LISTEN_COMMITTED_CAPTURE_COVERAGE_ENABLED=true on L; immutable listen image + matching Helm rollout REQUIRED. Matching pusher literal is inert; no pusher proof rollout required.
  • SYNC_WAL_AUDIO_COVERAGE_ENABLED, SYNC_LINEAGE_LIVE_DEDUPE_ENABLED, SYNC_LINEAGE_S1_REQUIRED default ON on C. Keep S1_REQUIRED=true; OFF/typo broadens old-client routing.
  • SYNC_LINEAGE_RESOLVE_ENABLED master ON/typo OFF across C+L; keep UID allowlist David-only. CAPTURE_EVIDENCE_V1_DARK_WRITE backend admission defaults OFF and needs separate reviewed config on L plus every C ingress/worker; the mobile define is separate.
  1. Finish fixes, guarded push, final mutations, independent review and full CI; merge commit and verify Release Eligibility/index readiness. Keep admission OFF and David-only.
  2. Roll NEW listen producer image/chart FIRST, then NEW C consumer revisions; admission OFF throughout. Drain mixed versions; verify every served SHA/env. Never admit S1 with an old receipt-authorizing consumer.
  3. Separately review/classify/compose admission in runtime base/overlays + listen Helm with matching inert pusher binding. Once all new code serves, admit listen FIRST, then every C ingress/worker; verify committed proof.
  4. David/coordinator TestFlight build: independently merged root rotation fix(app): keep S1 capture identity safe across WAL resets #20473 plus --dart-define=CAPTURE_EVIDENCE_V1_DARK_WRITE=true; restart capture. No app build/release here; no-S1 historical WALs cannot gain proof retroactively.
  5. Measure >=24h new-S1 acceptance and documented 48h David-only widening gates; only then reviewed empty allowlist across C+L followed by 24h all-user watch. Require <=10% doubled appended speech, zero residual same-device sync-created rows/lost new speech, >=20 bound/split decisions, truncation <=2%, lookup failures=0, no >5-minute stamp stretch, and baseline failure/fence/listen gates.
    Rollback: narrow cohort or master OFF across C+L while retaining S1_REQUIRED=true; no flag rollback undoes appends. No deploy/admission/widening performed.

Coordinator-only remeasurement queries — NOT RUN

Replace START_UTC/END_UTC with the complete new-capture window. Fetch ascending, split saturated windows; no UID/severity filter on these id-free events. Full unchanged queries and caveats: .agent-artifacts/sync-lineage-dedupe/r9-prod-log-queries.txt.

((resource.type="cloud_run_revision" AND resource.labels.service_name=~"^(backend|backend-sync|backend-sync-backfill|backend-integration)$") OR (resource.type="k8s_container" AND resource.labels.namespace_name="prod-omi-backend" AND resource.labels.container_name="backend-listen"))
timestamp>="START_UTC" timestamp<"END_UTC"
(textPayload:"event=sync_wal_audio_coverage " OR textPayload:"event=sync_lineage_append ")

For binding/stretch append (textPayload:"event=sync_lineage_resolve " OR textPayload:"event=sync_lineage_lookup " OR textPayload:"event=sync_lineage_probe " OR textPayload:"event=sync_lineage_stamp_append ") instead of the last line. Logs measure audio/intake attempts, NOT semantic repeats or residual saved rows. Coordinator must inspect authorized before/after saved-row deltas, isolate newly appended sync speech and hand-label repeats despite clock skew; divide repeated appended seconds by all appended seconds and count distinct new same-device/same-origin sync-created rows overlapping live. Do not replace quality gates with dropped-audio telemetry.

Product invariants affected

  • INV-MEM-4: quality kill switches; no new memory promotion authority.
  • INV-MEM-5: capture identity is not task/memory identity; no cohort widening here.
    Failure-Class: FC-offline-merge-clock-offset-dup
    Line-Count-Exception: backend/utils/sync/pipeline.py | 2994 -> 3021 | Thin helper imports, pending fence and two S1 admission call sites; bounded coverage/claim validation remain in focused modules.
    Line-Count-Exception: backend/routers/listen/receiver.py | 2237 -> 2257 | Thin committed-state/receipt-anchor calls and private word-range cleanup; bounded producer/mapping logic lives in small modules.
    Line-Count-Exception: backend/utils/stt/streaming.py | 2322 -> 2324 | One import and one gated word-timing collector call; all validation/mapping lives in the new small committed_words helper.

GUARD CHANGED

Local fail-closed Firestore fixture from fix 1 and scratch mutation execution guard; constructors/getters still raise. No hook, timing limit, budget, S1 admission guard or security policy weakened.

SCOPE ADDED

Required integration follow-ups: merge 7a8d15eb4a brings current main, preserves its Soniox recovery imports and fixes two type annotations; corrective commit 9d8c5a64f4 restores 161 upstream Dart blobs reformatted by the normal merge hook before package configuration existed. Offline lock-enforced bootstrap restored the correct package-manager-generated Dart 3.0 formatter context, and the normal hook then reported 161 files (0 changed). Final app subtree is byte-identical to main d4062b9ee8; no Flutter feature edits, hook changes, bypasses or history rewrites. Private Deepgram/Soniox timing is required for fix 3, not a provider-routing change.

SPEC DIVERGENCE / reviewer risks

Span-only abstention and zero gap fill intentionally favor retaining new speech over suppression recall. Ambiguous generations defer rather than guessing by creation time; no historical repair. Review atomic speech/proof merges, late callbacks, word/token timing accuracy and residual re-transcription loss; root reuse within2s still relies on the app rotation release; wall skew/backlog/context cause missed repeats, and reaching the 512-note socket-lifetime cap stops later note collection until a fresh socket, reducing suppression recall without dropping sync speech. Check enrichment debt/live-write races, ambiguous retry behavior, frozen-main flag-OFF parity and S1_REQUIRED typo broadening. Independent review and authorized quality evidence remain required before merge/widening.

Generated with Devin

🤖 Generated with Claude Code

Git-on-my-level and others added 24 commits October 3, 2026 13:30
Prefer the creation interval proxy among ambiguous strict matches so backdated rollover rows do not create residual sync conversations. Tolerant ambiguity and incomplete lineage still fall back.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
Use bounded conservative transcript coverage despite WAL/live clock skew; preserve novel speech at coincident ranges and protected token changes. Repeat-only repair acknowledges without new writes or enrichment enrollment. Keep the existing uid rollout and a typo-safe kill switch on each sync-intake host.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
Preserve the lexical dedupe decision and original survivor indices while integrating upstream document-size recovery. Re-verified the isolated timing guard and 753 merge-path tests.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
A no-write replay must finish earlier sync work after a downstream failure without manufacturing new transcript writes. Emit append telemetry before external completion callbacks and keep pathological bounds conservative.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
Keep the lane based on the latest fetched trunk without rewriting history.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
An all-repeat repair is not permission to consolidate donors or invent enrichment debt. Decide the canonical live no-op before size rollover and recognize exact retry debt only on content already admitted to that live row.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
Treat actually and explicit correction cues as protected content rather than filler so a repair cannot erase a correction merely because most of its tokens repeat live speech.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
Allow bounded recall and false-drop review on local absolute-time rows without network, Firestore, or provider dependencies. Reuse the same whole-batch lexical and canonical exact-retry functions as intake and print per-segment decisions plus duration totals.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
Distinguish empty lookups from provenance exclusions without logging content or identifiers. A metadata-only recording-id probe explains observable no-row states without changing targets; bucket committed stamp-fallback live extent growth, including additive kill-switch-off telemetry.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
Keep the original slop assertions on the kill-switch-off path while covering conservative short-speech retention with it on. Runtime fixtures now carry the new service binding and still reject its removal; saved-row assertions catch both duplicate creation and lost repair speech.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
Keep absent and uncertain capture evidence on the original audio path; preserve frame clocks and retry material while removing already received audio before VAD.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
Expand driver domains and retain missing-binding rejection assertions for the new consumer switch.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
Keep the legacy VAD floor for ordinary audio while admitting short verified
novel derivatives; saved-transcript tests prove the new tail survives.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
Keep legitimate second utterances despite matching words or wall-clock ranges.
Bound raw capture proof and candidate lookup before expensive matching.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
Authorized synthetic capture proof keeps smart-merge retry fixtures valid
without weakening suppression. The conflicting suites pass; production
smart-merge flattening and bridge changes come only from main.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
Creation time cannot decide backdated buffered audio. Bind strict overlaps
only through a compatible stamp; preserve proven ambiguity across bounded
fresh reads and fail retryably before STT rather than creating duplicates.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
Freeze main for persistence, completion, query and log parity tests. Gate
safe-overlap routing and added diagnostics with the intake switch so rollback
and excluded lineage cohorts retain the original behavior.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
A single oversized replay batch hid production behavior. Replay successive
small intakes, receipt persistence and bounded frame/context plans while
keeping supplied-candidate totals distinct from post-trim STT recall.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
Integrate the upstream pendant custody change without altering lane-authored
backend behavior or the frozen backend rollback reference.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@[email protected]>
Co-Authored-By: Devin Fusion <[email protected]>
Reject impossible decoded prefixes rather than inventing a valid claim.
Valid partial decode prefixes keep the production frame-retention plan.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
A straddling WAL segment must not fall through to an unrelated stamp or a
new sync row when multiple tolerant generations remain compatible.
Require a unique compatible canonical stamp or retain the pending fence.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
Git-on-my-level and others added 2 commits October 3, 2026 23:14
Socket receipt alone cannot prove that live transcription was saved.
Close the shared audio and lexical proof boundary until committed
coverage and capture lifetime validation are available.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
Receipt-only replay must preserve speech, while genuine sync-scoped
retries still leave the saved transcript unchanged.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
Git-on-my-level added a commit that referenced this pull request Oct 3, 2026
## STOP — unrelated trunk is red

Draft only. **Do not merge or ship.** Exact pushed head:
`1c82e2a5426415de1f497ea10de25545a6746571`; identity fix `253d4a0550`,
required mobile changelog `1c82e2a542`.

The owning analyzer gate fails on unchanged
`app/test/widgets/capturing_finish_swipe_back_test.dart:120`:
`PeopleProvider(loadPeople: () async => [])` returns `List<dynamic>` but
the production seam requires `Future<PeopleListResponse?>`. The file is
byte-identical on `origin/main` at task base `8fb7dc1ccf`. A narrow
retry with `TZ=UTC`, artifact-local `TMPDIR`, and pinned Flutter 3.44.5
reproduces the diagnostic. GitHub's Ubuntu/Flutter 3.44.5 analyzer
independently confirms the same error:

[Dart Analyze & Tests —
failure](https://github.com/BasedHardware/omi/actions/runs/37135661104/job/111239677024)

```text
ERROR|COMPILE_TIME_ERROR|RETURN_OF_INVALID_TYPE_FROM_CLOSURE|app/test/widgets/capturing_finish_swipe_back_test.dart|120|86|2|The returned type 'List<dynamic>' isn't returnable from a 'Future<PeopleListResponse?>' function, as required by the closure's context.
```

Per the task's mechanical stop rule, this lane does not repair unrelated
trunk, continue landing, launch further verification, or claim green CI.
Independent Luna review was prepared/planned but not launched before the
stop. Local full-suite execution terminated at the Flutter harness with
`TestDeviceException(Shell subprocess crashed with SIGTERM (-15).)`
after `+1368`; no final tally/exit code was captured. The separate spine
pass completed `+138: All tests passed!`. No full-suite pass is claimed.
Local journeys were held; [CI hermetic
journeys](https://github.com/BasedHardware/omi/actions/runs/37135661104/job/111239677031)
were still running at the last observation.

## Summary

Lane E of `merge-golive-all-users`; companion to backend #20427. No
mobile build, release tag, workflow dispatch, merge, or deployment
performed.

- Bind cached live S1 roots to the WAL allocator object, reset
generation, and account. `clearUserData` and codec ordinal resets bump
the fence; controller cleanup and existing capture-session boundaries
invalidate the root.
- Root allocation and frame admission are synchronous on the same Dart
isolate. The first frame after a reset gets a new UUID v4. This avoids
the crash/logout/deletion persistence protocol needed to durably reserve
all issued ordinals.
- Individual/pending/synced/corrupted WAL deletion never resets the live
counter. Restart/reinstall constructs a new namespace independent of
surviving WALs. Old WALs retain their original upload claims. A stale
codec completion after logout cannot reset the successor session.
- Define-off builds emit no evidence and preserve exact binary audio
bytes. Existing S1 wire and stored shapes are unchanged.

Invariant: a `(capture_root, clock_epoch, source_frame)` triple never
identifies two different admitted audio frames, relying on fresh UUID v4
namespaces and monotonic ordinals inside each namespace.

## Optional build-enable decision — prepared, NOT committed or pushed

Store build commands in `codemagic.yaml` call
`app/scripts/build_provenance_dart_defines.sh` (iOS lines 140/505;
Android 347/918). Codemagic documents `CM_BUILD_ID` and
`CM_WORKFLOW_NAME`. The local-only enabling diff appends this block
after the existing validated provenance output:

```diff
+if [[ -n "${CM_BUILD_ID:-}" ]]; then
+  case "${CM_WORKFLOW_NAME:-}" in
+    'Auto Deploy iOS to Internal TestFlight' | 'Release iOS to Testflight' | 'Auto Deploy Android to Internal Play Store' | 'Release Android Internal Production')
+      printf '%s\n' '--dart-define=CAPTURE_EVIDENCE_V1_DARK_WRITE=true'
+      ;;
+  esac
+fi
```

The helper diff and its new 17-case test remain uncommitted in this
worktree because landing stopped on red trunk. They are intended as a
**separate optional commit** that the coordinator can drop if David
declines. Local, unknown, desktop, and Shorebird workflows remain
unopted-in. Before resuming, correct the new test's `Process.run` to
`includeParentEnvironment: false` so its sanitized environment truly
excludes inherited variables. No `codemagic.yaml` or `.github/` edit
occurred.

## Verification evidence

- Before-fix socket regression: 4 reset scenarios fail. Verbatim
example: `Expected: not '7cc66125-c35b-474f-a07e-163550385752'` /
`Actual: '7cc66125-c35b-474f-a07e-163550385752'`.
- Focused final define-on: `00:01 +9 ~1: All tests passed!`; define-off:
1 pass, exact binary equality and absent socket/WAL/header evidence.
- WAL regressions: 111 pass; existing explicit-root tests define-on: 103
pass; stale codec/logout suite: `00:00 +4: All tests passed!`.
- Final mutations: remove `clearUserData` generation bump -> 2 failures;
fixed UUID reused across fresh install -> 6 failures; exact restoration
-> 9 pass.
- Build-helper test: 4 emit cases fail before helper change; `00:02 +17:
All tests passed!` after. Existing provenance shell harness passes. This
is local prepared work, not pushed-head CI coverage.
- Pre-push normal gate, `make preflight`, and PR-body preflight: 22
checks pass. [PR Metadata
Preflight](https://github.com/BasedHardware/omi/actions/runs/37135669229/job/111239587018),
[Hygiene](https://github.com/BasedHardware/omi/actions/runs/37135661067/job/111239864739),
and
[Formatting](https://github.com/BasedHardware/omi/actions/runs/37135661067/job/111239864677)
pass remotely.

Local-only artifacts:
`.agent-artifacts/capture-root-rotation/REPORT.md`,
`red-before-fix.log`, `green-final-define-on.log`,
`green-v2-define-off.log`, `mutation1-v2.log`, `mutation2-v2.log`,
`postrestore-green.log`, `build-defines-{red,green}.log`,
`analyze-ratchet.log`, `full-test-suite.log`, `make-preflight.log`,
`pr-preflight.log`. No logs/credentials/customer data are committed.

## Reviewer risks

Inspect all four frame-admission consumers, allocator replacement,
logout/codec interleavings, and root lifetime. Mixed-root WALs can lose
eligibility for an evidence claim, but existing logic fails closed to
ordinary upload rather than dropping speech. The raw allocator's
explicit-root test seam does not itself generate UUIDs; uniqueness is
coordinated by production capture callers. Workflow display-name renames
require deliberate opt-in-list updates. The optional test needs the
environment correction above. Independent Luna review and full
mobile/device/store qualification remain incomplete.

## Product invariants affected

`pr-preflight --suggest` reports no required invariant citations. S1
identity safety is proved at the emitted socket/upload boundary. No
ratified contract, stored shape, or backend change.

Failure-Class: none
Failure-Class-Reason: No registered failure class describes capture
frame identity reuse after allocator resets. The socket regression is
the reusable guard; the fenced registry is unchanged.

Line-Count-Exception: app/lib/services/capture/capture_controller.dart |
4003 -> 4018 | Synchronous root invalidation keyed to the WAL allocator,
reset generation and account; no hot-file rewrite.
Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 2569
-> 2576 | Expose/bump the capture namespace fence at existing reset
boundaries and reject stale codec completion.

### GUARD CHANGED

`app/test/support/capture/capture_replay_world.dart` gains only
upload-header observation (`UploadAttempt.captureEvidence`); no
oracle/guard is loosened. Removing reset rotation and reusing a fixed
root still fail the socket consumer tests.

### SCOPE ADDED

The mandatory mobile changelog fragment is its own commit, `1c82e2a542`,
separate from optional build enablement.

### SPEC DIVERGENCE

The generated template incorrectly claims the selected public Omi
repository has no pre-push/failure-class tooling. The documented Flutter
component gates, not unrelated Bun desktop suites, are authoritative
here. The requested green-CI stop point and separate enablement commit
cannot be completed while the task's red-trunk stop rule applies.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Git-on-my-level and others added 2 commits October 4, 2026 00:56
Socket receipt cannot prove speech was saved. Commit bounded source-frame
coverage with the live transcript and retain root/epoch high-water and
receipt wall anchors so sync can reject missing or reused-lifetime proof.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
A received frame is not proof of saved speech, and reused roots cannot
join different capture lifetimes. Require committed source-frame proof
and validate its anchors against the observed WAL before trimming audio.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
Git-on-my-level and others added 11 commits October 4, 2026 02:22
Keep the exhaustive rendered environment assertion current with the
reviewed inert pusher binding without relaxing missing-binding guards.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
Widening the UID cohort must not route legacy uploads through per-segment
lineage. Require complete source claims and decoded mappings by default,
while preserving the master kill switch and explicit ungated rollback.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
The forwarding fixture exercises the prior binding mode, not S1
admission. Keep its unchanged stamp assertion under the explicit old mode.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
Offline coverage decisions must apply the same lifetime checks as
production and retain speech when the decoded WAL anchor is absent.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-Authored-By: Devin Fusion <[email protected]>
Persist unknown coverage when committed evidence is unavailable so a
producer-first rollout cannot authorize suppression in older consumers.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
Authorize coverage only from bounded word timings mapped independently
through accepted sends. Span-only results abstain and every gap remains
available for sync transcription instead of dropping omitted phrases.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
Stop at the 512-note or callback inspection cap without evicting earlier
proof. Mark coverage incomplete and leave speech rejection or retention
to the existing transcript admission queues.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
Keep the upstream Soniox replay changes alongside the word-timing
collector and make the new helper's guarded float conversion type-check.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
The merge hook lacked the owned app package configuration and selected
the modern Dart layout. Restore upstream blobs after lock-enforced
bootstrap; the normal pinned formatter now confirms zero changes.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin Fusion <[email protected]>
…mitted envelope

Luna review r4 P2: the producer keeps segment and conversation ids as
in-memory keys; the persisted envelope is what stays id-free.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review October 3, 2026 22:44
@Git-on-my-level
Git-on-my-level merged commit cd3326b into main Oct 3, 2026
58 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/sync-lineage-dedupe branch October 3, 2026 22:45
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 3, 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-03T22:47:23.855255Z 504a02d Draft marked ready
ℹ️ 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.

Git-on-my-level added a commit that referenced this pull request Oct 4, 2026
…lease builds (#20645)

## Summary

Admits the S1 capture-evidence signal (`CAPTURE_EVIDENCE_V1_DARK_WRITE`)
end to end, which completes the duplicate-transcription fix from #20427.
That fix trims safety-WAL frames the live socket already received, but
only when both the phone and the server carry shared source-frame
identity. Until now, every build and every host had that signal off.

- **Backend:** `CAPTURE_EVIDENCE_V1_DARK_WRITE=true` on dev and prod
`backend-listen` (runtime env + Helm values), `backend`, `backend-sync`,
`backend-sync-backfill` and `backend-integration`. Pusher does not run
the producer; it gets the same value as an inert co-host mirror, which
the pusher co-host env-diff gate requires. Code default stays off.
- **Mobile:** every iOS/Android release build in `codemagic.yaml` passes
`--dart-define=CAPTURE_EVIDENCE_V1_DARK_WRITE=true`. The macOS Flutter
build is unchanged. Changing `codemagic.yaml` alone does not trigger a
build; the next mobile release carries the flag.
- **Codemagic contract:** the reviewed digests in
`.github/scripts/fixtures/codemagic_workflow_contract/v1.json` are
updated for this edit, as `check-release-process-guards.py` requires; no
workflow, trigger or credential changes.
- **Registry and classification** are updated. A new pin test
(`test_capture_evidence_admission.py`) covers the composed declarations,
the Helm value and every mobile release build. Red-proof: the test fails
with the `codemagic.yaml` hunk reverted.

The backend ships first; older apps send no evidence, so the server
records nothing new for them. Evidence piggybacks on existing writes; no
new Firestore operations are added (`listen_pusher_pipeline.mdx`, "S1
capture evidence dark write"). The trim itself remains gated by
`SYNC_WAL_AUDIO_COVERAGE_ENABLED` and
`SYNC_LINEAGE_RESOLVE_UID_ALLOWLIST`.

Rollback: set the flag to false on those five services. Clients then
send evidence that the server ignores.

## Failure class (fixes)

Failure-Class: FC-transcript-and-audio-on-independent-clocks

A sync upload and the live socket carry the same speech on independent
clocks, so wall time cannot prove they overlap. S1 gives both paths a
shared source-frame ordinal, and the server trims only frames it
positively received.

## Product invariants affected

- INV-AUTH-1 — preserved. `codemagic.yaml` matches; only the mobile
`flutter build ipa/appbundle` argument lists change. Desktop auth,
signing and the signed-artifact smoke are untouched.
- INV-DATA-1 — preserved. `codemagic.yaml` matches; the dart-define adds
no API base URL, environment selector or backend routing. Every
production-family artifact keeps the canonical production data plane.
- INV-BETA-1 — preserved. `codemagic.yaml` matches; the macOS beta
identity, bundle id and desktop workflows are byte-identical in meaning
(the semantic digest changed only for the 4 mobile build scripts).
- INV-MEM-4 — preserved. Only `backend/deploy/runtime_env.yaml` matches:
it declares the S1 admission flag. Memory intake, consolidation,
promotion and projections are untouched.

## Verification

- `flutter test --dart-define=CAPTURE_EVIDENCE_V1_DARK_WRITE=true
test/services test/unit` passes: 2,259 tests, 1 skipped (the
disabled-path group).
- Backend unit files touching runtime env, flags, the classification and
capture evidence (45 files) pass through `backend/test.sh`.
- Not yet verified in production.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/20645?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
chicoenmascarado pushed a commit to chicoenmascarado/omi that referenced this pull request Oct 4, 2026
…lease builds

Turns on CAPTURE_EVIDENCE_V1_DARK_WRITE on backend-listen, backend,
backend-sync, backend-sync-backfill and backend-integration (dev and prod),
and passes the matching dart-define to every mobile release build in
codemagic.yaml. Completes the BasedHardware#20427 duplicate-transcription fix: sync
uploads can now be trimmed by shared source-frame identity once a phone
runs a build that sends it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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