Repository navigation
Episodes batch 2: shadow fact log, leased drain, and Home read ramp - #24607
Git-on-my-level wants to merge 54 commits into
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
8 issues found across 67 files
Confidence score: 3/5
- In
episode_log.py, removed membership links are never cleared, solinked()can keep returning an episode after it was removed. Add a deletion or tombstone path to the fold and publish it. - In
projector.py, repointing an episode can append its owner more than once, leaving duplicates in the view. Guard the append so each owner appears once. - In
clock.py, exceeding the 128-clock cap stopsdrain()before the episode projection is committed for that user. Handle excess clocks without aborting the full projection.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/tests/unit/test_episode_log_telemetry.py">
<violation number="1" location="backend/tests/unit/test_episode_log_telemetry.py:34">
P2: Multi-label relabel rules are skipped silently, so a `drop` on `__name__` plus another label that removes `omi_episode_*` series would still pass. Check the name part of those rules against the episode names instead of skipping them.</violation>
</file>
<file name="backend/tests/unit/test_firestore_field_indexes.py">
<violation number="1" location="backend/tests/unit/test_firestore_field_indexes.py:74">
P2: Removing these count pins leaves no test that detects an unintended change to the field-index set. The comparison against `FIELD_INDEX_REQUIREMENTS` is circular because the manifest is generated from that same constant. Keep an explicit expected-count or expected-set assertion, and update it deliberately when requirements change.</violation>
</file>
<file name="backend/utils/episodes/log/projector.py">
<violation number="1" location="backend/utils/episodes/log/projector.py:381">
P2: This appends the owner to `self.episodes` even when it is already there from an earlier repoint, so the discarded episode appears twice in the view. Guard the append so it only happens once.</violation>
</file>
<file name="backend/utils/episodes/log/policy.py">
<violation number="1" location="backend/utils/episodes/log/policy.py:40">
P2: Each decorated conversation write adds two owner-document transactions and two appended facts for every enabled user with existing state. That amplifies owner-doc contention and drain work during bursts of conversation writes. Confirm the write rate is acceptable, or coalesce barrier and refresh facts per user.</violation>
</file>
<file name="backend/utils/episodes/log/clock.py">
<violation number="1" location="backend/utils/episodes/log/clock.py:24">
P3: This call goes through the `settling_hold` shadow decorator, so every drain adds samples to the reader-agreement counters. Those counters are meant to measure legacy Home reads. Consider calling the undecorated predicate here, or excluding worker calls from the shadow metrics.</violation>
<violation number="2" location="backend/utils/episodes/log/clock.py:27">
P2: The 128-clock cap raises from inside `drain()` before `store.publish()`, so the whole episode projection for that user stops committing, not just the Home clock. Consider truncating or dropping the excess clocks with a metric instead of raising.</violation>
</file>
<file name="backend/routers/sync.py">
<violation number="1" location="backend/routers/sync.py:1824">
P3: The episode sweep's Firestore reads are attributed to `job:sync_backfill_sequencer`, but the episode drain route uses `job:episode_drain` for the same worker. Wrap the `episode_worker.sweep` call in `with read_origin('job:episode_drain'):` so read attribution stays correct.</violation>
</file>
<file name="backend/database/episode_log.py">
<violation number="1" location="backend/database/episode_log.py:255">
P1: Removed membership links are never removed from the shadow namespace. `publish` only sets links present in the fold, while the fold has no deletion/tombstone operation, so `linked()` can keep returning an old episode after the legacy link is disconnected. Emit link deletions (or reconcile and delete missing shadow links) in the same publication transaction.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| cid in ids | ||
| and finished is not None | ||
| and not is_completed_below_floor(member) | ||
| and is_settling_fragment(member, now=now.timestamp()) |
There was a problem hiding this comment.
P3: This call goes through the settling_hold shadow decorator, so every drain adds samples to the reader-agreement counters. Those counters are meant to measure legacy Home reads. Consider calling the undecorated predicate here, or excluding worker calls from the shadow metrics.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/utils/episodes/log/clock.py, line 24:
<comment>This call goes through the `settling_hold` shadow decorator, so every drain adds samples to the reader-agreement counters. Those counters are meant to measure legacy Home reads. Consider calling the undecorated predicate here, or excluding worker calls from the shadow metrics.</comment>
<file context>
@@ -0,0 +1,36 @@
+ cid in ids
+ and finished is not None
+ and not is_completed_below_floor(member)
+ and is_settling_fragment(member, now=now.timestamp())
+ ):
+ clocks[cid] = finished + timedelta(seconds=SETTLING_MAX_HOLD_SECONDS)
</file context>
| from utils.episodes.log import worker as episode_worker | ||
|
|
||
| try: | ||
| episode_outcomes = await run_blocking(db_executor, episode_worker.sweep) |
There was a problem hiding this comment.
P3: The episode sweep's Firestore reads are attributed to job:sync_backfill_sequencer, but the episode drain route uses job:episode_drain for the same worker. Wrap the episode_worker.sweep call in with read_origin('job:episode_drain'): so read attribution stays correct.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/routers/sync.py, line 1824:
<comment>The episode sweep's Firestore reads are attributed to `job:sync_backfill_sequencer`, but the episode drain route uses `job:episode_drain` for the same worker. Wrap the `episode_worker.sweep` call in `with read_origin('job:episode_drain'):` so read attribution stays correct.</comment>
<file context>
@@ -1818,7 +1818,19 @@ async def sweep_sync_backfill_sequencer(_retry_count: int = Depends(verify_cloud
+ from utils.episodes.log import worker as episode_worker
+
+ try:
+ episode_outcomes = await run_blocking(db_executor, episode_worker.sweep)
+ outcomes['episode_redriven'] = episode_outcomes.get('redriven', 0)
+ outcomes['episode_errors'] = episode_outcomes.get('error', 0)
</file context>
| episode_outcomes = await run_blocking(db_executor, episode_worker.sweep) | |
| with read_origin('job:episode_drain'): | |
| episode_outcomes = await run_blocking(db_executor, episode_worker.sweep) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0af0ee8128
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| not row.get('backfill_complete') | ||
| or not row.get('home_rows_ready') | ||
| or row.get('cursor', 0) != row.get('next_seq', 0) | ||
| or row.get('policy_barriers') |
There was a problem hiding this comment.
Invalidate cached Home rows for curation writes
For users admitted to cached reads, starring or unstarring a conversation can change Home visibility without invalidating this readiness check. database/conversations.py::set_conversation_starred directly updates Firestore without a policy barrier or refresh fact; folder assignment in database/folders.py similarly writes folder_user_set. Both fields affect fragment_visibility.is_user_curated, which overrides below-floor hiding. Consequently, a completed below-floor member can remain incorrectly hidden or visible, and matching requests keep returning 304 indefinitely because that member has no expiry clock. Include these curation writers in the invalidation mechanism before treating the projection as ready.
Useful? React with 👍 / 👎.
| else: | ||
| response.headers.update(headers) | ||
| log_worker.sample_read(uid, rows) | ||
| return {'enabled': True, 'episodes': wires, 'next_cursor': next_cursor, 'home_version': token} |
There was a problem hiding this comment.
Preserve composition recovery on the cached list path
For a cached-read user whose closed episode missed composition, or whose member was subsequently deleted or discarded, this return bypasses home_read.project_episodes and its schedule_missed_composes safety net. The drain only writes compose_dirty; a repository-wide search finds no consumer of that field that schedules composition. Ordinary Home refreshes therefore no longer repair missing notes or regenerate episode-wide titles, bullets and ledes after member removal, although the legacy list path does. Preserve bounded composition recovery on this path or add a durable consumer for the dirty intent.
Useful? React with 👍 / 👎.
| return None | ||
| now = now or datetime.now(timezone.utc) | ||
| if row.get('home_valid_until') and row['home_valid_until'] <= now: | ||
| from utils.episodes.log import worker |
There was a problem hiding this comment.
Move the new backend imports to module scope
backend/AGENTS.md explicitly requires “All imports at module top level — never inside functions.” This new import violates that requirement, as do the newly added episode-worker imports inside the sync sweep and finalization functions. Move these dependencies to module scope, restructuring shared dependencies if needed rather than introducing function-local imports.
AGENTS.md reference: backend/AGENTS.md:L168-L168
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a5459b07d6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if any(row.get('compose_dirty') for row in rows): | ||
| home_read.schedule_missed_composes(uid, rows, wires) |
There was a problem hiding this comment.
Preserve composer-version recovery for cached Home rows
For cached-read users with previously composed episodes, a COMPOSER_VERSION bump no longer triggers the existing read-side upgrade. Although cached 200 responses now call the recovery helper, this guard only does so for compose_dirty rows, and the worker's dirty predicate does not check composer_version or composed_notes drift. composer.needs_compose explicitly handles both conditions on the legacy path, so these users can retain outdated compositions indefinitely, including across unconditional refreshes. Preserve those checks when deciding whether cached rows need recovery.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8c8f313abd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Seed geometry is the committed producer's base, so out-of-order | ||
| # post-commit delivery never applies a delta to an unrelated row. | ||
| row = {**seed, **delta['set'], 'id': delta['id']} |
There was a problem hiding this comment.
Fence older producer snapshots before replacing fold state
When two mutations of the same episode commit in order but their separate post-commit appends complete in reverse order, reconstructing each row from its producer's seed allows the older mutation to overwrite the newer state. For example, delivering a close mutation before an earlier activity mutation leaves the fold reporting status='live' and restores the old current pointer, even though the authoritative episode is closed. The drain subsequently overlays this stale geometry onto the fresh legacy row and can admit cached reads once both facts are consumed. Preserve committed ordering evidence or reconcile stale snapshots against the authority before replacing geometry and links.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fc3f0a4205
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| preserve_result=True, | ||
| ) | ||
| @after_write('conversations') | ||
| @home_policy_write(firestore_client=lambda: db) |
There was a problem hiding this comment.
Use the call-time Firestore factory for policy barriers
The newly added policy decorators pass the legacy db proxy into the barrier and background-refresh machinery. backend/AGENTS.md explicitly reserves that proxy for legacy compatibility and requires new persistence code to obtain its client through get_firestore_client() at call time. Pass the existing get_firestore_client factory to these decorators instead of introducing new proxy-dependent persistence paths.
AGENTS.md reference: backend/AGENTS.md:L180-L180
Useful? React with 👍 / 👎.
| free = {cid: dict(f) for cid, f in self.spans.items() if cid not in overridden} | ||
| previous_ids = {e.id for e in [*self.windows, *self.episodes]} | ||
| previous = {r['id']: r for r in (self._previous_rows or [])} | ||
| carried = {e.id for e in self.windows} # untouched components keep their ids |
There was a problem hiding this comment.
Preserve pinned automatic episode IDs during repartition
After a donor is repointed in an automatic recorded episode, Fold._seed(..., pin=True) places that episode in self.episodes. When another nearby span arrives, record_span removes the pinned episode before recomputing, so this carried set excludes its ID. _settle_id then fabricates a displaced ID even though the authoritative episode_recorded_components.attach retains the original ID because it belongs to previous. This reproduces with strictly ordered facts: the drain publishes a different episode row while the captured membership links still reference the original, potentially stale view. Include the automatic episodes being repartitioned in the reusable-ID set.
Useful? React with 👍 / 👎.
# Conflicts: # backend/database/firestore_index_registry.py # backend/deploy/cloud_run_gmp_sync.yaml # backend/route_policy_manifest.yaml # backend/tests/support/firestore_query_driver_registry.py # backend/tests/support/lifecycle_writer_inventory.py # backend/tests/unit/test_strict_firestore_transaction.py # firestore.indexes.json
…store The episode log's TTL verification makes the admin API client reachable from runtime images. Suffix-stripping would normalize firestore_admin_v1 to a nonexistent google-cloud-firestore_admin distribution; the client ships inside google-cloud-firestore, which both runtime locks already install.
# Conflicts: # backend/deploy/cloud_run_gmp_sync.yaml
…5061) Cache-hit correctness is currently unobserved for monthly usage and episode members. Sample 1% of hits by default, reread durable state in a bounded background worker, and preserve the cached response and cache contents. - `omi_read_cache_shadow_total{cache="usage_month"|"episode_members",result="match"|"mismatch"|"error"|"skipped"}` distinguishes failed reads from incomplete/capacity-limited samples. Two workers, zero queue, and default rate `0.01` remain unchanged. Saturated submissions skip immediately without rejection warnings. - Usage compares the numeric fields from `monthly_usage_totals.FIELDS` with `math.isclose(rel_tol=1e-9, abs_tol=1e-6)`, tolerating accumulation-order rounding while detecting meaningful differences. The authoritative hourly query has an explicit `limit(744)`, a five-second RPC timeout, and no retries. Returning 744 documents conservatively counts `skipped`, even if that happened to be the complete month; a partial sum never becomes a mismatch. - Episode members compares the key set only and **cannot detect content staleness** (titles, visibility fields, or other row contents). The serving cache's transcript-free `MEMBER_FIELDS` preparation retains extant rows, including deleted/discarded rows; display visibility is applied later. The shadow applies that same existence filter with `field_paths=[]`, returns IDs only, and never runs preparation, decryption, title projection, or transcript loads. Each batch uses the remaining five-second monotonic deadline and retries disabled; an expired deadline aborts rather than returning a partial key set. The normal serving preparation is unchanged. - `OMI_READ_CACHE_SHADOW_RATE` is the only new control: missing means `0.01`, positive finite values clamp to `1`, and invalid strings, nonfinite values, and values <=0 silently skip with **no metric**. Rollback: `OMI_READ_CACHE_SHADOW_RATE=0`. - No user IDs, values, or exception bodies are logged by the helper. TTL/write races remain `mismatch`; cheap write-timestamp attribution is unavailable, so `stale_within_ttl` is not guessed. Verified the original cache/TTL/phase metric implementations before coding at earlier head `35e63b5d701f94396cd166ef22db8df37aa947d4`. Review baseline `origin/main` was inspected at `9fc3d64dc2e62c14acbfe4e77d33344cb13fdda0`; its changes do not conflict with these paths. Published ancestry is preserved for a single normal fast-forward fix push. ## Added reads and attribution The refreshed read-only `ro-prod` GMP aggregate at **2026-11-10T19:03:16Z** returned no 1-hour hit series for either requested cache. The earlier 24-hour aggregate at 17:15:06Z was also empty. Missing series are not zero hits, so no numeric estimate is claimed. This PR adds the missing episode-members hit counter. The application namespace is exposed as `exported_namespace` in GMP: ```promql sum by (exported_namespace) ( increase(firestore_cache_requests_total{ exported_namespace=~"fsr_s4_usage_month_cache|fsr_s4_episode_members_cache", result="hit" }[1h]) ) ``` Nominal fresh-read operations/hour = `r × (H_usage + H_members)`, or `0.01 × (H_usage + H_members)` by default; saturation reduces admissions. Billable document reads/hour = `r × (H_usage × D_usage + H_members × D_members)`, where D includes empty/missing-document charges. Usage reads at most **744 documents per sampled hit**, members at most **1000 unique requested IDs** per eligible cache hit. The conservative document-read upper bound at default sampling is `0.01 × (744 × H_usage + 1000 × H_members)`. A usage sample that reaches the cap still incurs its reads even though its comparison is `skipped`; a saturated sample incurs none. Both usage and member shadow reads run under `read_origin('job:read_cache_shadow')` and the existing bounded `record_firestore_read` family. The SDK document probe records their billed reads under callers `database.user_usage:_fresh_month_stats` and `utils.episodes.home_read:_fetch_members`, with distinct origin `job:read_cache_shadow`. The member origin is scoped to shadow RPC creation and iteration; the serving origin is preserved, including after failures. Tests exercise the real probe counters. Cost readback: ```promql sum(increase(omi_firestore_billed_reads_by_caller_total{ caller=~"database.user_usage:_fresh_month_stats|utils.episodes.home_read:_fetch_members" }[1h])) sum(increase(omi_firestore_billed_reads_by_origin_total{ origin="job:read_cache_shadow" }[1h])) ``` ## Verification and review follow-up Touched suites run through `/Users/david/workspace/omi-workspace/bin/omi-heavy`: ```text backend/.venv/bin/python -m pytest \ backend/tests/unit/test_read_cache_shadow.py \ backend/tests/unit/test_fsr_s4_caches.py \ backend/tests/unit/test_episode_members_cache.py \ backend/tests/unit/test_executors.py -q 161 passed, 9 warnings in 4.18s ``` The full backend type check passed with **0 errors** before the fix push. Coverage includes the malformed rates `abc`, empty string, and `1%`; real projection-cache values compared with hourly sums in a different floating-point summation order; 743/744/745-document bounds and skipped verdicts; actual per-caller/origin billed-read attribution; ID-only member reads matching real preparation for ordinary, deleted, discarded, and enhanced rows; no preparation on the shadow path; and silent skipped saturation. Existing match/mismatch/error/disabled and cached-response preservation tests remain. **Conflict coordination:** #24607 edits the same `home_read.py` lines, including the member-reader rename/source-version changes. Whichever PR lands second rebases and reconciles that semantic overlap. Head SHA: `665b969d681e449ef4218c757d6c6dc1dee2d165`. Review addressed against earlier head `896b6950c6f76a8d5829f321b5f1619b73f97f4a`. The final review fixes move all canonicalization, including member-key sorting, into the background worker. The worker retains the raw private cache snapshot: serving callers receive deep copies, so response mutation cannot alter it. Tests assert canonicalization has not run at submission, and verify response isolation plus shadow-only read-origin scoping on success and failure. Registry `fail: open` now matches the unset default (`0.01`, sampling on); the default and two-worker pool are unchanged. Local touched tests: **161 passed, 9 warnings in 4.18s**; full preflight through `omi-heavy`: **41 checks passed in 74.09s**. Full backend type check: **0 errors**. Current-head source CI completed without failures; every check is recorded below. No deployment is included. After deploy, verify `sum by (cache,result) (increase(omi_read_cache_shadow_total[1h]))` after eligible cache hits. ## CI readback As of **2026-11-10T20:02:53.217295+00:00**, for head `665b969d681e449ef4218c757d6c6dc1dee2d165`: **37 passed, 22 skipped, 0 failed or pending**. This body update triggers metadata-only validation, which is watched separately. <details> <summary>Every reported CI check</summary> | Workflow | Check | State | | --- | --- | --- | | External review | [CodeQL](https://github.com/BasedHardware/omi/runs/130081191103) | SUCCESS | | Backend Checks | [Detect Changes](https://github.com/BasedHardware/omi/actions/runs/42887659712/job/130080151541) | SUCCESS | | Backend Checks | [Static Contracts](https://github.com/BasedHardware/omi/actions/runs/42887659712/job/130081095994) | SKIPPED | | Backend Emulator Proofs | [Backend emulator proofs](https://github.com/BasedHardware/omi/actions/runs/42887660295/job/130080155536) | SUCCESS | | Backend Hermetic E2E | [Backend Hermetic Merge Gate](https://github.com/BasedHardware/omi/actions/runs/42887659905/job/130088347152) | SUCCESS | | Backend Hermetic E2E | [Detect Hermetic Backend Scope](https://github.com/BasedHardware/omi/actions/runs/42887659905/job/130080153948) | SUCCESS | | Backend Hermetic E2E | [Hermetic Backend E2E](https://github.com/BasedHardware/omi/actions/runs/42887659905/job/130081824745) | SUCCESS | | Backend Hermetic E2E | [Listen Pusher Stack Gauntlet](https://github.com/BasedHardware/omi/actions/runs/42887659905/job/130081824719) | SUCCESS | | Backend Hermetic E2E | [Post-merge hermetic failure issues](https://github.com/BasedHardware/omi/actions/runs/42887659905/job/130088349215) | SKIPPED | | Backend Hermetic E2E | [Replay Harness Phase 0A Feasibility (advisory)](https://github.com/BasedHardware/omi/actions/runs/42887659905/job/130081828258) | SKIPPED | | Backend Hermetic E2E | [Sync Cloud Tasks Stack Gauntlet](https://github.com/BasedHardware/omi/actions/runs/42887659905/job/130081824847) | SUCCESS | | Backend Unit Tests | [Backend unit guardrails](https://github.com/BasedHardware/omi/actions/runs/42887659310/job/130081728556) | SUCCESS | | Backend Unit Tests | [Backend unit shard 1/8](https://github.com/BasedHardware/omi/actions/runs/42887659310/job/130080153320) | SUCCESS | | Backend Unit Tests | [Backend unit shard 2/8](https://github.com/BasedHardware/omi/actions/runs/42887659310/job/130080152986) | SUCCESS | | Backend Unit Tests | [Backend unit shard 3/8](https://github.com/BasedHardware/omi/actions/runs/42887659310/job/130080153173) | SUCCESS | | Backend Unit Tests | [Backend unit shard 4/8](https://github.com/BasedHardware/omi/actions/runs/42887659310/job/130080153171) | SUCCESS | | Backend Unit Tests | [Backend unit shard 5/8](https://github.com/BasedHardware/omi/actions/runs/42887659310/job/130080153090) | SUCCESS | | Backend Unit Tests | [Backend unit shard 6/8](https://github.com/BasedHardware/omi/actions/runs/42887659310/job/130080153123) | SUCCESS | | Backend Unit Tests | [Backend unit shard 7/8](https://github.com/BasedHardware/omi/actions/runs/42887659310/job/130080153069) | SUCCESS | | Backend Unit Tests | [Backend unit shard 8/8](https://github.com/BasedHardware/omi/actions/runs/42887659310/job/130080153065) | SUCCESS | | Backend Unit Tests | [Backend unit suite](https://github.com/BasedHardware/omi/actions/runs/42887659310/job/130091135724) | SUCCESS | | Backend Unit Tests | [Resolve CI Tier](https://github.com/BasedHardware/omi/actions/runs/42887659310/job/130080152755) | SUCCESS | | CodeQL | [Analyze (actions)](https://github.com/BasedHardware/omi/actions/runs/42887646291/job/130080119905) | SUCCESS | | CodeQL | [Analyze (c-cpp)](https://github.com/BasedHardware/omi/actions/runs/42887646291/job/130080119912) | SUCCESS | | CodeQL | [Analyze (csharp)](https://github.com/BasedHardware/omi/actions/runs/42887646291/job/130080119491) | SUCCESS | | CodeQL | [Analyze (go)](https://github.com/BasedHardware/omi/actions/runs/42887646291/job/130080119927) | SUCCESS | | CodeQL | [Analyze (javascript-typescript)](https://github.com/BasedHardware/omi/actions/runs/42887646291/job/130080120628) | SUCCESS | | CodeQL | [Analyze (python)](https://github.com/BasedHardware/omi/actions/runs/42887646291/job/130080120325) | SUCCESS | | CodeQL | [Analyze (ruby)](https://github.com/BasedHardware/omi/actions/runs/42887646291/job/130080119835) | SUCCESS | | CodeQL | [Analyze (rust)](https://github.com/BasedHardware/omi/actions/runs/42887646291/job/130080120081) | SUCCESS | | Desktop Checks | [Agent Runtime](https://github.com/BasedHardware/omi/actions/runs/42887659294/job/130081109464) | SKIPPED | | Desktop Checks | [Detect Changes](https://github.com/BasedHardware/omi/actions/runs/42887659294/job/130080150426) | SUCCESS | | Desktop Swift CI | [Desktop Siri Xcode 27 Advisory](https://github.com/BasedHardware/omi/actions/runs/42887659498/job/130081197841) | SKIPPED | | Desktop Swift CI | [Desktop Swift Build & Tests](https://github.com/BasedHardware/omi/actions/runs/42887659498/job/130081200930) | SKIPPED | | Desktop Swift CI | [Desktop Swift Release Compile](https://github.com/BasedHardware/omi/actions/runs/42887659498/job/130081198716) | SKIPPED | | Desktop Swift CI | [Desktop Swift Static & Test Contracts](https://github.com/BasedHardware/omi/actions/runs/42887659498/job/130081197426) | SKIPPED | | Desktop Swift CI | [Detect Desktop Swift Changes](https://github.com/BasedHardware/omi/actions/runs/42887659498/job/130080151894) | SUCCESS | | Desktop Swift CI | [Post-merge Desktop Swift Release Compile failure issue](https://github.com/BasedHardware/omi/actions/runs/42887659498/job/130081198777) | SKIPPED | | Mobile App Checks | [Android Compile Smoke](https://github.com/BasedHardware/omi/actions/runs/42887659580/job/130081372983) | SKIPPED | | Mobile App Checks | [Android Emulator Acceptance](https://github.com/BasedHardware/omi/actions/runs/42887659580/job/130081373384) | SKIPPED | | Mobile App Checks | [Android JVM Unit Tests](https://github.com/BasedHardware/omi/actions/runs/42887659580/job/130081373001) | SKIPPED | | Mobile App Checks | [Dart Analyze & Tests](https://github.com/BasedHardware/omi/actions/runs/42887659580/job/130081373544) | SKIPPED | | Mobile App Checks | [Dart Tests (Pacific/Kiritimati)](https://github.com/BasedHardware/omi/actions/runs/42887659580/job/130081374294) | SKIPPED | | Mobile App Checks | [Detect Changes](https://github.com/BasedHardware/omi/actions/runs/42887659580/job/130080153580) | SUCCESS | | Mobile App Checks | [Generated Files](https://github.com/BasedHardware/omi/actions/runs/42887659580/job/130081373154) | SKIPPED | | Mobile App Checks | [Mobile Release Eligibility](https://github.com/BasedHardware/omi/actions/runs/42887659580/job/130081371333) | SUCCESS | | Mobile App Checks | [Post-merge mobile failure issues](https://github.com/BasedHardware/omi/actions/runs/42887659580/job/130081373417) | SKIPPED | | Mobile App Checks | [Seeded Journeys (hermetic)](https://github.com/BasedHardware/omi/actions/runs/42887659580/job/130081373088) | SKIPPED | | Mobile App Checks | [iOS Compile Check](https://github.com/BasedHardware/omi/actions/runs/42887659580/job/130081373386) | SKIPPED | | OpenAPI Contract | [Public Developer API contract](https://github.com/BasedHardware/omi/actions/runs/42887659556/job/130080151173) | SUCCESS | | Repo Checks | [Detect Changes](https://github.com/BasedHardware/omi/actions/runs/42887659956/job/130080153922) | SUCCESS | | Repo Checks | [Formatting](https://github.com/BasedHardware/omi/actions/runs/42887659956/job/130081777390) | SUCCESS | | Repo Checks | [Hygiene](https://github.com/BasedHardware/omi/actions/runs/42887659956/job/130081777319) | SUCCESS | | Repo Checks | [PR Metadata Preflight](https://github.com/BasedHardware/omi/actions/runs/42887659956/job/130080157989) | SKIPPED | | Runtime Image Contracts | [image-smoke](https://github.com/BasedHardware/omi/actions/runs/42887659885/job/130080154163) | SKIPPED | | Runtime Image Contracts | [source-closure](https://github.com/BasedHardware/omi/actions/runs/42887659885/job/130080151809) | SUCCESS | | Web Checks | [Build](https://github.com/BasedHardware/omi/actions/runs/42887662143/job/130081288209) | SKIPPED | | Web Checks | [Detect Changes](https://github.com/BasedHardware/omi/actions/runs/42887662143/job/130080161830) | SUCCESS | | Web Checks | [Frontend Lint](https://github.com/BasedHardware/omi/actions/runs/42887662143/job/130081289102) | SKIPPED | </details> ## Product invariants affected none Failure-Class: none <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/25061?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/25061?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F25061&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. --> 🤖 Generated with [Claude Code](https://claude.com/claude-code)
) ## What and why Retire summary due indexes atomically when donor tombstones, manual title/overview edits or already-enriched merges refuse repair. Preserve `summary_first_pending_at`. Undo/manual-field removal and discard restore recover owed debt in the same transaction using original acceptance plus the row's policy deadline, without replacing a non-null due or arming a refused/owned row. Internal debt metadata stays outside reversible user-field receipts. The guarded operator script clears legacy residue using the serving refusal classifier. Unknown provenance is retained for provenance repair; processing, local-only, BYOK and active finalization ownership are explicitly retained even when another refusal has precedence. Both completion metadata and output-present metadata retire copied legacy due. No serving rate, feature flag, deadline, capacity, repair-service or released-client schema changes. ## Merge order — required hold Merge **after #25019 and #25032. This PR must not merge before #25032.** Both dependency PRs were OPEN when this batch began. After #25019 lands, rebase onto current `origin/main`, regenerate inventories and retain both sides' tests; never resolve a shared-file conflict by taking one side wholesale. Repeat exact inventory guards after any overlapping PR lands. #25032 owns its upstream registry/flag-budget train conflicts; this batch does not edit them. ## Operator run plan — cl2-deploy only 1. Deploy the merged code first, then identify the exact serving revision. Old writer sites keep re-arming due during the sweep, so a pre-deploy sweep or dry-run is insufficient. 2. Re-run a fresh dry-run **after deployment on that serving revision**. Verify the deployed `summary_due_at` collection-group index and inspect class/retained/eligible/conflict counts before any apply. 3. Run a bounded **5,000 scanned-row canary**, using an apply cursor separate from the dry-run cursor. Production `--apply` additionally requires `--confirm-production-project based-hardware` matching the actual client's project. Review canary counts. 4. Run the full sweep **only on lead2's go**. Re-run the serving-revision dry-run after any intervening code deployment; restart without a cursor to reconsider conflicts as needed. The sweep runs **two disjoint passes** at one cutoff instant: a numeric `summary_due_at <= now` pass, then a Timestamp `summary_due_at <= datetime(now, UTC)` pass. Each uses `(summary_due_at, __name__)` pagination, classifier-only projection and batches of at most 400 writes. Every clear retains the original snapshot `update_time` precondition, including individual retries after atomic batch failure. Concurrent re-arm/delete is skipped. `--limit` bounds the combined scanned rows across both passes, including retained rows. Aggregate counts remain available, with scanned/eligible/classes/written/conflicts also reported separately under `passes.numeric` and `passes.timestamp`. Output is counts-only; private cursor files are written to unique same-directory `mkstemp` files, explicitly set to mode `0600`, flushed and fsynced before atomic replacement; any failed attempt removes its temporary file and preserves the previous checkpoint. They include a `pass` marker plus a numeric or tagged RFC3339 due and document path, with no IDs printed. Cursors are separate for each pass: completing numeric scanning checkpoints `{pass: "timestamp", due: null, __name__: null}` before the first timestamp query. Resuming a timestamp checkpoint skips the completed numeric pass. Older unmarked cursors infer their pass from the due type. Keep apply/dry-run cursor files separate. This operator-only metadata cleanup is exempt from content-generation batch privacy admission: it never reads transcripts/generated summaries or changes protection levels or content. No production access or operator run was performed in this lane. ## Follow-up: private atomic checkpoints Review-desk FIX-FIRST at `f940cf9dd489` found that the predictable `.tmp` path could expose private cursor document paths through a pre-existing permissive file or symlink. Checkpoint publication now uses a unique file in the checkpoint directory, explicit `0600`, flush/fsync before `os.replace`, and unconditional temporary-file cleanup on failure. Atomic replacement also replaces a final-path symlink without following its target. - Backfill suite through omi-heavy: **101 passed / 1 existing loopback-only skip**, 1.33s, completed approximately 2026-11-10 17:51Z. All eight new filesystem/security cases passed. This follow-up changes only the backfill script and its test file; no operator --apply or production access. - Checkpoint follow-up head: `8159c89608d86c4c67a9bfc5d077e57c7df2f48f`. `make preflight`: **39 checks passed in 64.42s**, completed approximately 2026-11-10 17:55Z. Full PR non-test scope: **397 changed lines**, within the original 500-line cap. The single authorized checkpoint follow-up push succeeded as a fast-forward, approximately 2026-11-10 17:55:43–17:57:17Z. Its normal hook passed **39 shared checks (67.26s), typecheck with zero errors, 250 passing changed-file tests plus 23 explicit loopback-only skips**, and pinned formatting. Exact-head CI is being monitored with a 90-minute deadline. ## Follow-up: two-pass sweep Review-desk FIX-FIRST at `50f47f8058fc` found that a numeric cutoff never selects Timestamp-valued due. The backfill now queries both types and keeps the same classifier, fences, dry-run default and counts-only output in each pass. Checkpoints explicitly mark the active pass and survive interruption at the pass boundary. Read-only inspection also confirms the serving query/repair blind spot: `database/summary_debt_queries.py:13,24` uses a numeric cutoff/cursor; `services/summary_debt_repair.py:50` rejects nonnumeric due and its overdue-age arithmetic assumes a number. Those files are **unchanged**, as requested; cl2-fixnow should route that finding to #25019's owner. - Focused selection re-run through omi-heavy, 2026-11-10 approximately 17:12Z: **2,209 passed / 23 skipped / 86 xfailed**. Adjacent **117 passed**; extra chat/tool/strict transaction selection **55 passed**. Per-file commands, exact timestamps and results: `focused-results-followup-m1.json` in the supplied task directory. - Backfill tests against synthetic loopback Firestore: **94 passed**, receipt completed 2026-11-10T17:12:06.668829+00:00. Includes actual mixed-type inequality behavior, refused clears, owed/future retention, shared limits, both cursor types, interruption at the pass boundary and bounded/fenced writes. Emulator shut down normally. - Follow-up at earlier head `f940cf9dd4898798c72e854c0dd5226554b76866`. `make preflight`: **39 checks passed in 46.50s**, 2026-11-10 approximately 17:15–17:16Z. Full PR scope: **388 non-test changed lines**, within the 500-line cap. - Only the backfill script and its test file changed in this follow-up. Serving query and repair files remain untouched. The single follow-up fast-forward push succeeded on 2026-11-10 approximately 17:16:32–17:17:52Z. Its normal hook passed 39 shared checks (57.04s), typecheck with zero errors, 242 passing changed-file tests plus 23 explicit loopback-only skips, and pinned formatting. CI is being monitored on this exact head with a 90-minute deadline. ## Verification of the preceding batch Verification is hermetic code and synthetic loopback Firestore evidence, not deployed-runtime evidence. Commands use `/Users/david/workspace/omi-workspace/bin/omi-heavy run --` and the worktree's Python 3.11, with GCP credential environment scrubbed. Pytest files run in isolated processes under the backend unit contract. - Requested focused selection on this batch: **2,170 passed, 22 skipped (loopback tests run separately), 86 xfailed**, 2026-11-10 16:14:30–16:15:06Z. The old ae48104 selection measured 2,087/4/86; new guards add passing cases and the new emulator cases increase the explicit loopback-only skips. - Adjacent selection: **117 passed**, 16:15:06–16:15:13Z; additional chat/tool/strict People transaction selection: **55 passed**, 16:15:13–16:15:18Z. Exact per-file commands, timestamps and logs: `/Volumes/scratch/cl2-fixnow-move25020/focused-results-m1.json`. - Synthetic loopback Firestore: **22 chat edit/undo tests passed** and **31 People-generation emulator checks passed**, 2026-11-10 approximately 16:13–16:14Z. Emulator stopped. Used the installed Java 21 in the process environment only. - `make preflight` on commit `50f47f8058fcb904bb5bd185184c1473284783cc`: **39 checks passed in 55.79s**, 2026-11-10 approximately 16:17–16:18Z. The full PR has **354 non-test changed lines** (342 additions / 12 deletions), below 500. - Regenerated the lifecycle payload inventory for changed owners and all People fingerprints (only the four already-audited chat scopes differ); People generator check reports no delta. Exact lifecycle inventory/state-table guard is included above; serving lifecycle write guard passed in preflight. Normal pre-push on `50f47f8058fcb904bb5bd185184c1473284783cc` passed all 39 shared checks, typecheck with zero errors, 203 passing changed-file tests plus 22 explicit loopback-only skips, and pinned formatting for all 15 PR Python files (2026-11-10 16:18:28–16:19:46Z). The single fast-forward push succeeded with no bypass. UI-Evidence: none — backend metadata and an operator script only. ## Finding dispositions | Finding (review sources) | Disposition in this batch | |---|---| | Predictable checkpoint temp path can follow a symlink or reuse permissive permissions (review-desk 72a878, FIX-FIRST) | Use exclusive unique same-directory `tempfile.mkstemp`, enforce `0600` via `fchmod`, write/flush/fsync, then `os.replace`. Cleanup runs on failure, leaving the previous checkpoint intact. Regressions cover the old predictable symlink/permissive file, permissive umask, write/fsync/replace/fchmod failures, descriptor closure and safe replacement of a final-path symlink. | | Numeric-only cutoff misses timestamp-valued due (review-desk e7b7dc, FIX-FIRST) | Replaced with numeric and Timestamp passes, distinct pass-aware checkpoints and per-pass counts. Tests cover refused/owed/future rows in both types, shared limits, resumable pass boundary, update-time conflicts and 400-write caps. A loopback Firestore regression verifies actual mixed-type query behavior. | | Unknown provenance retired as durable; #25032 late projection stranded (pd correctness/custody/tests/merge/Kimi) | Removed from `DURABLE_REFUSALS` and durable test cases. Regression retains the legacy due and first-pending anchor. Missing provenance still needs its owning repair; this batch never clears it. | | Manual undo loses owed debt (all correctness/custody/test reviews, old merge/CI) | Chat restore and explicit null/DELETE_FIELD removals re-arm atomically from preserved first pending plus the stored `first_summary_policy` deadline, falling back to `deadline_seconds()`. Refused rows and already-armed rows never acquire a replacement due. Real codec, strict transaction and loopback emulator coverage. | | Every other manual removal path needs coverage (sdclear-fix1) | Title UI and offline empty titles remain non-null manual values, covered by retirement tests. Chat tools reject blank title/overview edits before IO. Sync restore and generated persistence preserve manual fields. All actual removal writers are declared in the lifecycle inventory. | | Summary BYOK reason not excluded; terminal BYOK semantics untested (pd correctness/custody/tests) | Explicitly retain `summary_blocked_reason=blocked_byok`, including a competing deleted flag and no active job. Existing finalization BYOK exclusion remains. No terminal-BYOK policy expansion. | | Detached queued/leased finalization rows (pd correctness) | Explicitly retain both statuses even without a job ID, including competing manual/discard flags. Re-arm also respects these owners. | | Output-present enriched row can retain copied due (pd custody) | Both completion metadata and `summary_output_present=True` take the enriched return and retire due. Empty reprocessing preserves banked structured content without requiring a completion stamp. | | Discarded rows recoverable after sweep (pd correctness/tests) | The existing restore transaction re-arms only currently owed, unarmed rows from original acceptance and policy. Tests cover cleared legacy rows without receipts, manual/enriched/locked refusal, existing due and writer ownership. | | Refusal classes can later reopen (pd correctness/custody) | Manual and discard inverses now recover debt. Empty-output revision re-arm stays intact and is covered by the adjacent recovery suite. Privacy/content-floor decisions remain governed by their existing policy; this metadata cleanup does not introduce a new privacy/content transition. `DURABLE_REFUSALS` now documents current-obligation retirement rather than permanent lifecycle finality. | | Backfill bypasses batch privacy fence (pd custody) | Documented metadata-only operator exemption: no transcript or generated summary is read or written; only the due index is cleared with a snapshot update-time fence. Serving content-generation fences remain unchanged. | | Non-JSON due checkpoint (pd custody) | Timestamp cursors use private tagged RFC3339 values and decode on resume, preserving Firestore timestamp type and nanoseconds. Numeric cursor format remains supported. | | No explicit prod apply guard (pd custody) | `--apply` on `based-hardware` requires matching `--confirm-production-project based-hardware`; an unknown project fails closed. Synthetic unit coverage only; no operator apply was run. | | CLI failure path / deleted cursor not tested (pd tests) | Added counts-only CLI error regression and resume after a deleted numeric cursor; timestamp cursor also resumes after a missing cursor document. | | Unchanged-title path lacks assertion (pd tests nit) | Added no-write/no-due-move assertion for an unchanged offline title. | | Legacy exact title assertion fails CI (old CI/merge) | Already corrected at ae48104; retained and re-run the full revision-contract file. | | Update-time fence, dry-run, bounded cursor, counts-only output (all reviews) | Preserved; original race, atomic-batch, tie/resume, scanned-row limit, batch-size and privacy tests remain intact. | | Deploy must precede sweep (old merge, sdclear-fix1) | Run plan below requires code serving first and a fresh post-deploy dry-run on that exact serving revision before the 5k canary. Old writers would keep re-arming due during a sweep. | | Code revert cannot restore cleared rows (pd merge, old custody) | Rollback explicitly requires a separately authorized re-stamp keyed on preserved `summary_first_pending_at`, current owed rows only. | | #25019 / #25032 ordering and same-file inventories (pd merge, old merge, sdclear-fix1) | Must merge after both, never before #25032. Both were OPEN at intake; no premature rebase. After #25019 lands, rebase and regenerate inventories, preserving both sides and tests rather than taking a side wholesale. | | Upstream #25032 registry / #25034 flag-budget conflicts (pd merge) | Dependency-owner work outside this batch. The merge train must resolve those before #25020; no workflow/flag-budget edits here. | | #25018 / #24866 / #24801 / #24897 / stale #24607 overlaps (old and pd merge) | Re-fetch before integration; if these land first, rebase and re-run exact inventories and both branches' tests. No unrelated PR changes or merges performed here. | | Operator query excluded from serving-query inventory (pd merge) | Preserve script scope. Uses the existing `summary_due_at` COLLECTION_GROUP single-field index; cl2-deploy must verify the deployed index with the serving-revision dry-run before canary. No production query in this lane. | | People audit and lifecycle inventories after shared-scope changes (all test reviews) | Regenerated reviewed entries and four existing People fingerprints after strict transaction and loopback emulator proof; exact-match guards re-run. | ## Rollback A code revert **does not restore rows whose due indexes the backfill already cleared**. Preserve the operator receipts/cursors and stop the sweep. A separately authorized repair must enumerate/re-stamp keyed on the preserved `summary_first_pending_at`; only rows the current classifier calls owed, with no competing owner and a null/missing due, may receive `summary_first_pending_at + stored first_summary_policy deadline` (or `deadline_seconds()` without a snapshot). Never reset the anchor, move a non-null due, or blindly re-arm refused rows. Do not use the due index itself to find already-cleared rows. Failure-Class: FC-obligation-outlives-terminal-owner Line-Count-Exception: backend/database/conversations.py | 4960 -> 4969 | Keep atomic due retirement and guarded discard-restore re-arm at their owning writes. Line-Count-Exception: backend/utils/sync/assignment.py | 1538 -> 1539 | Keep atomic summary-debt retirement at the donor redirect write.
|
Closed from SCA-4838 on the Margin owner's call of 2026-11-26 (R38: a lever must be worth at least $20/day net, and this PR's evidence does not establish that). Dropped as a savings PR, not because the code is wrong. Reopen on: A matched baseline showing at least $20/day net savings after fact-log writes, TTL, storage and compute. The quoted $18-33/day models operating cost. |
|
Hey @Git-on-my-level 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Requested by David
Episode sync repeats placement work and Home re-fetches member metadata. This batch adds a per-user fact log, leased shadow drain and sealed Home views with conditional responses. Legacy writers keep serving and retain placement, composition and receipt authority. The drain never invokes paid composition or writes legacy namespaces.
Failure-Class: none
UI-Evidence: none
Product invariants affected
none
Recorded time still owns placement, membership remains singular, and conversations/audio retain their existing authority. Speech-derived views remain sealed. Every new namespace is under
users/{uid}, covered by recursive account deletion and the durable publication fence. Phase changes use the existing derivation function. Composer fingerprints/leases and consumed receipt-ID sets retain paid-once authority. Client changes are generated wire types/optional parameters; #24541's Home layout behavior is unchanged. The earlier Windows test fixture waits for loaded settings before clicking dependent controls, without application behavior changes.Round 6: per-user capture admission
Round 6 closes the remaining rollout exclusion gap:
config.enabled(uid)nowgates setup, commit callback, dispatch, executor execution, flush and failure or
cancellation invalidation alongside global admission. Active rules at 0% and
explicit UID denial install no observer, submit no work and write no capture or
invalidation data, including staging errors and submission failures. Deferred
work rechecks admission, and disabled SDK retries discard aborted intent.
The writer inventory also includes sync bridge cleanup, chat edits/undo and
manual conversation speaker assignment; SDK document versions cover all three.
Validation for this narrow round: 158 focused cases, including rounds 2–5,
and 127 additional regression cases passed. All 2,984 broad acceptance cases passed. All 70 preflight checks passed against the stable committed tree.
Commit:
6699ec117b38804e95e08729149160ff2fbdc157.No merge, deploy, production writes, TTL apply or GCP tier used.
Repair now records the exact projected conversation snapshots, including missing,
hidden and unreadable members, and reads their SDK
update_timeversions insidepublication's transaction before any write. Assignment and smart merge need no
watermark change or prompt delivery to fence stale repair. Edit/delete/create and
hidden-policy races reject publication, preserve dirty, and keep Home on legacy.
Conversation versions share the 128-document source-proof budget with episode,
link and receipt sources. Initial episode/source/old-projection reads remain
bounded at 128; including projected members, initial repair is at most 256 reads.
Publication rechecks at most 128 source versions plus empty-query minimum charges.
There are no added customer serving proof reads or field writes.
Capture-off now gates setup, commit callback, dispatch, execution, flush, and
drop/cancellation invalidation on global and per-user log capture admission. No observer is
installed, no executor submission occurs, and no capture/invalidation write occurs
under saturation or submit failure. Queued-before-kill callbacks and staged errors
also return without work. Disabled policy-release refresh does not invalidate. Disabled SDK retries also
clear an aborted attempt's intent, so readmission cannot dispatch a stale attempt.
capture_possible()may refresh the control-plane flag store even while off;that store contains no customer data. Existing cached-rule propagation and already
committing-operation limits still apply.
Validation: 152 focused cases, including every round-2/3/4 suite; 127 CI
regression cases; 25/25 log emulator proofs. Both real assignment and smart
merge commit after member read with queued
member_refreshand unchanged owner;publication fails and the actual Home endpoint uses legacy at 100% admission.
Four more emulator cases cover uncaptured member changes. Combined log/timeline:
52 passed, 1 failed in the unchanged legacy concurrent-attachment proof after
transaction lock timeout; all log cases pass. The combined suite remains a known
contention limitation, with no retry/concurrency/skip changes. 2,978 broad acceptance cases and all 70 preflight checks passed. Canonical
backend typecheck has zero errors; a conditional-import flow error caught by
the first guarded push was fixed, and all 152 focused cases passed again. Final
qualification and the unchanged combined-emulator limitation are recorded in the
round-5 evidence.
Every projected-source writer and its publication coverage
Audited 2026-11-05 for BasedHardware/omi PR #24607. Paths below are relative to
backend/. This inventories storage writers, including generic adapters andmaintenance tools; lifecycle/services/routers that call those primitives inherit
the same protection. The proof is independent of capture delivery, application
version fields, and whether a writer changes a Home-selected field.
home_read.read_membersrecords each exact conversation snapshot'sdocument path and SDK
update_time, including absent, hidden and unreadablemembers.
reconcile.verifybatch-reads those paths inside publication'stransaction, before any write, and compares versions. Edit/delete/recreate,
or creation of a previously missing member, rejects stale publication. Later
writes serialize against those transactional reads. This covers the entire
document, even when the initial read selected only Home fields.
reconcile.source_documentsrecords and transactionally re-queriesepisodes,episode_links,episode_segment_receiptsand each declaredsarchive shard, comparing SDK versions and path sets. This also detects source
insertion/deletion and receipt-shard-count changes.
account-deletion marker remain additional publication fences. Target
episode_views,episode_view_links, and checkpoint writes have one storagewriter (
database/episode_log.py:publish) under that owner transaction.database/episodes.py_record_activity,_commit,_close,_reopen,_update,write_membership,_write_receiptsdatabase/episode_timeline.py_attach_recorded_window,resume_recordeddatabase/episode_recorded_components.pyattach(owner, absorbed episodes, timeline fence, pending members)database/conversation_recorded_time.pycreate_if_absent(membership adoption is read-only)utils/sync/assignment.pyassign_in_transaction: record replacement; canonical create/update; donors; flattened ancestors; rollover partsmember_refreshemulator proofdatabase/smart_merge.pyabsorb_conversation(survivor/donor/ancestors),record_decision,claim_survivor_refresh,release_survivor_refresh,checkpoint_survivor_processing,complete_survivor_refresh,delegate_survivor_refreshdatabase/conversations.pyupsert_conversation_with_lifecycle,persist_processing_result_with_lifecycle,update_conversation,transition_conversation_status,claim_conversation_status,update_conversation_finished_at,promote_final_pass_if_current,complete_sync_processing_holddatabase/conversations.pyupdate_conversation_title,update_conversation_summary,update_conversation_segments,assign_conversation_speaker,bind_client_processing,materialize_translation,migrate_conversations_level_batchdatabase/conversations.pydelete_conversation,set_conversation_as_discarded,rule_discard_outcome,restore_conversation_from_discarded,set_conversation_starred,set_conversation_visibility,publish_conversation_visibility_if_private,set_conversation_visibility_if_unchangeddatabase/conversations.pyupdate_owner_recognition_diagnostics,mark_playback_deferred,claim_record_lane_owner,record_demand_enrichment_checkpoint,link_duplicate_capture,reserve_share_email_recipients,confirm_share_email_recipients,release_share_email_recipients,set_postprocessing_status,store_conversation_photos(parent marker)database/conversation_mutations.pyapply_conversation_sync_mutationdatabase/conversation_finalization_jobs.py_apply_snapshot_bound_projection(shared lifecycle projection primitive),_dead_letter_finalization_job,_terminalize_exhausted_requeued_job_txn,_record_meeting_receipt_txn,_renew_processing_lease_txn,_reacquire_deferred_processing_txn,_abandon_byok_finalization_job_txndatabase/conversation_processing_recovery.py_stamp_processing_admission_if_absent_txn,_complete_unstampable_orphan_conversation_txn,_complete_orphan_conversation_txn(including public wrappers)database/notes_identity.pyclaim_late_evidence(called byutils/conversations/late_meeting_notes.py:_claim); notes identity content otherwise persists through the listed lifecycle writersdatabase/conversation_terminal_title.pyrecover_deferred_processing_failure_txndatabase/conversation_quiet_checks.pyarm_quiet_check,_evaluate_quiet_check(conversation updates)database/quiet_check_retirement.pyrestore_quiet_check_in_transaction(conversation status)database/oversized_conversation_terminal.py_complete_oversized_in_progress_conversation_txndatabase/conversation_merge_jobs.pyadmit,finish_recovery(source lifecycle)database/recording_sessions.py_create_or_get_recording_session_txn(binding),tombstone_and_delete_empty_conversationdatabase/listen_continuations.pycalendar_continuity_row,resolve_live_continuation(external-data hydration)database/server_batch_audio.pynote_server_batch_audio,close_server_batch_audio,note_server_batch_audio_received,claim_server_batch_lanedatabase/sync_bridges.pymark_sync_bridge_cleaneddatabase/record_audio.pyseal_record_audio,set_record_upload_pending,mark_record_upload_faileddatabase/record_partial.pyfinish_partial,update_rundatabase/batch_pipeline_store.pyFirestoreTransaction.flush(conversation table and external refs);database/batch_pipeline_intake.py:admitroutes record-lane patches heredatabase/batch_pipeline_projection_session.pyProjectionSession.persist(silent-redrive revision; assignment delegates above)utils/batch_pipeline/record_seal_nojob.pyapply_backfillutils/batch_pipeline/record_seal_repair.pyapply_seals(also used by seal sweeper/cluster repair)database/episode_attach_memo.pystamp,completedatabase/summary_processing.pyclaim_from_snapshot,record_empty_failureservices/summary_debt_repair.pyredrive(blocked reason)database/action_item_refresh.pyreconcile(conversation receipt)database/folders.py_rehome_folder_conversations,move_conversation_to_folder,bulk_move_conversations_to_folderdatabase/capture_groups.pyjoin_capture_group,leave_capture_groupdatabase/frame_requests.pyattach_frame_request_to_conversation(parent photo marker)database/screen_frames.pybump_conversation_screen_frames_revision,mark_conversation_screen_frames_adjudicated,set_conversation_screenshot_sharing_enableddatabase/review_changes.pyrecord_agent_change,set_undone(generic entity patch/restore can target conversations)database/chat_edits.pyrestore,apply_update(conversation targets)database/review_transcript_changes.pyrecord_change,set_undone;edit_user_segmentdelegates to recorddatabase/review_overlay_merge.pytransfer(destination overlay and source duplicate marker)database/owner_confirmation.pyrecorddatabase/speaker_resolution_updates.pypersist_speaker_resolution_if_currentdatabase/recording_speakers.pysame_assignment(scope index)database/speaker_auto_enroll.pypublish,retract_conversation(source markers/tombstone)database/voice_profiles.pyremove_ignored_voice(manual assignment receipt)database/recurring_voices.pylearn(source receipt)database/recurring_voice_privacy.pyscrub_transcriptsutils/person_evidence_backfill.pybackfill_person(assignment receipt)utils/conversations/llm_input_dedupe.pyinvalidate_l1,l1_succeededdatabase/stuck_backfill.py_close_txn,_restore_txndatabase/locked_content.pyunlock_query_rows(generic query adapter used for conversations)database/_client.py;database/user_data_deletion.pydelete_collection_recursive;purge_user_subtree(retention/account recursive erasure callers)scripts/backfill_conversation_owner_uid.pyrun_backfillscripts/backfill_notes_v2_default_emoji.pyrewrite_emojiscripts/backfill_sync_donor_tombstone_discarded.pyrun_backfillscripts/migrate_conversation_timestamps.pyprocess_userscripts/migrate_screen_frames_to_data_plane_bucket.py_update_with_cas(conversation state migration)scripts/patch_phone_call_source.pymainscripts/unlock_soft_cap_locked.pyunlock_collectionscripts/capture_empty_recovery.pycasscripts/repair_recovery_dead_letter_untitled.pywrite_cas,rollbackscripts/staging/replay.py;utils/task_intelligence/chat_first_e2e_fixture.pyseed_capture;prepare_fixture(synthetic owner only)database/episode_receipts.py:plan_writeonly plans receipt mutations; the actualhead/archive writes are
episodes._write_receipts, listed above. Read-onlyepisode_batch_pending.read_patchreturns patches applied by the listed timelineand component writers. Child-only photo/model/shadow/evidence documents are not
read by repair: their parent-marker writers are listed where applicable.
Synthetic test/emulator fixtures can also create/update/delete these documents;
the same C/E/L/R proof applies, without a capture hook. Generic external/admin
writes are covered by SDK versions too, not by a manually maintained hook list.
The two queued-writer emulator cases execute the real
assign_in_transactionand
smart_merge.absorb_conversationcommits after the member snapshots,with capture held in a queue and the owner unchanged. Both reject publication
atomically, retain dirty/checkpoint state and keep the actual Home route on
legacy at 100% admission. Delivery alone cannot clear dirty; fresh repair does.
Four additional emulator cases cover direct member edit/delete, missing-member
creation and hidden-member policy change with no capture at all.
Round-3 review fixes
conversation_ids,member_activityandsources, completing the fixed-row geometry consumed by the fold. A neighboring fixed episode retains its members in sealed Home output.capture_dirtytoken, clear Home readiness and advance the epoch. At read 100%, Home automatically serves legacy until full authoritative reconciliation publishes under the unchanged epoch/token/append watermark. Ordinary drains cannot clear the marker. Reconciliation scans legacy episodes, links and receipt archives, removes stale views/links, reprojects current member policy, and fails closed if its bounded source-proof/publication budget (round-5 bounds below) is exceeded. No legacy records are modified.The 64 KiB encrypted content-free fact format and 24-hour expiry from round 2 remain. A capture drop no longer relies on a runbook to block that owner's reads. There is still no durable outbox guarantee for process death between serving commit and append; a total data-plane outage can also prevent writing a dirty marker and emits
invalidation_failed. Obtain a qualified baseline after an unobserved crash/capture-off interval rather than treating a caught-up cursor as proof of gap-free capture.Implementation and rollback
The pure fold ports all five prototype rules through
episode_recorded_components.partition(): displaced IDs, fence-adjacent growth, permanent wedges, retained discard bounds and donor dead keys. Baseline/redirect/fingerprint/receipt state is preserved. Owner + epoch leases fence publication; three-minute debounce, 64-fact batches and a twenty-five-minute age cap bound draining. Stable future Cloud Tasks buckets and the existing bounded sync sweep recover lost wakes, expired owners and retry deadlines. Shared wake-failure telemetry and queued/running/retrying dwell/deadline alerts remain installed as reviewable artifacts.Cursor, compressed multipart checkpoint, views, links and Home version publish atomically. Overflow keeps reads on legacy. Home rows apply server-side visibility/floor/title policy and preserve foreground composition repair. Conditional validators bind UID, exact window/page and policy. Post-drain comparison plus admitted 1% sampled reads use bounded drift labels with no UID labels. The backfill remains dry-run by default and refuses production.
EPISODES_LOG_ENABLEDdefaults false;EPISODES_HOME_ROWS_ENABLEDdefaults on; read percent defaults zero. Roll reads to zero before disabling capture. Keep reads inactive after any capture gap until a fresh baseline is qualified. Legacy namespaces stay intact.Train order and ramp
One PR, one backend train, including merged #24577, #24582, #24579 and #24544. No merge, deploy or production write is authorized here.
Rollout order: TTL apply (ops) -> capture on -> drift soak -> read ramp. First apply the reviewed
episode_facts.expires_atTTL through the separately authorized operator and verify ACTIVE. Then enable the remote capture flag with--episode-data-project based-hardware; its CLI refuses the write without ACTIVE TTL. Runtime independently checks it (60-second cache). This task does not apply TTL.Owner: planscost. Cohorts: 5 / 25 / 50 / 100%. Require drift = 0 for a full day per step, adequate nonzero aligned comparisons, zero capture drops, no missing views, fresh sweep observations, clean deadlines and no composition/receipt regression. Review/complete by 2026-11-18; insufficient evidence blocks expansion. Flag-store changes need no backend rebuild.
Validation
Round-3 qualification: 158 final focused cases passed, 2,951 acceptance cases passed, and canonical backend typecheck has zero errors. Final log-only Firestore emulator: 14/14 passed, including the real neighboring candidate projection, durable-drop recovery, full collection reconciliation, stale projection deletion and content-free repair checkpoint. The earlier combined emulator was 41/42: all log proofs passed; legacy
test_simultaneous_late_devices_converge_on_one_closed_episodeexhausted its existing contention retries. No retry/concurrency/skip change was made. Both owned emulator processes shut down. Final preflight and guarded push are verified before publication; their receipts remain in the dated evidence record.The follow-up head is
4bbf3f7ac5673dd62ec6546e0d28565850250bfa. Its normal guarded push passed all 70 preflight checks, backend typecheck, selected unit suites, API/generator and platform guards with credentials removed. Checks were serialized (OMI_CHECKS_JOBS=1,BACKEND_PYTEST_WORKERS=1) after one local web-heading timeout and one query-guard 300-second wall timeout under parallel load. Test scope and timeouts were unchanged; the isolated four-case web suite and subsequent complete web suite passed. The full query guard passed all 551 cases within the original budget. No hook was bypassed.Full CI on the first round-3 push exposed a test-isolation regression: the scheduling fixture was autouse across legacy suites that stub
utils. It is now explicitly opted into by episode-log tests and their partial-store fixtures. All 127 cases in the 17 CI-reported files passed locally after that test-only fix. Round-3 follow-up CI was checked on4bbf3f7ac5673dd62ec6546e0d28565850250bfa; round-4 validation follows below.The dated evidence record owns exact commands, scopes and historical qualification. Round-2 focused qualification: 166 cases passed; canonical backend typecheck: zero errors. The final reference-hydration follow-up passed 113 log-focused cases, including content-only composer refresh and lease-only no-fact behavior. The complete checked-in acceptance selection passed 2,934 cases.
make preflightpassed 70 checks on8c8f313abdd37c120caf5196f394cb29807d9600; the normal guarded push also passed its typecheck, selected backend tests, API/generator checks, web checks and Swift debug compile without bypasses. Emulator results and limits follow and are retained in that record.Coverage includes capture/encryption/actual-oversize failure isolation with committed serving responses, policy-entry/release failure behavior, content-free facts after conversation hard deletion/tombstone, account-deletion fencing, TTL declaration/expiry, idle due-owner removal, zero-percent Home no-IO, remote capture stop, geometry replay/shuffles/double replay, leases, backfill and composer contracts.
An enabled emulator run passed 37/38; a fresh enabled run again passed 37/38, with different legacy concurrent timeline tests exhausting their existing lock retries. The disabled legacy control passed 28/28. All ten log-specific isolation/privacy/lease proofs passed in each enabled run, and the current log-only emulator command passed 10/10 independently. The canonical GitHub Backend Emulator Proofs workflow passed on
8c8f313abdd37c120caf5196f394cb29807d9600. The local failures remain an unresolved emulator contention signal, not evidence of equal enabled/disabled failure rates. No retry budgets, concurrency, skips or hooks were relaxed. The evidence record retains failures and distinguishes these runs.Cost and post-deploy verification
The round-3 dated forecast retains the explicit scenario of 26.60M reads, 11.30M writes and 4.90M TTL deletes/day. Google's current Standard us-central1 default list rates ($0.03/$0.09/$0.01 per 100K) give an $18.64/day operations floor. The supplied historical effective read/write ratios plus reference TTL deletes give $30.67–32.93/day, so the conservative operations ceiling is $32.93/day. The same modeled small-payload storage and $0–2/day task/compute allowance make the comparable totals $18.66–20.66/day at list rates and $30.69–34.95/day historically (rounded conservative allowance $31–35/day). These are scenario forecasts, not fresh account bills; actual database location/effective rates, retry/drop/repair amplification, index/view/checkpoint bytes, networking and vendor spend remain unmeasured. The regular background scheduling preserves round-2 document operation counts; rare invalidations/full reconciliations add variable overhead.
Synthetic member/mutation ciphertext fell from 14,556/90,064 B to 104/2,000 B. Weighted one-day storage is about 4.12 GiB including an assumed document overhead, before indexes and expiry lag. These are fixture measurements/scenarios, not production means or an all-in bill. Checkpoints/views/indexes, retries, backfill, network/ingestion and vendor spend remain unmeasured.
After the authorized train, verify
OMI_BACKEND_RELEASE_SHAand traffic on every receiving revision, plus a new drain metric/log. Verify ACTIVE TTL/expiry lag, queue OIDC binding, sweep/index readiness, collector delivery and alerts. Check Home 200/304 canaries, policy/composition recovery, receipt continuity, capture drops, billed operations, retained bytes and vendor usage before cohort expansion. The runbook owns limits and rollback. No GCP tier, production account data, production backfill, merge or deploy was used.🤖 Generated with Claude Code.
Round 4: queued capture versus reconciliation
Reconciliation could clear
capture_dirtyusing a snapshot taken before a committed episode close whose post-commit capture was still queued. The owner append watermark did not yet reflect that close.Choose option (b): capture the authoritative source documents' Firestore
update_timevalues, then re-query the source collections and referenced receipt archives inside the publishing transaction, before its writes, and require an exact path/version match. This catches edits, inserts, deletes and archived receipts without relying on application timestamps. Firestore serializes source changes after this recheck against the publishing transaction. A changed source rejects publication and preserves the dirty token, so Home keeps the legacy route. Delivery alone does not clear dirty; full reconciliation must succeed.Serving cost change: zero additional reads, writes, fields or RPCs. The existing serving transactions and async capture path are unchanged. Gap repair adds a bounded second source read (at most 128 source documents, plus query minimum charges for empty collections) and transaction locks on those sources. Only full dirty reconciliation pays this cost; ordinary drains do not. This avoids adding a hot per-owner marker to every serving write.
The periodic sweep now checks global capture admission before constructing a data client or probing TTL. The TTL guard independently checks admission too. With capture off and TTL inactive there are zero
episode_factsqueries and no customer-data calls. Active capture retains the bounded once-per-minute TTL guard.Overflow fence: deliberately remains synchronous. Accepted append/refresh work uses four background workers and 64 queued slots. Only submission failure (normally exhaustion of those slots) or cancellation invokes invalidation: two document reads (durable account-deletion marker and owner), one owner write, at most two SDK commit attempts and no outer retries. This rare failure path must fence Home immediately even when the shared executor cannot accept work; sending its fence back to that saturated executor would risk leaving Home ready after a known drop. RPC latency still applies on this failure path; this is a bounded operation/retry count, not a new hard latency SLA.
Validation: real-emulator queued-close race checks Home uses legacy at read percent 100 until capture delivery and a successful re-reconciliation; source proofs cover edit/insert/delete/archive changes; round-3 policy-entry race retained. 139 focused log cases, 2,957 acceptance cases, and 127 round-3 CI regression cases passed. Log emulator proofs: 19/19 passed. The combined log + recorded-timeline emulator run was 45/47: two unchanged timeline tests (
test_simultaneous_late_devices_converge_on_one_closed_episodeandtest_concurrent_live_and_recorded_attachments_preserve_timeline) exhausted existing transaction attempts after409 Transaction lock timeout. All 19 log cases pass there too. Final preflight: 70/70 checks passed with the round-4 PR body supplied. The combined suite is not green; no proof concurrency, retry budget or skips were changed. The round-4 evidence record owns the measured scope and limitations.No merge, deployment, production writes, or TTL apply. Verification uses hermetic tests and a loopback emulator with synthetic owners; no GCP tier or human cloud credentials.
Line-count exceptions (merge resolution)
The merge into current main triggers the product file line-count ratchet on four already-oversized files; the growth is the gated, default-off episode-log capture plumbing described above.
Line-Count-Exception: backend/database/conversations.py | 4855 -> 4867 | gated home_policy_write decorator lines, default-off capture fence
Line-Count-Exception: backend/database/firestore_index_registry.py | 2330 -> 2334 | episode_log_state scan_at field index requirement
Line-Count-Exception: backend/routers/sync.py | 3812 -> 3826 | episode log sweep hook inside the existing sequencer endpoint
Line-Count-Exception: backend/utils/sync/assignment.py | 1527 -> 1543 | gated episode-log member-change capture hooks