Skip to content

Making setup process better - #5

Merged
eng1n88r merged 4 commits into
BasedHardware:mainfrom
akshaynarisetti:main
Mar 28, 2024
Merged

eng1n88r merged 4 commits into
BasedHardware:mainfrom
akshaynarisetti:main

Conversation

@akshaynarisetti

Copy link
Copy Markdown
Contributor

No description provided.

…library targets Wio Terminal boards and XIAO BLE at the moment
…ning local_laptop_client.py, added the same to README
@akshaynarisetti akshaynarisetti changed the title Updated README.md Making setup process better Mar 28, 2024
…ersion, use BleakScanner.discover instead.

  devices = await bleak.discover(timeout=2.0)
@eng1n88r
eng1n88r merged commit 85afd9d into BasedHardware:main Mar 28, 2024
beastoin added a commit that referenced this pull request Aug 30, 2025
mdmohsin7 added a commit that referenced this pull request Oct 18, 2025
closes #3241

before:


https://github.com/user-attachments/assets/d00d815c-8419-4c1b-96fb-ec20365fba44

logs:

```
flutter: ----------------FIREBASE CRASHLYTICS----------------
flutter: Bad state: No element
flutter: 
#0      ListBase.firstWhere (dart:collection/list.dart:132:5)
#1      SharedPreferencesUtil.disableApp (package:omi/backend/preferences.dart:255:22)
#2      _AppDetailPageState._toggleApp (package:omi/pages/apps/app_detail/app_detail.dart:1129:13)
#3      _AppDetailPageState.build.<anonymous closure> (package:omi/pages/apps/app_detail/app_detail.dart:576:48)
#4      _AnimatedLoadingButtonState._handleOnPressed (package:omi/widgets/animated_loading_button.dart:38:27)
#5      _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1204:21)
#6      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:345:24)
#7      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:758:11)
#8      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:383:5)
#9      BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:353:7)
#10     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:173:27)
#11
```

after:


https://github.com/user-attachments/assets/26ea5c91-e73a-44f4-ba76-4b804876c5df

<img width="1032" height="257" alt="Screenshot 2025-10-18 at 11 15
52 PM"
src="https://github.com/user-attachments/assets/44e4e46b-b654-4599-84ee-8ee0920b1cd3"
/>
@ellaaicare

Copy link
Copy Markdown

🚀 Voice Mode v2 - DEPLOYED TO PRODUCTION

Status: ✅ Live and ready for iOS testing

Endpoint

wss://api.ella-ai-care.com/v2/voice?uid=<user_id>&session_id=<optional>

Health Check (Verified Working)

curl https://api.ella-ai-care.com/v2/voice/health

Response:

{
  "status": "ok",
  "version": "2.0.0",
  "endpoint": "/v2/voice",
  "config": {
    "vad_provider": "silero",
    "vad_stop_secs": 1.5,
    "stt_provider": "deepgram",
    "stt_model": "nova-2",
    "tts_provider": "openai",
    "tts_voice": "nova",
    "llm_provider": "groq",
    "llm_model": "llama-3.3-70b-versatile"
  },
  "dependencies": {
    "deepgram_key_set": true,
    "openai_key_set": true,
    "groq_key_set": true
  }
}

Production Test Results

✅ Health endpoint reachable
✅ Status is 'ok'
✅ VAD provider is Silero
✅ All API keys configured
✅ Pipeline config validation
✅ n8n config integration (with fallback)

For iOS Team

  1. Connect to wss://api.ella-ai-care.com/v2/voice?uid=<uid>
  2. Send raw PCM16 audio at 16kHz (same as v4/listen)
  3. Receive TTS audio chunks back
  4. VAD handles turn-taking automatically

Backend Monitoring

# Watch live voice sessions
journalctl -u omi-backend -f | grep "🎤\|🎙️\|✅\|❌"

Ready for end-to-end testing! 🎉

dluffy56 pushed a commit to dluffy56/omi that referenced this pull request Mar 6, 2026
22 new tests covering:
- _is_segment_final detection (8 tests)
- Debounce state machine decisions (6 tests)
- Version safety / stale-write rejection (4 tests)
- Same-text skip behavior (2 tests)
- Flush and exception cleanup (2 tests)

Total: 62 tests (40 original + 22 new).
Addresses gap BasedHardware#5 from issue BasedHardware#4651.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
beastoin added a commit that referenced this pull request Mar 16, 2026
Covers feature vector gap #5 (priority 6, intelligence layer).
Steps: Add Goal from daily score widget, fill title/target, save, edit.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
closes BasedHardware#3241

before:


https://github.com/user-attachments/assets/d00d815c-8419-4c1b-96fb-ec20365fba44

logs:

```
flutter: ----------------FIREBASE CRASHLYTICS----------------
flutter: Bad state: No element
flutter: 
#0      ListBase.firstWhere (dart:collection/list.dart:132:5)
#1      SharedPreferencesUtil.disableApp (package:omi/backend/preferences.dart:255:22)
BasedHardware#2      _AppDetailPageState._toggleApp (package:omi/pages/apps/app_detail/app_detail.dart:1129:13)
BasedHardware#3      _AppDetailPageState.build.<anonymous closure> (package:omi/pages/apps/app_detail/app_detail.dart:576:48)
BasedHardware#4      _AnimatedLoadingButtonState._handleOnPressed (package:omi/widgets/animated_loading_button.dart:38:27)
BasedHardware#5      _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1204:21)
BasedHardware#6      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:345:24)
BasedHardware#7      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:758:11)
BasedHardware#8      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:383:5)
BasedHardware#9      BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:353:7)
BasedHardware#10     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:173:27)
BasedHardware#11
```

after:


https://github.com/user-attachments/assets/26ea5c91-e73a-44f4-ba76-4b804876c5df

<img width="1032" height="257" alt="Screenshot 2025-10-18 at 11 15
52 PM"
src="https://github.com/user-attachments/assets/44e4e46b-b654-4599-84ee-8ee0920b1cd3"
/>
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
22 new tests covering:
- _is_segment_final detection (8 tests)
- Debounce state machine decisions (6 tests)
- Version safety / stale-write rejection (4 tests)
- Same-text skip behavior (2 tests)
- Flush and exception cleanup (2 tests)

Total: 62 tests (40 original + 22 new).
Addresses gap BasedHardware#5 from issue BasedHardware#4651.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
Covers feature vector gap BasedHardware#5 (priority 6, intelligence layer).
Steps: Add Goal from daily score widget, fill title/target, save, edit.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
choguun added a commit to choguun/omi that referenced this pull request Jun 25, 2026
…dead code)

Addresses 5 cubic P3 findings on PR BasedHardware#8349.

## P3 #1 (cubic): v1-only module docstring (now updated to cover v1-v4)

Same fix as v1's commit 6ce9fce, applied here.

## P3 BasedHardware#2 (cubic): benchmark.py has function-scoped `import asyncio`

Per backend AGENTS.md, imports should be at the module top level. The
benchmark.py had two `import asyncio` statements inside functions.

Fix: moved both to module top level. Removed the now-redundant in-function
imports. The `asyncio.run` calls now reference the module-level import.

## P3 BasedHardware#3 (cubic): demo/run.py top-level docstring is stale

The docstring mentioned "Demos 1-3 don't call the HTTP endpoint" but
Demo 4 (added in v2) DOES use FastAPI's TestClient to hit the live
endpoint. The docstring has been updated.

## P3 BasedHardware#4 (cubic): docs/auto-router-demo.md wrong metrics endpoint path

The Demo 4 row in the summary table said "GET /metrics" but the
actual route is "GET /v1/auto-router/metrics". Fixed.

## P3 BasedHardware#5 (cubic): README.md test inventory outdated (missing metrics)

The test tree at the top of README.md didn't include
test_auto_router_metrics.py (added in v2). Fixed by adding it.

## P3 BasedHardware#6 (cubic): Unused defaultsSuite in AutoRouterTests.swift

The setUp/tearDown created a unique UserDefaults suite per test but
never injected it. The tearDown tried to clean up using
`dictionaryRepresentation().keys.first ?? ""` as the domain name,
but keys.first returns a stored KEY (not the suite name), so the
cleanup was a silent no-op.

Fix: removed the setUp/tearDown entirely. Each test that writes via
`AutoRouter.shared.store(...)` cleans up via
`AutoRouter.shared.invalidate(task: ...)` at the end. A NOTE comment
documents the contract.

## Test results

- Backend: 175 tests pass
- Desktop: 15 AutoRouterTests pass (no count change, just cleanup)
- Black 26.5.1 clean
- Desktop build clean

## Not addressed (process artifacts)

- v1 review-report.md diff-hygiene / test-count inconsistencies
- v2 auto-router.mdx backend test total inconsistency
- v2 plan.md T-205 file count inconsistency
- v2 spec.md auth test guidance

These are stale AIDLC process artifacts from v1 that have been superceded
by v2/v3/v4 docs. Fixing them would be churn without value.
choguun added a commit to choguun/omi that referenced this pull request Jun 30, 2026
…URL override, do/catch persona lookup

Addresses cubic + maintainer review on PR BasedHardware#8528:

1. P1 (ConnectSheet): replaced substring localhost detection with
   proper URL host parsing via isLoopbackURL(). Checks exact host
   values (localhost, 127.0.0.1, ::1) instead of fragile
   contains() which falsely matched 'localhost.evil.com'.
   Identified by cubic P2 + maintainer BasedHardware#4.

2. P1 (APIClient): removed backendURL override parameter from
   createAppKey() and getOrCreatePersona(). These authenticated
   calls send Firebase tokens + BYOK keys — the override could
   leak credentials to untrusted URLs. Identified by cubic P1 +
   maintainer BasedHardware#4.

3. P1 (ConnectSheet): replaced try? getPersona() with proper
   do/catch. try? collapsed network/auth/decoding errors into
   'no persona' and triggered unnecessary creation that masked
   the real failure. Now: errors propagate to the user.
   Identified by cubic P1 + maintainer BasedHardware#5.

4. P2 (APIClient): Persona.createdAt/updatedAt changed from
   Date to Date? (optional). Prevents crash when backend omits
   timestamps, and avoids masking contract regressions with
   non-deterministic Date() defaults. Identified by cubic P2.

Build clean. Build complete!
choguun added a commit to choguun/omi that referenced this pull request Jul 1, 2026
…URL override, do/catch persona lookup

Addresses cubic + maintainer review on PR BasedHardware#8528:

1. P1 (ConnectSheet): replaced substring localhost detection with
   proper URL host parsing via isLoopbackURL(). Checks exact host
   values (localhost, 127.0.0.1, ::1) instead of fragile
   contains() which falsely matched 'localhost.evil.com'.
   Identified by cubic P2 + maintainer BasedHardware#4.

2. P1 (APIClient): removed backendURL override parameter from
   createAppKey() and getOrCreatePersona(). These authenticated
   calls send Firebase tokens + BYOK keys — the override could
   leak credentials to untrusted URLs. Identified by cubic P1 +
   maintainer BasedHardware#4.

3. P1 (ConnectSheet): replaced try? getPersona() with proper
   do/catch. try? collapsed network/auth/decoding errors into
   'no persona' and triggered unnecessary creation that masked
   the real failure. Now: errors propagate to the user.
   Identified by cubic P1 + maintainer BasedHardware#5.

4. P2 (APIClient): Persona.createdAt/updatedAt changed from
   Date to Date? (optional). Prevents crash when backend omits
   timestamps, and avoids masking contract regressions with
   non-deterministic Date() defaults. Identified by cubic P2.

Build clean. Build complete!
eulicesl added a commit that referenced this pull request Jul 11, 2026
… pagination skip, task reorder flicker (bug sweep #5) (#9492)
aryanorastar pushed a commit to aryanorastar/omi that referenced this pull request Jul 22, 2026
feat(windows): Phase 2 — capture architecture (hidden capture window, AudioWorklet, Silero VAD, webSecurity on)
abunet added a commit to abunet/omi that referenced this pull request Aug 14, 2026
…oses 4 cursor P1s (cubic 10887 BasedHardware#2/BasedHardware#3/BasedHardware#5/BasedHardware#11)

`__name__` is Firestore's document-name token; the neutral store forwarded it as an ordinary payload
field, so the Mongo adapter prefixed it to `d.__name__` (which never exists — the document name lives in
`_id`, the full logical path). Four production-reachable P1s shared this one root cause on the Mongo
on-prem path:

- BasedHardware#2 canonical maintenance cron `collection_group(...).order_by("__name__").start_after(cursor)` raised
  NotImplementedError on resume -> the seed pass was stuck at page 1.
- BasedHardware#3 `where("__name__", ">=", cutoff)` (monthly chat usage) matched a nonexistent `d.__name__` -> empty
  result -> usage undercounted.
- BasedHardware#5/BasedHardware#11 `order_by("__name__")` + cursor keyed/sorted on `d.__name__` -> page 2+ empty for the
  staged-task and review-queue legacy scans.

Central fix in the adapters (Firestore itself handles __name__ natively):
- Mongo `query`: a sole `__name__` order (or no order) keys purely by `_id` honoring direction; the sort
  maps `__name__`->`_id`. Mongo `_filter`/`query_group` filters map `__name__`-> full-path `_id`.
- Mongo/Firestore `query_group`: a `__name__` order is the implicit document-name keyset — strip it so it
  doesn't conflict with start_after.
- Firestore adapter: `__name__` filter value -> a DocumentReference (Firestore's contract).
- Facade `_GroupQuery.order_by("__name__")`: no-op (the canonical-cron path).

Verify (rule 12, live dual-backend fresh): contract 102 passed (+6: __name__ filter, sole-__name__
pagination, group __name__ cursor — each x2 backends). Facade hermetic 18 (the cron no-op). Guard 0;
store/facade sweep 0 regressions.
abunet added a commit to abunet/omi that referenced this pull request Aug 14, 2026
…eycloak realm (cubic 10887 review 4909186286 BasedHardware#5)

keycloak/omi-realm.example.json — the single realm imported by every posture (base) — carried the
omi-test direct-access client and testuser/testpass. Since compose.prod.yaml imports the same realm,
those test principals reached production: a known-password client with directAccessGrants in the prod
realm is a standing auth-bypass surface.

Split the realm per-environment (two files cannot both declare realm "omi" in one import dir, so
exactly one is mounted per posture):

- keycloak/omi-realm.example.json -> prod-safe: omi-app (PKCE) + omi-backend-admin (service account)
  only. omi-test client and testuser removed.
- keycloak/omi-realm.dev.example.json (new) -> the dev/test superset: same as prod plus omi-test +
  testuser, for the OIDC contract test and manual SSO login.
- base no longer mounts a realm; compose.prod.yaml mounts the prod-safe realm, compose.dev.yaml and
  compose.seed.yaml mount the dev realm.
- SELFHOST_NOTES: the standalone contract-test recipe now mounts the dev realm; realm references note
  the split.

The test principals funnel only through four env vars consumed by
tests/contract/test_auth_provider_contract.py, which self-skips when they are unset, so the prod
realm dropping them needs no code change.

Verification (live on the declarative config, rule 12):
- DEV (compose.dev.yaml --profile auth): realm imported, omi-test password grant mints a token.
- PROD (compose.prod.yaml --profile auth): realm imported; omi-test password grant is rejected with
  invalid_client (the client is absent); omi-app is present (unauthorized_client, not invalid_client).
abunet added a commit to abunet/omi that referenced this pull request Aug 15, 2026
…uery_group parity

Two coupled collection-group defects (cubic PR 10887 BasedHardware#338 + BasedHardware#5/BasedHardware#6):

- BasedHardware#338 (regression from the BasedHardware#8 scoped-query fix): the facade applied `_name_filter_value` (which
  reduces a _DocRef to its bare id, correct for a scoped query the store rebuilds as
  f"{collection}/{value}") to the collection-GROUP where() too. But query_group matches _id directly,
  and _id IS the full logical path (a group spans parents, no collection to prefix) — so the bare id
  matched nothing on Mongo. Add `_group_name_filter_value` (keeps the _DocRef's full .path) and use it
  in _GroupQuery.where.
- Fake query_group parity: FakeDocumentStore.query_group ignored __name__ filters (tested d["__name__"],
  a key no doc has -> zero rows) and silently combined an explicit field order_by with a document-name
  start_after keyset that both real adapters reject with NotImplementedError. A test could pass
  hermetically then break on Mongo/Firestore. The fake now handles __name__ against the full path and
  raises NotImplementedError for order_by+keyset, matching the adapters and the store contract.

Verification:
- Live on Mongo: `collection_group('state').where('__name__','==', DocRef)` returns ['s1'] (was [] when
  the DocRef was reduced to the bare id).
- Rewrote test_group_query_supports_order_by_and_start_after (it asserted the fake-only behavior the
  real adapters reject) to the real contract: order_by streams ordered, order_by+keyset raises. Added a
  group __name__ DocRef-bound regression test (==, and >=).
- test_firestore_facade 25, test_canonical_short_term_maintenance_cron 9, test_fair_use_store 14,
  test_firestore_query_contract 26 pass; guards 0.
undivisible pushed a commit that referenced this pull request Aug 17, 2026
…ACHE

Doc 47 R2 #5 recommended this for production and it was never built here: no
cache code, no cache files. Measured on the v7 GLM lane, a dream cycle issues
>=320 model calls and re-issues them every cycle for clusters that did not
change; 18 cycles is on the order of 5,700 calls, overwhelmingly repeats of
byte-identical inputs.

This is a cache and nothing more. D50 is untouched -- the model still proposes
and the deterministic validator still admits, from the same bytes it would have
seen. partition_hash is untouched, so a warm cycle and a cold cycle on the same
ledger produce the same hash.

Three properties make it safe rather than merely fast:

- Successes only. A throw propagates uncached, so transient model failures and
  the retryable rejections built on them behave exactly as they do without the
  cache. Caching an error would turn a network blip into a permanent verdict.
- The model identity is in the key. A GLM cache must never serve a codex verdict
  for the same prompt, and a prompt-version bump must miss. Covered by a test
  that shares one store between two namespaces.
- render/compose are never cached. They carry a per-run model_version rather
  than a pinned prompt contract, and their answers are what the recall log
  grades -- replaying an earlier answer there would corrupt an evaluation
  rather than speed one up.

Measured cold vs warm over 50 labelled boundary claims against real GLM:

  cold   hits=0  misses=50  50 writes   23.6s
  warm   hits=50 misses=0   100% hits    0.1s

and the warm run reproduced the cold run's decisions exactly (15/26 durable,
20/24 residue both times), which is the property that matters -- the speedup is
worthless if the replay is not identical.

identity-cost gains --digests, which prints the per-cluster cache-key input so
two snapshots of a running ledger can be diffed to measure the hit rate
memoization sees ACROSS cycles. That is the number that predicts the real
benefit, and it is not 100%: a cluster that gains a single mention is a
different input and therefore a miss.

Also records the standing rule agreed with the coordinator: a reduction may
select whole clusters and must never prune members inside one (doc 47 #7/#8).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01T4Pa42d2xtXWNFxf4MddNc
Git-on-my-level added a commit that referenced this pull request Oct 20, 2026
…r, gate tokens, preflight, stop pages) (#22766)

* fix(lr/06): ramp controller carries the 5% ramp lessons (quality floor, gate tokens, preflight, stop pages)

lessons-audit (lessons/batch-rollout-and-staging-traps.md #2-#5), checked against
the tested rules in the workspace's infra/rollout:

- failed_held_duration_unknown, a fleet_gate verdict since the run 10/11 gate
  fixes, was missing from the closed token lists, so it HELD as "gate
  unavailable" and left a failing cohort on. It is data loss (ROLLBACK_ZERO),
  like failed_held_over_budget. Every fleet_gate verdict FAIL token is pinned
  in the tests; the workspace test_controller_contract.py pins the same list
  against the gate source.
- first-summary is a quality floor (QUALITY_FLOOR). Every tested ramp_env.json
  rollback set keeps FIRST_SUMMARY_DEADLINE_PERCENT=100, which is prod's live
  value, but decide_all rolled it back in lockstep, and a lockstep seed would
  cut it to the batch cohort. A rollback now moves batch-pipeline only. A
  first-summary above the lead holds quietly; an unseeded one is never written,
  because serving keeps the env default. ramp_set refuses first-summary below
  100 without --allow-quality-decrease.
- --preflight-cmd runs before any ADVANCE (never before a rollback) with the
  current percent. A non-zero exit HOLDs and pages with its token. Prod --apply
  requires it. The workspace's controller_preflight.sh checks the serving
  backend-integration revision (multilingual, recovery mode, recovery for all
  admitted, which is a live-only prod setting) and the owner backlog.
- A --loop --apply run pages the lead when it stops (SIGTERM, SIGHUP, interrupt)
  and after three consecutive failed ticks. ramp5.sh rolled back on exit. The
  controller keeps its step, because that step passed its gate and a restart
  resumes, but the ramp is then unsupervised and someone must know.

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

* fix(lr/06): Grok review nits on the controller lessons commit

- A first-summary below the lead still pages on a lead rollback; only a value at
  or above the lead holds quietly.
- A dry-run loop never pages on tick errors, matching the apply-only stop page.
  A failing error page no longer ends the loop.

Grok review lessons-audit-review: SHIP (minors 1-3 fixed here).

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Oct 22, 2026
…notes, boundaries and lifecycle (shadow by default) (#23335)

## Capture, speaker and notes refactor integration

Integrates L1 `efd6d97d1a5`, L2 `f01392bfc7b`, L3 `2475429ecc1`, L4
`8ec85289796`, and L5 `f4877478d10` in that order, plus current main.
This is a branch-only integration: no PR, main merge, deployment or
cohort change.

- L1: committed frame ledger, intake/dedupe/config hygiene,
authenticated coverage route and export, same-key open-live discovery
without a device. The generated plan alias reader now uses the gated
shared parser.
- L2: ranked evidence, receipt-constrained projection, caches and
pooling; explicit owner/retraction wire events; continuity and GPU
policy packaging; boundary roster candidates retain low,
non-label-eligible priors.
- L3: unified notes packet/output/language work; cache source closure
and effective packet/version identity; metric export;
account/conversation-aware episode rendering and language propagation.
- L4: mounted boundary endpoint, live committed events,
CAS/clocks/boundaries/executors, durable atomic merge admission and
epoch-fenced reconciliation in the existing finalization outbox.
Correction transfer seals the recovery phase atomically; recovery safely
rolls back preparation or replays sealed source cleanup without another
paid notes call. Empty-ready quiet obligations use content/lease-fenced
lifecycle deletion. Normal and recovered merge completion share the
typed notification dispatcher and retain the data-only background
transport.
- L5: mobile Home/owner/custody/continuations and desktop
identity/labels/boundary adapters consume the integrated authorities.
Tombstone-first deletion purges staged chunks even without a parent;
staging expires after seven days and expired parts cannot assemble.
- macOS meeting identity requires call-control chrome for Telegram,
Slack, Discord and WhatsApp. Dominant chat windows no longer supply
meeting participants.

## Flags and ramp

Backend `CAPTURE_COVERAGE_MODE`, `SPEAKER_EVIDENCE_MODE`,
`NOTES_PACKET_V2_MODE`, `STT_LANGUAGE_HINTS_MODE`,
`EPISODE_BOUNDARIES_MODE`, `LIFECYCLE_V2_MODE`, and
`CLIENTS_FROM_SEGMENTS_CHUNKS_MODE` remain shadow by default. Percent
selectors default zero; digest lists default empty. No manifest serves a
cohort. Shadow retains legacy output and adds no duplicate paid
model/transcription call. Coverage records may be written in shadow, but
new committed custody events are emitted only for the capture serving
cohort.

PostHog `clients_refactor`, `clients_from_segments_chunks`,
`clients_boundary_evidence` remain off/unknown.
`custody_capture_committed_release` is a deleting opt-in and requires
explicit boolean true through the identity-fenced reader. No PostHog
rows or cohorts are changed here.

Owner **dazheng**, expansion complete by **2026-10-26**: integrated
synthetic/test cohort → reviewed runtime digest cohort → 1% → 5% → 25% →
100%, with a full clean observation window before each expansion. For
notes/client arms whose lane ramp uses 10%, require the same clean gate
before that step. Before continuation serves, enable Firestore TTL for
`from_segments_chunks.expires_at`; the seven-day expiry field and
assembly checks are implemented, but physical database TTL is not
applied by this code-only task. The reviewed declaration is
`backend/deploy/from-segments-retention.json`;
`backend/scripts/batch_pipeline_ttl.py --policy` produces its plan
without credentials.

Require zero custody loss, false frame suppression, duplicate
per-session conversations, manual-receipt violations, cross-boundary
automatic merges, empty rows reaching paid processing, and pre-durable
committed events. Review dedupe/projection/notes disagreements and owner
attribution, language quality, failed/held work, queue age and merge
dead letters. Exported families include capture coverage/dedupe/retry,
speaker evidence/agreement/owner share, notes shadow/results, lifecycle
shadow, executor task gauges and client refactor comparisons. The
prerecorded-language gate and vendor allowlist entries are retained.

Rollback: set backend mode off and client flags false; already-admitted
durable merge obligations continue reconciling. Do not remove TTL or
rewrite historical data as rollback.

## Invariants and failure class

Invariants: **INV-AUTH-1**, **INV-MEM-4**, **INV-CAP-1**,
**INV-TASK-2**. Identity fences remain authoritative; retained/released
audio requires exact durable proof; merge retraction preserves
correction/Undo and memory ownership; task effects stay behind
successful processing and source retraction boundaries.

Failure-Class: FC-split-mutation-authority

## Validation

- Backend lane lists: **2,897 passed across 87 file-isolated suites**.
Expanded seam run: **334 passed across 15 files**. The full selector ran
once (2,223 isolated files); 34 files exposed
integration/import-isolation regressions, all repaired and rerun. A
132-file affected union was checked; two files caught the brief
in-progress merge conflict and were rerun afterward. The 16-file
post-main run is **624 passed**, including those two. These focused
counts overlap.
- Merge/notification recovery follow-up: **135 passed across 13 files**;
the notification direct-call ratchet decreases by one.
- Real local Firestore emulator: **15 passed**, covering concurrent
merge admission, epoch fencing, atomic correction-transfer sealing,
empty-row deletion races and capture-ledger contention.
- Swift: **49 passed** (43 meeting identity/storage plus six L5 client
tests). Flutter: **58 focused tests passed**, plus the bootstrap's
hermetic spine/shell checks; analyzer ratchet passed with baseline lint
debt retained.
- Backend Pyright after the main merge: **zero errors**, with existing
warning-level debt (47,794 warnings).
- All heavy commands use `omi-heavy` and `nice -n 10`. OpenAPI, Dart,
Swift, TypeScript, feature-registry and plan-catalog outputs were
regenerated from their sources. All seven backend modes were checked
with an empty environment: shadow and no serving without a cohort.
Client readers require explicit boolean true, and no serve cohort is
introduced in manifests.

**Body-aware preflight: all 67 selected checks passed, zero skipped**
(also repeated successfully on the final pushed tip), after repairing
the notification boundary. The required non-force push passed its
exact-tip pre-push gate: current preflight, backend Pyright (zero
errors), bounded backend tests, OpenAPI/wire contracts, Flutter
generated output, Dart formatting and Swift compile. No production
reads, production API calls, GCP credential tier, deployment or paid
evaluation is used.

Publication: non-force push succeeded at **2026-10-22 19:20Z**, before
the 21:30Z cutoff. Remote and local tip both verify as
**`8892f2b85e7d5790c8b9a40169cdeffd9f8bb573`**, including review fix
`ec90304a8ca` and current main
`312b4f734c22900547ff23e7260f69622b6aa36b`. All five lane tips remain
ancestors; worktree is clean. The exact-tip pre-push gate passed: 67
selected preflight checks, Pyright zero errors, bounded backend tests,
source closure, OpenAPI/client compatibility, Flutter code generation,
Dart/Python formatting and Swift compile. The separate all-gates
preflight passed 68 gates with no failure or time skip. No GitHub
Actions runs are listed for this branch at verification, so this is
local-gate evidence, not a terminal GitHub CI claim. No PR, deployment
or cohort change is part of this task.

## Review findings

GLM lane reviews plus the contact-name addition are reconciled below.
All required-before-merge and required-before-ramp fixes are
implemented. Defaults remain shadow/off; no cohort or deployment
changes.

| Finding | Status | Resolution |
| --- | --- | --- |
| L1 #1 route registration | Done | Already integrated: authenticated
route policy, app role via sync mount, OpenAPI prefix and regenerated
wire outputs; push gate passes. |
| L1 #2 shadow audio fetch | Done | Shadow uses only an
already-prefetched manifest; full provider audio fetch requires the
capture serve cohort. |
| L1 #3 derivative cleanup | Done | Trim returns ownership of generated
and retired paths through the coordinator cleanup set, including fully
suppressed input. |
| L1 #4 dark metadata | Done | Accepted internal-only delta; missing
envelopes/optional identity fields are guarded and tested. |
| L1 #5 empty uploads | Done | Synthetic covered response is serve-only;
shadow/off retain legacy empty admission. |
| L1 #6 open-live binding | Done | Already integrated: no-device
discovery gate plus full capture/session/clock projection and
transactional selection. |
| L2 #1 preserve established labels | Done | Abstaining clusters emit no
replacement decision; accepted voice candidates and scoped manual
decisions alone project labels. Reprocessing fixtures preserve
established owner/person labels and identity status with expired audio,
exhausted budget or a deleted print. |
| L2 #2 pinned operating points | Done | Independent literal and
comparison-strictness pins cover every legacy point, plus each env
override and the shared finalize/cross-epoch binding. |
| L2 #3 ownership | Done | Integrator ratifies the voiceprint-scoped
users.py and speaker_assignment_effects.py edits and the documented
conversation_speakers path correction. |
| L2 #4 second wire emitter | Done | Owner/retraction adapter already
integrated; the transcript introduction emitter now explicitly declares
is_user=false because it is contact-only. |
| L2 #5 malformed evidence | Done | Evidence reads fail open to existing
labels, with a bounded error log and fallback counter; malformed
content/identity is not logged. |
| L2 #6 policy consumers/markers/provenance | Done | Continuity and GPU
policy imports were integrated; missing superseded markers added and
original offline measurement provenance restored. OperatingPoint.accepts
remains a tested pure policy utility. |
| L2 #7 pooling edges | Done | Legacy multi-sample provenance is
retained as one aggregate base, replaceable/retractable as one
contribution. Sample deletion already preserves the materialized
remaining source; regression coverage pins it. |
| L4 F1 shadow read cadence | Done | Bounded owner/client-scoped
60-second caches cover shadow windows and unchanged context ingestion,
with write invalidation. Serve reads remain fresh. |
| L4 F2 candidate widening | Done | Numeric/ISO timestamp normalization
requires the lifecycle serve cohort; shadow/off retain raw datetime-only
eligibility. |
| L4 F3 rescheduling | Done | Calendar identities accept an updated
start/window; non-calendar starts remain immutable and same-start end
retries cannot reopen. Saved row contexts cannot rewind an authoritative
calendar reschedule. |
| L4 F4 post-commit hardening | Done | Malformed run grouping and
optional publication failures cannot fail an already-durable transcript
flush or trigger rollover. No custody event is emitted without ledger
success. |
| L4 F5 integration gaps | Done | Boundary mount/policy, durable merge
leases/reconciliation, empty-ready deletion and serve-only bounded
executor were completed in integration. Shadow/off deliberately retain
the legacy executor. |
| L4 F6 sanctioned deltas | Skipped | Informational: retain the
brief-authorized cap/CAS/UTC fixes and same-value activity/speech dual
writes; no additional behavior change. |
| L4 F7 missing producer | Done | L1 coverage is present in the composed
runtime and source-closure checks; no absent-module stub or bypass. |
| L4 F8 cold emulator contention | Skipped | Informational flake; no
weakened retry/fixture policy. The current 15-test emulator run includes
the concurrent-reconnect case and passed; this is not treated as a
production defect. |
| L5 #1 custody index failure | Done | Newly released copies revert to
repair on failed index persistence. Flush durably commits a release
before retention can act on it; no extra save in default mode without a
release. Failure fixtures preserve the audio file. |
| L5 #2 continuation flag withdrawal | Done | Prepared input is
terminalized once as continuation_disabled, with the prepared copy
dropped and the audio retained. Status/reason are durable; no repeated
recognition/upload, including without a model. |
| L5 #3 unfinished Home rows | Done | Serving hides in-progress,
processing and merging members until completed/failed. Flag-off behavior
remains identical. |
| L5 #4 missing desktop finish | Done | Chunked finalization derives an
absent finish from the latest finite positive segment end; explicit
finish and legacy single-shot behavior are preserved. |
| L5 #5 early chunk validation | Done | Finite, nonnegative,
positive-duration and nonblank segment checks run before any staged
write. |
| L5 #6 projection-digest response | Skipped | Optional protocol
expansion is beyond a cheap follow-up: it needs a versioned
response/decoder contract. Frozen clients already keep a stable
projection; retain first-staged display-only projection and list digest
negotiation as follow-up. |
| L5 #7 agreement log noise | Done | Mobile comparison helper and
desktop hot paths log disagreements/errors only; backend agreement
counters remain available without per-agreement log lines. |
| L5 ownership/registry notes | Done | Integrator ratifies extracted
developer intake/models/tests for the line-count boundary; the L1-owned
coverage registry declaration was reconciled at integration. |
| Ambiguous contact names | Done | Rule preserves transcript spelling
when contacts compete and forbids merging shared first names. Synthetic
packet fixture lists confusable and shared-first-name candidates without
choosing or projecting a label. |

Review-pass validation: **1,180 passed across 29 focused backend files**
after merging P71; **157 passed across six final seam files**
(overlapping the broader run), **33 Flutter tests**, **seven Swift
tests**, and **15 local Firestore emulator tests**. Pyright after the
main merge: **zero errors** (47,827 warnings under the repository's
warning-level checks). The only initial new-fixture failure was its
missing policy_version; corrected and rerun. No required finding is
deferred to the ramp. Review-pass body-aware preflight: **68 gates
passed, zero failures, zero time skips** (492 seconds). Exact-tip
pre-push passed; the remote SHA and gate receipt are recorded above.

## UI evidence

L5's real ConversationsPage hermetic renders are retained unchanged by
integration.

![Shadow
Home](https://raw.githubusercontent.com/BasedHardware/omi/5d66b99f2460e1a591d87df7323789244180f7ca/.agent-artifacts/ui-evidence/refactor-l5-clients/001-mobile-ios-home-shadow.png)
![Serve
Home](https://raw.githubusercontent.com/BasedHardware/omi/5d66b99f2460e1a591d87df7323789244180f7ca/.agent-artifacts/ui-evidence/refactor-l5-clients/002-mobile-ios-home-serve.png)

## Conflicts

Review-pass main merge: `312b4f734c2` brings the P71 as-captured archive
ruling. Resolve the `audio_archive.py` parser conflict by preserving
main's LIVE/READ default-on behavior through the shared default-on
helper; all seven refactor modes remain shadow and their cohorts empty.
The registry renderer synchronizes those inherited kill-switch metadata
fields and regenerates the doc. No refactor serving default is enabled.

Lane merge conflicts were flag declarations and dead-code metadata. The
final main merge also conflicted on the sync-router imports and the
metric-export regex: retain both route/playback imports and the union of
metric families, including main’s playback metric and the pinned
language/vendor entries. Preserve each authority's declarations, retain
consumed-contract removals, and regenerate the registry. OpenAPI and
client wire artifacts are regenerated after route composition. The
dead-code tool explicitly never generates/prunes allowlists; merge their
explicit declaration changes and validate them with the tool rather than
inventing missing exemptions. No product-code conflict was resolved by
taking an entire side.

## Risks and remaining rollout work

- No deployed/product acceptance claim: PostHog configuration, physical
Firestore TTL activation, runtime cohorts and semantic
attribution/language sampling still require the owner-led ramp.
- Source provenance absent from older/on-device results remains unknown;
partial segment overlap retains audio rather than guessing alignment.
Simultaneous read-only admissions can still duplicate provider spend
before transactional dedupe observes a committed winner.
- Speaker calibration starts at existing operating points and
process-local embedding caches do not imply cross-replica reuse.
Evidence can briefly lag transcript persistence.
- Persistent sealed merge cleanup failure stops after five attempts,
retaining its survivor and durable failure record for reconciliation. No
speculative restoration after correction anchors move.
- L3 filtering only drops explicit `out_of_profile` metadata. The
independent live language observer remains telemetry-only; expanding
stored classification and the topic request's optional classified-input
support is follow-up work, not a new heuristic in this integration.
- GPU policy source closure and local tests do not prove a deployed GPU
image. Client screenshots remain the L5 hermetic page evidence; no
named-bundle live E2E or physical-device custody test is claimed.

## Deletion follow-up after bake

1. Retire legacy capture text/clock dedupe, open-target selection and
config parsers only after missing-speech and held-work gates are clean;
add the same-audio-twice synthetic soak case to private staging tooling.
2. Retire competing speaker hard-label writers and legacy voiceprint
replacement after evidence/receipt and Undo acceptance; keep
released-client sentinel reads until supported versions adopt explicit
owner events.
3. Retire the legacy notes packet/output/prompt branches after quality
sampling; move remaining offline-only episode selection/tier helpers
alongside evaluation code.
4. Retire legacy merge admission and redundant speech-clock readers
after outbox recovery bake; stop `finished_at` compatibility dual-writes
only when all consumers migrate.
5. Retire old Home, local-label and 500-segment/refusal/compaction paths
after client adoption. Verify physical staging TTL and account-erasure
coverage before deleting migration adapters.
6. Append-only segment storage and the pusher session-state restructure
remain separate follow-ups.

🤖 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/23335?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="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/23335?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23335&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
Git-on-my-level added a commit that referenced this pull request Oct 23, 2026
…/actions/vocabulary, MCP read-API correctness (shadow by default) (#23358)

## What and why

Integrate wave 2 of capture, speaker evidence and notes against the
reviewed wave-1 authority. This is a branch-only handoff: no PR, merge
to main, runtime cohort, deployment or production data access. All
implementation commits use the requested co-author trailer.

- Wave 1: merged origin/refactor-integration first (2ca1c67); main
had not absorbed #23335 at intake. Its verified merge f6021c0 landed
at 2026-10-22 20:39:40Z and is now merged here.
- V1 speakers: 4c368cc. Participant hints and bounded
compatible-cluster reduction, explicit channel/near-field/voice anchors,
ambiguity-preserving people matching and enrollment quality. Applied
speakers-live-name-hook.patch. Reconciled the newer wave-1 abstention
contract: preserve unresolved identity while allowing compatible count
consolidation.
- V2 media/noise: 1519a9a. Applied media-consumer-integration.patch.
Classify before notes, keep media/noise history with deterministic
minima, suppress memory/task/recap derivation through one shared helper,
and persist terminal intelligence suppression for replay. Explicit
restore/reprocessing clears the exclusion and marker. Shared live/sync
hallucination admission remains cohort-only.
- V3 cross-device: a05a1f8. Completed-capture shared-speech
reconciliation and exact-key coverage aliases reuse the ledger and
capture-group writer. Originals and audio remain; unique secondary
speech remains visible. Streaming partial-window suppression and
automatic secondary-socket dispatch remain unimplemented.
- M MCP: 34d47d3. Correct filtered memory candidates, bounded
default lists, fair batch budgets/continuations, whole-window screen
aggregates, truthful counters/stubs, call metadata, provenance and
explicit timezones. Additive read correctness is on by default, as
authorized in lane M. Omitted timezone retains released UTC behavior.
- V4 calls/recaps/actions/vocabulary: d4509d3.
Completed-local-day/grace-period recaps, durable states and rollback
recovery, positive-evidence call metadata, owner-involved commitments
and bounded Soniox vocabulary. Applied calls-boundary-integration.patch
and calls-prompt-integration.patch, including authenticated agent
identity and cohort-sensitive notes cache identity. Automatic stale task
mutation remains partial: its producer-bound reference and canonical
CAS/reminder adapter do not exist in this lane. Older screen/desktop
producers still need explicit joined-controls evidence.

## Defaults, flags and ramp

SPEAKER_EVIDENCE_MODE, MEDIA_NOISE_MODE, CAPTURE_COVERAGE_MODE,
NOTES_PACKET_V2_MODE, EPISODE_BOUNDARIES_MODE, LIFECYCLE_V2_MODE,
CALLS_RECAP_MODE, ACTION_ITEMS_V2_MODE and STT_VOCAB_MODE remain shadow.
No serve cohort is configured. Existing client flags remain off/unknown.
Costly shadow database writers use refactor_modes.shadow_sampled:
CAPTURE_COVERAGE_MODE_SHADOW_PERCENT,
SPEAKER_EVIDENCE_MODE_SHADOW_PERCENT and
EPISODE_BOUNDARIES_MODE_SHADOW_PERCENT, each default 5.
STT_VOCAB_MODE_SHADOW_PERCENT samples source reads at default 1. Serve
cohorts always write and zero disables sampled writes. All bindings are
declared and the registry regenerated. Invalid percentages keep the
bounded default. V4 phone/calendar boundary publication is serve-only
under CALLS_RECAP_MODE; shadow projects the evidence locally without
authority writes. No CALLS_RECAP_MODE_SHADOW_PERCENT binding is needed
for this serve-only choice. On-demand recaps explicitly bypass scheduled
grace; all scheduling/backfill keeps the completed-day grace.

Owner dazheng, by 2026-10-26: synthetic integrated acceptance, reviewed
runtime digest pilot, then 1% -> 5% -> 25% -> 100%, one full lookback
window per step. Keep modes shadow while configuring sampled serve
cohorts; mode serve is the 100% stage. Align producer/consumer runtime
cohorts (especially speaker/boundary evidence with media and calls) so
sampling does not make serving evidence unavailable. No expansion until
manual/identity violations, false folds, lost unique speech/custody,
false owner-call/media exclusions, genuine-speech drops and duplicate
recap deliveries remain zero. Inspect speaker count/anchor/agreement
metrics, omi_media_noise_shadow_total (especially repeated_sentence
admission receipts), cross-device duplicate/examined lines, coverage
admits/seconds, sync failures/latency and vendor spend. No paid
duplicate generation/transcription in shadow. Rollback modes to off and
clear runtime cohorts; durable lifecycle obligations still reconcile.
Persisted groups/classifications are non-destructive and may need
restore/reprocess after rollback. Budget cohort entry for one
regeneration per fingerprint-less legacy day inside the seven-day
lookback (subject to the existing per-run backfill cap); retained IDs
and delivery receipts prevent duplicate notifications. No serve cohort
was enabled for this work.

## Review disposition

| Review finding | Status | Resolution / reason |
| --- | --- | --- |
| V1 #1 nullable speaker | Done | Never project a null cluster speaker
into a numbered segment; production-seam regression. |
| V1 #2 count metrics | Done | Producer and observer share a
voice/channel partition helper; channel splits are not reductions. |
| V1 #3 learning state quality vs stale fence | Skipped | Requires
changing the transactional publication result and learning-state
contract, beyond a mechanical fix. Existing bounded quality counter
distinguishes rejection; track before serve ramp. Enrollment and
unpublished-blob cleanup remain protected. |
| V1 #4 live name-only guard | Done | Supplied patch applied before
text-only lookup/create/map mutation. |
| V1 #5 count cues | Skipped | No threshold change without audited
acceptance data. Acoustic thresholds, cannot-links and abstention
retained; count hints cannot force incompatible voices together. |
| V2 H1 dormant consumers | Done | Patch applied; real
processing/persistence, replay, all four consumer boundaries and
restore/reprocess exercised. |
| V2 M2 genuine foreign repetition | Skipped | No evidence supports
changing the threshold here. Zero serve cohort; pilot must audit
repeated_sentence receipts before expansion. Audio custody remains
intact. |
| V2 M3 shadow reads | Skipped | Production volume validation is outside
the no-prod-reads scope. Reads are bounded; no second paid call or
shadow media-edge write. Sampled speaker/boundary writers bound
mutations; serving pilots need aligned producer coverage. |
| V2 L1 collapsed metric checks | Done | Explicit conversation bucket
and strict unknown-check rejection with regression. |
| V2 L2 admission naming | Skipped | Distinct module namespaces, no
shared caller or behavior collision; avoid unrelated public rename. |
| V2 L3 sync hook size | Done | Existing no-content settlement needs a
small hook, covered by tests and line-count metadata. |
| V2 L4 fixtures | Done | Minimal request-authority and timeline fixture
updates retained. |
| V3 dead distinct_streams return | Done | Removed unreachable duplicate
condition; unknown devices abstain. |
| V3 shadow lane label | Done | Compare accepts explicit lane; V3 does
not emit an L1 fold observation. |
| V3 serve query transaction cost | Skipped | No query semantics change
without runtime evidence. Bounded alias validation reads remain; watch
sync latency/failures before expansion. |
| M P1 default memory failure | Done | Default lists use released-size
bounded reads, return data and explicit incomplete coverage; filtered
incomplete windows still error. |
| M P2 read amplification | Done | Physical-read regression pins bounded
default source batch. |
| M P3.1 aggregate cursor | Done | Ignore stale aggregate cursor and
explain whole-window behavior. |
| M P3.2 timestamps | Done | Released strings retained unless offset
format/timezone is requested. |
| M P3.3 calendar-day stub pagination | Skipped | Intentional
bounded-date contract; an old in-flight cursor may shift across
deployment. No historical rewrite or invented failure cause. |
| M P3.4 retired/private helpers | Done | Dead collector/branch/imports
removed; shared adapters public with migrated callers. |
| M P3.5 duplicate-ID progress | Done | Absolute occurrence cursor with
regression. |
| V4 HIGH boundary authority write | Done | Parent ruling wins: both
phone record and calendar ingest are serve-only under the calls cohort.
Shadow uses local evidence; the regression holds
EPISODE_BOUNDARIES_MODE=serve and proves a non-cohort user produces no
authority write. |
| V4 MEDIUM on-demand grace | Done | Explicit user_initiated plumbing
from generate_daily_summary_on_demand bypasses grace; scheduler/backfill
do not set it. Partial-day and post-midnight grace tests exercise the
actual producer. |
| V4 MEDIUM STT uid | Done | Both legacy initial/reconnect calls and the
managed Soniox leg pass authenticated request uid. Removed get_byok_uid
fallback; real managed config and legacy call seams are tested. |
| V4 MEDIUM vague_social / incident 09 | Done | Named counterpart plus a
concrete place/time retains owner-alias commitments, including catch up
with Matt in NYC. Fourteen incident/negative cases cover missing
feedback, CV review, Deepgram check, invitation/Drive, unrelated customs
purchase and bogus hiking. Promisor/provenance authority remains intact.
|
| V4 LOW legacy-day regeneration cost | Done | Budgeted in the ramp
above; no serve cohort enabled. |
| V4 LOW dead constants | Done | Removed six unused lane constants.
Actual shared cohort bindings now live in and are consumed by
refactor_modes._COHORT_ENVS; no env behavior changes. |
| V4 LOW stripped comments | Done | Restored explanatory shared model,
finalizer, notifications and Soniox comments/docstrings; public recap
docs distinguish legacy order and serving revision/state behavior. |
| V4 LOW inverted / expired parity labels | Done | Found vocabulary
emits agree; absent expired evidence compares the retained durable call
projection. Regression assertions pin both labels. |
| Integrator runtime-image closure | Done | All 19 contracts compared
using third_party_dependency_modules against origin/main; zero added
third-party modules. Incorporated PR #23355 branch and added GPU
closure/shim regressions. |

## Conflicts and shared contracts

Resolved person_pool.py by retaining incoming quality checks and wave-1
type annotation; duplicate_capture.py retains both lifecycle serving and
cross-device imports. Generated artifacts are regenerated from
generators, not resolved by hand. ContentKind has one literal definition
shared by stored/create models and policy; request classification stays
hidden/server-authored. BoundaryKind includes media_playback once.
Participant count and owner anchor live only in SpeakerEvidence. Call
fields are additive optional Conversation metadata; explicit boundary
proof survives canonical normalization and wire round trips. V4
persisted stubs pass through M with null generated_at. Media/noise-only
days report not_generated rather than falsely saying no recordings;
actual empty days keep no_recordings. Both one-shot and agentic prompt
mounts are exercised in off/shadow/serve.

The pipeline guide records integration, sampling, call/recap/prompt
contracts, replay and pending socket semantics. The developer storage
guide explains original-recording retention and unknown/remote metadata
without publishing rollout controls. Dead-code analyzer regenerated its
baseline without new suppressions; the allowlist tool deliberately never
auto-edits allowlists. Existing evaluator-only exceptions remain, and
imported wave-1 contract scaffolds have no stale allowlist entries.

## Runtime image closure audit (fix pass)

Merged fresh origin/main at 81270c6
after #23355 landed. It merged without conflicts and leaves exactly the
same source tree as fix commit ed2c034. Before #23355 landed, also
merged origin/fix-parakeet-policy-closure at
2d3ec70; its remote branch was deleted
after merge. No unseen remote integration commits were overwritten.

The audit independently executes each revision's
backend/scripts/runtime_image_contracts.py
third_party_dependency_modules(contract) over every registered contract
(including lazy imports), without importing application code or reading
production. There are **zero added and zero removed third-party probe
targets across all 19 images** against the final main base; no new
lockfile/requirements package is needed.

| Runtime image | Added third-party modules | Removed probe targets |
| --- | --- | --- |
| backend-api | None | None |
| backend-workers | None | None |
| backend-realtime | None | None |
| backend-gateway | None | None |
| backend-pusher | None | None |
| backend | None | None |
| desktop-backend | None | None |
| pusher | None | None |
| models | None | None |
| memory-maintenance-job | None | None |
| x-connector-sync-job | None | None |
| frame-request-retention-job | None | None |
| day3-reengagement-email-job | None | None |
| notifications-job | None | None |
| diarizer | None | None |
| batch-pipeline-worker | None | None |
| parakeet | None | None |
| nllb-translation | None | None |
| plugins | None | None |

The earlier comparison against pre-#23355 main
4499deb had zero additions in all
images; the only removals were batch-pipeline-worker: fastapi.Request,
google.api_core.exceptions.AlreadyExists, google.cloud.tasks_v2,
google.protobuf, google.protobuf.duration_pb2 and
google.protobuf.timestamp_pb2; and parakeet: utils.speakers.policy plus
its BATCH_CLUSTER/PARAKEET_CLUSTER attribute candidates. Those are the
intended #23355 repairs, now present on both sides of the final
comparison.

Batch retry policy imports the dependency-light utils.capture.retry_cap
core, avoiding utils.sync.retry_hygiene -> utils.cloud_tasks.
Dockerfile-overwritten first-party shims are explicitly excluded from
checkout dependency probes: parakeet excludes utils.logging_config and
utils.speakers.policy; diarizer excludes omi_logging,
utils.logging_config and utils.stt.diarization_turns; nllb-translation
excludes omi_logging. The copied implementations are
standard-library-only. Full-backend/pusher copies use their real source
modules rather than checkout shims. Four new regressions verify the
three shim contracts and the batch worker's separation from Cloud Tasks.
Full final JSON evidence: image-closure-diff.json; earlier comparison:
image-closure-diff-pre23355.json; reproducible script:
audit-image-closure.py.

## Additional integration findings

- Done: M's successful-row timestamp fallback incorrectly gave persisted
V4 pending/failed/empty/not-generated stubs a creation-based
generated_at. The read adapter now preserves null; five direct
regressions, four actual producer-to-reader cases and a real REST smoke
cover it.
- Done: V4 used no_recordings after filtering a nonempty media-only day,
contradicting M's true recording count. That state is now not_generated,
with actual shared-policy generation regression; true empty-day behavior
is unchanged.
- Done: wave-1 abstention must preserve labels while V1 independently
consolidates compatible count clusters. Processing now keeps that
separation and null-speaker protection.
- Done: hermetic Firestore readiness fixture now includes the new MCP
query registry dependency in its copied control checkout; readiness
behavior and index enforcement remain unchanged.
- Done: whole-backend reason-label ratchet identified three new dynamic
label sites. Media/call metrics now expose closed normalization at the
label call, and person voice rejection uses a central three-reason enum
with an unknown fallback. The guard/debt list is unchanged; a new
regression prevents unbounded quality labels.
- Done: omit an empty speaker energy header so inactive cache
serialization remains byte-identical to the existing format; populated
energy metadata still round-trips. Whole-suite cache parity regressions
and four explicit cache tests cover both contracts.
- Done: isolated legacy fixtures retain real pure policies/metric owners
before package stubs, initialize media admission state, execute call
metadata in explicit off mode, and stub new profile/screen reads. Usage
tests supply eligible recordings and target the retained legacy budget
entrypoint; task response assertions include additive source without
exposing lifecycle fields. Historical telemetry byte parity runs with
speaker evidence off, while active energy cache reload has a separate
regression. Voice-pool retention fixtures use compatible, normalized
samples; V1 rejection guards remain intact.

## Validation

Pre-V4 combined validation on ec9bd4f6695: **2,725 passed across 97
focused backend files**, 15 standard marker deselections, no skips. Real
live name gating, media processing/persistence/restore, replay, recap
consumers and V4/M stub timestamps have integrated regressions.
Repository preflight: **65 selected checks passed**; metadata
validation: five passed. Separate CI slow guardrails: **2,049 passed**,
1,342 deselected (all 25 manifest files). Flutter
capture/labels/Home/parity: **86 passed, 5 existing skips**. Swift
capture/group/decoder suites: **33 passed**. Actual loopback
REST/JSON-RPC smoke: **nine passed**, external connects blocked and
synthetic stores only; server stopped. Full backend Pyright: **zero
errors**, existing warning debt retained.
App-client/public/integration-public OpenAPI and all
Dart/Swift/TypeScript generators completed; dead-code baseline
regeneration made no suppressions or tracked changes.

Final whole-backend selection: **2,244 runnable files**, **48,510
passed**, 84 skipped and 2,120 deselected by the standard marker policy.
It ran once and reported 496 failed cases plus nine setup errors across
**14 files**. Those exposed the cache header/metric-label contracts and
isolated fixture dependencies described above. All 14 failed files are
repaired: the final 15-file scoped selection passed **860 tests**,
followed by **94 passed** in the workflow fixture after its missing
module copy was added (**954 green scoped tests across 16 files**,
including the new cache and quality-label regressions). The whole suite
was not rerun. Logs: integration-full-backend.log,
integration-failed-files-final.log and integration-workflow-repair.log
in this brief directory.

Post-V4 validation also passed: full Pyright zero errors; all 25 CI
slow-guardrail files 2,049 passed/1,342 deselected; Flutter 86
passed/five skips; Swift 33 passed; loopback HTTP smoke nine passed.
Repository preflight passed 65 checks after the cache repair; metadata
passed five checks. V4/shared composition passed all 13 cases and
latest-main FinOps selection passed 113 tests across six files.
Regenerated OpenAPI and Dart/Swift/TS artifacts are current. All backend
suites use nice -n 10, the worktree-local Python 3.11 environment and
BACKEND_UNIT_TEST_FILE_LIST through omi-heavy. The normal pre-push gate
**passed** on pushed head **9fc0e7118efd407b933b7f7e1417cbfe0e958529**:
65 preflight checks, full Pyright (zero errors), runtime source closure,
the bounded 40-file backend selection, generated OpenAPI/Dart/Swift
artifacts and the native Swift build. No hook was bypassed. The remote
wave2-integration ref was verified equal to that head after the push.
GitHub reports a completed/skipped Mintlify check and no commit status
checks; this branch-only handoff does not claim full PR CI.

No production reads, api.omi.me calls, user content, cloud changes,
device claims or deployment. GCP tier: none. Local validation is not
full PR CI or production acceptance; no PR is authorized.

## Fix-pass verification

The 16-file focused selection passed 475 tests. After adding four
runtime-image regression cases, its image-contract file passed all 66
tests (the original 62 plus four new), giving **479 distinct focused
cases green across the 16 files**. Full Pyright passed with zero errors
(48,941 non-blocking warnings). Logs: fix-pass-focused-tests.log,
fix-pass-image-tests.log and fix-pass-pyright.log. The whole backend
suite was not rerun. No Flutter or Swift source changed in this pass;
the normal pre-push gate still performs its configured native/generated
validation.

The full metadata/preflight run passed 65 checks in 250.84 seconds
(fix-pass-metadata.log). The subsequent merge of main is
source-identical: both source trees are
33f6033. Current fix-pass head is
58d4c61. The normal pre-push gate
passed on 58d4c61: 65 preflight checks
(189.64 seconds), full Pyright zero errors, runtime source closure, the
bounded 40-file backend selection, OpenAPI/generated-client checks and
native Swift build/checks. The fast-forward push 9fc0e71 ->
58d4c61 completed, and git ls-remote verified that exact full SHA at
refs/heads/wave2-integration on 2026-10-22 23:15:18Z. Working tree is
clean. GitHub reported zero commit statuses and zero check runs at
verification; no full PR CI claim is made. No approval or hook bypass
was used. Log: fix-pass-push.log. Final saved handoff metadata
revalidation passed five checks (fix-pass-metadata-final.log).

## Owner-replay fixes (wave-1 code, found by the offline replay)

- Episode boundaries: screen-meeting contexts carry the shared sentinel
id `screen-activity`, so every screen window hashed to one
boundary-signal identity (a later window was rejected as an immutable
start change; batches collapsed). `context_signal` now drops that
sentinel and screen-source ids, so each window keys by its own start.
Behind `EPISODE_BOUNDARIES_MODE` (shadow writes are sampled). Test:
`test_distinct_screen_windows_get_distinct_identities`.
- Contact spelling: a contact the user created by hand (no voice labels
yet) was excluded from trusted spellings, so a correct contact name
never reached the notes prompt. `is_user_created` is written only by the
user create and rename paths (automatic detection never creates people),
so it now counts as stored user evidence. This intentionally applies to
the legacy prompt too: it only adds names the user typed.

- Shadow cost: the media/noise classifier
(`relevance_media.classify_for_processing`) and cross-device reconcile
(`coverage_crossdevice.reconcile`) read Firestore per finalize. Their
shadow now runs for a 5% uid sample (`MEDIA_NOISE_MODE_SHADOW_PERCENT`,
`CAPTURE_COVERAGE_MODE_SHADOW_PERCENT`) via
`refactor_modes.shadow_sampled`; serve cohorts always run. Found by the
default-inertness audit.

## Risks and remaining work

Precision-first speaker/media and whole-secondary alignment can abstain
or retain duplicates. Missing SNR/confidence uses deterministic
source/duration order. V3 live secondary receipt dispatch and
partial-window suppression require durable frame alignment; only exact
committed aliases may release custody. No historical memory/task/recap
repair. MCP indexes are declared but not deployed; fallback and
bounded-window uncertainty remain explicit. Historical watching
intervals and past recap failure causes cannot be reconstructed. Runtime
TTL activation and all serve ramps remain separately scoped operator
work. V4 screen/desktop positive-proof production and automatic stale
task mutation remain partial; the supplied backend boundary and both
notes prompt hooks are integrated.

Invariant-Impact: INV-AUTH-1, INV-MEM-1, INV-MEM-3, INV-MEM-4,
INV-MEM-5, INV-CAP-1, INV-TASK-2. Auth/privacy and canonical memory/task
authorities are preserved; capture custody requires exact durable proof.
No unsupported attribution becomes an owner claim.

Failure-Class: FC-split-mutation-authority
V3 lane classification: FC-same-speech-captured-twice-surfaces-twice
M lane classification: FC-raw-page-limit-before-visibility-filter
Failure-Class-Guard: backend/tests/unit/test_cross_device_coverage.py
Failure-Class-Guard: backend/tests/unit/test_wave2_media_integration.py
Failure-Class-Guard: backend/tests/unit/test_mcp_read_correctness.py

Wave 1 client evidence is retained in this integration; V2 adds no UI
source:
![Shadow
Home](https://raw.githubusercontent.com/BasedHardware/omi/5d66b99f2460e1a591d87df7323789244180f7ca/.agent-artifacts/ui-evidence/refactor-l5-clients/001-mobile-ios-home-shadow.png)
![Serve
Home](https://raw.githubusercontent.com/BasedHardware/omi/5d66b99f2460e1a591d87df7323789244180f7ca/.agent-artifacts/ui-evidence/refactor-l5-clients/002-mobile-ios-home-serve.png)



Line-Count-Exception: backend/database/users.py | 2496 -> 2507 | Small
authority integration hooks; substantive policy lives in focused owning
modules.
Line-Count-Exception: backend/routers/listen/receiver.py | 2780 -> 2782
| Thread authenticated request identity into the two existing Soniox
call sites; vocabulary policy stays in its owning module.
Line-Count-Exception: backend/routers/listen/transcripts.py | 1648 ->
1655 | Small authority integration hooks; substantive policy lives in
focused owning modules.
Line-Count-Exception:
backend/utils/conversations/process_conversation.py | 3212 -> 3233 |
Small authority integration hooks; substantive policy lives in focused
owning modules.
Line-Count-Exception: backend/utils/conversations/speaker_resolution.py
| 1560 -> 1564 | Small authority integration hooks; substantive policy
lives in focused owning modules.
Line-Count-Exception: backend/utils/sync/pipeline.py | 3657 -> 3671 |
Small authority integration hooks; substantive policy lives in focused
owning modules.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
MichaelC001 pushed a commit to MichaelC001/omi that referenced this pull request Nov 11, 2026
Replace the 35-file source digest that keyed notes/L1 reuse with an explicit
prompt version, guarded by a pinned prompt-source digest in the test. A deploy
that touches unrelated code no longer voids every stored hash.

Skip the L1 memory-extraction call for noise rows and owner speech under 30
words. Unknown owner attribution is never read as owner absence; a curated row
always extracts; nothing is written on a skip.

Fable LLM-efficiency BasedHardware#5 and BasedHardware#7.
Dimank92 pushed a commit to Dimank92/omi that referenced this pull request Nov 11, 2026
Replace the 35-file source digest that keyed notes/L1 reuse with an explicit
prompt version, guarded by a pinned prompt-source digest in the test. A deploy
that touches unrelated code no longer voids every stored hash.

Skip the L1 memory-extraction call for noise rows and owner speech under 30
words. Unknown owner attribution is never read as owner absence; a curated row
always extracts; nothing is written on a skip.

Fable LLM-efficiency BasedHardware#5 and BasedHardware#7.
kodjima33 added a commit that referenced this pull request Nov 24, 2026
…ize (#26237)

## Problem

At the largest iOS text size (AX5) a new owner cannot get in, and
several entry screens break. Shot on the simulator on main (critic run
2026-11-24, design.md top 5 #5, re-shot here):

- Sign-in: the title fills the card ("Speak / . Tran / scribe") and the
sign-in button is below the fold.
- Data & Privacy: "Agree & C..." and "Use a Diff..." are cut off.
- Home: "Home Tas" overflows by 72 px.
- Activity: the header reads "NEED / S AT / TENT / ION" beside a large
Retry all.
- Plan & Usage: the "Omi Pro" badge shows one letter per line.
- Conversation detail says "Action items" where the rest of the app says
"Tasks".

Reach: onboarding was shown 5,295 times in 30 days (ACTUAL, PostHog, Nov
19 read). PostHog has no text-size property, so the share of readers at
the accessibility sizes is unknown.

## Change

What the reader sees at the default size is unchanged (pixel diff 0 on
four screens; Home and conversation detail differ only in seeded times
and the Tasks label).

- Sign-in (`onboarding/auth.dart`): the buttons and legal line move into
the card's pinned footer, as on the other onboarding steps. The title
stops growing past 1.5x and the button labels past 2x, so Apple, Google
and the legal line all fit on an iPhone SE at the largest size. Button
heights are minimums with padding above and below the label.
- Data & Privacy (`ai_consent_widget.dart`) and the cancel final step
(`cancel_subscription_sheet.dart`): button labels wrap instead of
cutting off. `OmiButton`'s named variants now take `maxLines` (the
default constructor already did), and a label that may wrap gets
vertical padding (12 pt, 8 pt compact); one line still fits inside the
48 and 36 pt minimums. `app/docs/ux-contract.md` notes it.
- Home (`home_tab_switcher.dart`): Home and Tasks shrink together to fit
beside the actions. At the largest size the shrunk words are about 30 pt
tall, under the 44 pt target; acceptable for this pass.
- Activity (`needs_attention_section.dart`): at 1.6x and up, Retry all
sits under the header, as the rows' Try Again already does.
- Plan & Usage (`usage_page.dart`, badge row only): at 1.6x and up,
Manage Plan sits under the badge.
- Conversation detail: the task header uses the existing `tasks` string.
The unused `meetingActionItemsTitle` is removed from all 49 locales with
`scripts/l10n.py remove`.

## Impact estimate

> If the sign-in buttons are reachable at the largest text size,
free→paid (device owners) stays 30.41% → 30.41% (30.4% to 30.5%), with
about 12 to 38 more paying owners a month.

- A = 30.41% (3,270 / 10,753 owners), ACTUAL,
`runs/2026-11-24/metrics.json`.
- Reach: 5,295 onboarding views / 30 d, ACTUAL (PostHog, Nov 19). Share
at the largest sizes 1-3%, MODELED (no text-size property in PostHog):
about 50-160 people a month who today cannot see the sign-in button.
- Rate: sign-in completion for them goes from about 0% to the normal
rate, MODELED.
- Downstream: 23.7% of owners pay within 30 days of pairing, ACTUAL (791
/ 3,338, metrics.json): 12-38 more paying owners a month.
- Why the rate barely moves: the owner metric only counts people who
signed in and paired, so the newly admitted readers join the denominator
too. At the average pay rate the ratio stays at 30.4%; the gain is in
paying owners, not in the percentage. The brief's 30.5% is the upper end
if these readers pay like the rest.

## Evidence

Each image: BEFORE default | AFTER default | BEFORE largest | AFTER
largest, light. Sign-in and consent add AFTER largest, dark.


![Sign-in](https://raw.githubusercontent.com/BasedHardware/omi/4d38fb37a7c4b6e7d7960975048b55c6f892339a/.agent-artifacts/ui-evidence/mux-2026-11-24-largest-text/001-mobile-ios-sign-in-before-after.png)

![Consent](https://raw.githubusercontent.com/BasedHardware/omi/4d38fb37a7c4b6e7d7960975048b55c6f892339a/.agent-artifacts/ui-evidence/mux-2026-11-24-largest-text/002-mobile-ios-consent-before-after.png)
![Home
tabs](https://raw.githubusercontent.com/BasedHardware/omi/4d38fb37a7c4b6e7d7960975048b55c6f892339a/.agent-artifacts/ui-evidence/mux-2026-11-24-largest-text/003-mobile-ios-home-tabs-before-after.png)

![Activity](https://raw.githubusercontent.com/BasedHardware/omi/4d38fb37a7c4b6e7d7960975048b55c6f892339a/.agent-artifacts/ui-evidence/mux-2026-11-24-largest-text/004-mobile-ios-activity-needs-attention-before-after.png)
![Plan &
Usage](https://raw.githubusercontent.com/BasedHardware/omi/4d38fb37a7c4b6e7d7960975048b55c6f892339a/.agent-artifacts/ui-evidence/mux-2026-11-24-largest-text/005-mobile-ios-plan-usage-badge-before-after.png)
![Conversation
detail](https://raw.githubusercontent.com/BasedHardware/omi/4d38fb37a7c4b6e7d7960975048b55c6f892339a/.agent-artifacts/ui-evidence/mux-2026-11-24-largest-text/006-mobile-ios-conversation-tasks-before-after.png)

| check at the largest size | main | this PR |
|---|---|---|
| Sign-in button on screen without scrolling | no | yes |
| Consent labels | cut off | full, wrapped |
| Home tab row | overflows 72 px | fits |
| Needs attention header | breaks mid-word | whole words |
| Omi Pro badge | one letter per line | one line |
| Default size, light and dark | | unchanged (pixel diff) |

Simulator: iPhone 17 Pro, iOS 26.2, local backend, seeded accounts.
Light, dark and largest shots for every screen, plus demo video, are in
the MUX run folder `runs/2026-11-24/p1/` (not in git).

## At ship

No flags, no events, no backend change.

## Tests

- `test/widgets/largest_text_entry_screens_test.dart`, at 3.1x: sign-in
on a 402x874 phone, on an iPhone SE (375x667) with both Apple and Google
buttons (test-only `debugShowAppleSignIn`, since a host test cannot set
`Platform.isIOS`) and on a 360x800 Android-size phone with Google only,
each asserting no overflow and every button plus the legal line on
screen; consent labels not cut off and padded; no tab row overflow and
Tasks tappable; Needs attention header above Retry all; badge on one
line. The SE, consent and the four other screen tests fail without this
PR.
- `conversation_action_items_section_test.dart` updated for "Tasks".
- 44 related suites, 603 tests pass; after the review fixes the button
and onboarding suites, 446 tests, pass (Flutter 3.44.5). Default size
re-checked on the simulator after the padding change: sign-in and
consent are 0 px different from main, light and dark. `l10n.py check`
ok; mobile UX contract, UI isolate and brand checks clean on the changed
lines.

## Not verified

- Sign in with Apple and Google buttons were not shot: simulator builds
show "Sign in (local dev)" in the same footer. The widget tests cover
both on an iPhone SE and Google on an Android-size phone.
- The cancel final step's wrapped labels were not shot on the simulator.
- No new-language shots: "Tasks" reuses a string every locale already
has.
- Not changed here: Plan & Usage period tabs ("Tod Mon Year All") and
stat tiles at the largest size, and an overflow marker at the bottom of
Home at the largest size.

## Product invariants affected

none

## Failure class (fixes)

Failure-Class: none

UI-Evidence: see the images above
(.agent-artifacts/ui-evidence/mux-2026-11-24-largest-text)
Git-on-my-level added a commit that referenced this pull request Nov 27, 2026
…s 503 (SCA-2225) (#26458)

## What

Every handler-level designed 503 refusal on `POST /v2/sync-local-files`
now writes exactly one INFO record:

`sync_upload_refused uid=%s status=503 reason=%s trace=<32-hex
X-Cloud-Trace-Context id>`

The mechanism lives in `utils/sync/designed_refusal.py`:
- The handler calls `mark_designed_refusal(...)` right before the
designed 503.
- `designed_refusal_outcome`, the innermost decorator, captures the
handler's own response or exception.
- `records_designed_refusals`, outside `custody_upload`, writes the
record only if the final outcome is that same object and is a 503. A 503
that the custody finalizer substitutes is left unrecorded.
- The fence cutover is marked only when `SYNC_LEDGER_FENCE_MODE` is
explicitly `standby`, so an invalid setting that fails closed is not
marked.

The existing `backfill_day_cap` line moves onto this mechanism. Failure
503s write no record. Those include `sync_dispatch_unavailable` (staging
or sequencer), `sync_batch_unavailable` from batch-admission errors,
custody, config and platform 503s.

## Why

SCA-2225. The Cloud Run rollout guard used to exclude every
sync-local-files 503 (`refusal_statuses: [503]`), which hid real
failures. Removing that exclusion outright flips the labelled trip
backtest, because designed backpressure then counts as errors. Luna
approved a design on SCA-2225 (2026-11-27T00:09Z): exclude a 503 only
when the same revision logged a designed-refusal record for the same
request, and hold on anything that cannot be reconciled. The `trace=`
field lets the guard match each record to its own request log
one-to-one, so window edges do not skew the counts. The guard side of
the change is a separate PR stacked on #26438 (linked below).

Production shape check (ro-prod `read-only-bot-account`, 2026-11-27,
projections only, no payloads or uids read): backend-sync 503 request
logs for this route carry `trace=projects/based-hardware/traces/<id>`.
The existing `sync_upload_refused … status=503` records land in
`run.googleapis.com%2Fstdout` with `resource.labels.revision_name`.

### 503 inventory: `POST /v2/sync-local-files` (BasedHardware/omi
`origin/main` f628eab)

Line numbers are at f628eab. "Record" means one `sync_upload_refused
uid=… status=503 reason=… trace=…` line. The handler marks the refusal
right before its 503, and the outermost wrapper writes the line only if
that same 503 is the final response. Before this change, only #8 wrote a
record, and that record had no trace. `sync_upload_refused` is written
only inside `sync_local_files_v2`; no other route or file writes that
string.

| # | file:line | code | trigger | designed? | record before | record
after |
|---|---|---|---|---|---|---|
| 1 | utils/sync/stage.py:50 (router dependency) | stage unavailable |
`OMI_ENV_STAGE` missing or invalid | failure (config) | no | no (counts
as error) |
| 2 | utils/other/endpoints.py:65 | `directory_routing_unavailable` |
directory resolution fails | failure | no | no |
| 3 | utils/other/endpoints.py:112 |
`account_deletion_state_unavailable` | deletion-fence read raises |
failure | no | no |
| 4 | utils/account_cutover/access.py:260/262 |
`account_cutover_state_unavailable` | cutover state unreadable | failure
| no | no |
| 5 | live_upload.py:118 via `memoized_record_wait` (sync.py:852) |
`record_capture_pending` | cached conversation-level wait | designed |
no | **no (gap, see below)** |
| 6 | sync.py:873 | `sync_ledger_fence_cutover` | fence mode STANDBY |
designed pause only when explicitly configured* | no | **yes, explicit
standby only** `sync_ledger_fence_cutover` |
| 7 | sync.py:973 | `backfill_capacity` | backfill lane,
`SYNC_BACKFILL_ENABLED` off | designed (kill switch) | no | **yes**
`backfill_disabled` |
| 8 | sync.py:1040 (log at 1038) | `backfill_capacity` | unlimited_v2
backfill day cap | designed | yes, no trace | **yes**
`backfill_day_cap`, now with trace |
| 9 | utils/sync/record_token_lease.py:120 | custody admission |
`record_custody_append.begin` raises | failure (custody) | no | no |
| 10 | utils/sync/receipt_clock.py:197 / :204 |
`capture_clock_anchor_unavailable` | :197 too many scopes (bounded
refusal); :204 read fails | :197 designed, :204 failure | no | no (gap
for :197) |
| 11 | sync.py:1118 | "Historical recovery is paused" | retained
recovery while backfill is off | designed | no | **yes**
`retained_recovery_disabled` |
| 12 | sync.py:1169 | `capture_clock_identity_required` | future-clock
files with no device id | designed | no | **yes**
`capture_clock_identity_required` |
| 13 | live_upload.py:118 via record router (sync.py:1265,
intake.py:750) | `record_capture_pending` | 9 wait reasons are designed;
4 `*_failed` reasons are failures | mixed | no | no (gap for the waits)
|
| 14 | intake.py:749 | `record_capture_pending` | `record_router` is
None | wiring fault, unreachable | no | no |
| 15 | utils/batch_pipeline/upload_coalescing.py:242 |
`sync_batch_unavailable`, Retry-After 1 | coalescing wait | designed |
no | no (gap) |
| 16 | intake.py:987 | `sync_batch_unavailable` | decode-failure memo
hit | designed repeat | no | no (gap) |
| 17 | intake.py:1271 (`FutureCaptureRetry`) |
`capture_clock_anchor_pending` / `identity_required` /
`anchor_unavailable` | clock anchoring in batch decode | pending and
identity designed; unavailable failure | no | no (gap) |
| 18 | intake.py:1298 | `sync_batch_unavailable` | any batch-admission
exception | failure | no | no |
| 19 | sync.py:1421 | `sync_batch_unavailable` | batch declined an
estimated or retained-clock upload | designed decline | no | **yes**
`repaired_clock_batch_declined` |
| 20 | sync.py:1608 | `backfill_capacity` | backfill lane but not Cloud
Tasks eligible | failure (config, fail closed) | no | no |
| 21 | sync.py:1664 | `dispatch_hold` | staging hit
`DestructiveOperationInProgress` | designed pause | no | **yes**
`dispatch_hold` |
| 22 | sync.py:1675 | `sync_dispatch_unavailable` | GCS staging failed |
failure | no | no (counts) |
| 23 | sync.py:1758 | `sync_dispatch_unavailable` | sequencer
registration failed | failure | no | no (counts) |
| 24 | record_token_lease.py:93 (`@custody_upload` finally) | custody |
`record_custody_append.finish` raises; can replace any response |
failure | no | no |
| — | Cloud Run platform | — | no instance, queue full, crash | infra |
no app log | no (counts) |

\* #6: an invalid fence setting also fails closed to STANDBY
(`database/sync_jobs.py:154`) and returns the same 503. Since 61972e1,
only `SYNC_LEDGER_FENCE_MODE=standby` is marked; an invalid setting
stays unrecorded and counts as an error (regression test included).

**Records gap (designed, but still counted as errors):** #5, #10:197,
the wait reasons in #13, #15, #16, and #17 pending/identity. These 503s
come from below the handler: `live_upload`, batch intake,
`receipt_clock`. There the request's trace is not in scope, and the same
response code is shared with failure paths. Batch intake's outer `try`
also rewrites exceptions into the generic `sync_batch_unavailable`.
Recording them needs the trace passed down (for example a contextvar)
and its own review. Until then they count as errors on both revisions,
which is the conservative direction: a candidate that changes their rate
is scored as a 5xx change.

**Custody finalizer (#24), fixed in 61972e1:** the record used to be
written before `@custody_upload` finished, so a finalizer 503 could
replace a designed response after its record existed. Now
`designed_refusal_outcome`, the innermost layer, captures the handler's
own response or exception, and `records_designed_refusals`, outside
`custody_upload`, writes the record only if the final outcome is that
same object and is a 503. A finalizer-replaced 503 stays unrecorded and
counts (regression test included).

**Logging path:** the `utils/sync/designed_refusal.py` logger propagates
to the root handler that `main.py:27` installs through
`configure_logging(K_SERVICE, default_format='text', …)`. That handler
writes INFO to stdout as `INFO utils.sync.designed_refusal:
sync_upload_refused uid=… status=503 reason=… trace=<32 hex>`. Cloud Run
ingests stdout as `textPayload` in `run.googleapis.com%2Fstdout` and
labels it with `resource.labels.revision_name`. The trace comes from the
`X-Cloud-Trace-Context` header the handler already declares. It is the
trace id Cloud Run writes into the request log's `trace` field. No PII
is added beyond the existing `uid=` pattern.

## Composition and order

- This PR touches no guard files, so it has no conflict with #26438
(`lane/holdback-wiring`). The guard change is a separate PR stacked on
#26438: #26459. The workspace copy is Git-on-my-level/omi-workspace
#586.
- **Order:** this PR should be serving on backend-sync before either
guard change scores Sync. Before that, a revision's old
`backfill_day_cap` record carries no `trace=`, and the guard holds
(`INSUFFICIENT_DATA refusal_records_unparseable_record`) on any window
where that revision logged one. The first comparison against a pre-trace
inverse can therefore hold once.
- Rollback: revert this PR. The records are log-only; responses and
behavior are unchanged.

## Verification

Run with `omi-heavy run -- timeout 1800 bash test.sh …` (local,
hermetic):
- `test_sync_designed_refusal_record.py`: 19 passed.
- `test_sync_backfill_day_cap_upload.py` 11,
`test_logging_entrypoint_guard.py` 51,
`test_sync_ledger_fence_cutover.py` 14, `test_sync_capture_time_skew.py`
160: all passed.
- The other suites that touch `sync_local_files_v2` (future-early
parity, schema inventory, legacy dark, fair use, mobile standard batch,
batch language router, cloud tasks, assignment recovery, `test_sync_v2`,
batch intake outcome, custody admission privacy): 14, 15, 48, 30, 27,
31, 40, 210, 13, 51 and 193 passed.

The new tests cover:
- the record format and trace parsing, and the guard parser reading the
shared text format;
- a raised designed 503, which is recorded once and still raised;
- a mark made without the outer recorder, which writes nothing;
- **custody finish failing after a designed refusal**, which gives the
finalizer's 503 and no record; a clean finish records once;
- a wrapper replacing the response, which writes no record;
- the decorator order: recorder, then custody, then observe, then
capture, then handler;
- **an explicit `standby` fence, which is recorded; an invalid setting
(`stanby`, `on`) gives the same 503 with no record and logs
`invalid_config`**;
- a real over-cap upload, which writes exactly one traced record;
- an AST check that the seven marks each sit directly before a designed
503.

Not proven here: that production records carry the trace id. That needs
this PR serving, then a READBACK that `sync_upload_refused … trace=`
lines match request-log traces on the same revision.

Line-Count-Exception: backend/routers/sync.py | 4393 -> 4405 | seven
designed-refusal marks, the explicit-standby guard and two decorator
lines; the mechanism lives in utils/sync/designed_refusal.py

## Product invariants affected

none

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

3 participants