Repository navigation
Ship dark seal-gated audio scheduling and captured-hour accounting - #24866
Git-on-my-level wants to merge 25 commits into
Conversation
Codex Review Summary: ✅ CompletedThis 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. |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
There was a problem hiding this comment.
9 issues found across 44 files
Confidence score: 3/5
pipeline_attention.pycan drop an accepted durable deadline in shadow or serve mode when seal fast is off. Preserve the accepted dispatch time as the due value.pipeline_settlement.pycan settle an unwatched capture before its deadline, lettinghold_decisionbypass the sync hold. Keep it unsettled until the deadline or an actual episode is present.record_attention.pycan group legacy candidates by hashed segment when the Redis hint is missing, letting one owner exceed the per-owner cap. Loadowner_idfrom the Firestore job before grouping.episodes.pycan close an unsealed member when its proof is missing because the snapshot check passes forNone. Reject missing proofs before comparing.
You’re at about 91% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].
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/utils/batch_pipeline/record_attention.py">
<violation number="1" location="backend/utils/batch_pipeline/record_attention.py:134">
P2: A missing Redis hint substitutes the hashed segment for the real owner, so multiple captures from one owner bypass the per-owner cap. Load `owner_id` from the Firestore job before grouping legacy candidates.</violation>
</file>
<file name="backend/tests/unit/test_summary_persistence.py">
<violation number="1" location="backend/tests/unit/test_summary_persistence.py:84">
P3: The `sync_content_revision` case is already refused by the existing generation fence, so it does not isolate the pipeline seal. Either drop it here or make the payload revision match the seal so only the seal can refuse the write.</violation>
</file>
<file name="backend/utils/sync/pipeline.py">
<violation number="1" location="backend/utils/sync/pipeline.py:1359">
P3: This success log drops `conversation_id`, so processed reprocess events can no longer be matched to a conversation. Add the ID back as a field, for example `event=sync_reprocess_callback outcome=processed conversation_id=%s`.</violation>
</file>
<file name="backend/scripts/finops/assemble_unit_cost.py">
<violation number="1" location="backend/scripts/finops/assemble_unit_cost.py:890">
P2: This block republishes the captured-hour cost report without re-checking its inventory gate. The report's `valid_until` is dropped at pull time, so a stale 'reconciled' status is emitted as current. Persist the proof's expiry in the report and re-check `denominator_complete` and freshness here before writing or printing cost values.</violation>
</file>
<file name="backend/utils/conversations/pipeline_attention.py">
<violation number="1" location="backend/utils/conversations/pipeline_attention.py:120">
P2: When `pipeline_dispatch_at` is already accepted and the mode is `shadow` or `serve`, this returns `None` as the due value unless seal fast is enabled. The durable deadline is dropped on that path. Return the accepted deadline whenever the work is not bypassed, for example by gating on `policy.seal_fast_enabled()` instead of the mode.</violation>
</file>
<file name="backend/docs/feature-flag-registry.md">
<violation number="1" location="backend/docs/feature-flag-registry.md:1039">
P2: The rollout ramp for these flags has no power/battery guardrail, although the PR requires one before expansion. Add the device battery/power clean metric to `clean_metric` in `config/feature-flags.yaml` and regenerate this file.</violation>
</file>
<file name="backend/database/episodes.py">
<violation number="1" location="backend/database/episodes.py:802">
P2: The seal check fails open when a member's proof is `None`: `snapshot_matches(member, None)` returns True for an unsealed member, so the close proceeds. Reject falsy proofs explicitly before comparing.</violation>
</file>
<file name="backend/utils/enrichment/outbox.py">
<violation number="1" location="backend/utils/enrichment/outbox.py:565">
P2: This read fetches the full conversation document, which can be large, for every promoted row on each owner read. Restrict it to the fields `seal_snapshot` uses, as `pipeline_snapshot` already does.</violation>
</file>
<file name="backend/utils/episodes/pipeline_settlement.py">
<violation number="1" location="backend/utils/episodes/pipeline_settlement.py:20">
P2: This 600-second fallback marks an unwatched capture settled before its capture-end + 1,680-second deadline, so `hold_decision` can bypass the sync hold early. Keep it unsettled until the deadline (or an actual episode settlement).</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| metadata: dict[str, dict[str, Any]] = {} | ||
| for segment in dict.fromkeys(list(legacy) + aged + fresh): | ||
| raw = r.get(base() + segment) | ||
| meta: dict[str, Any] = json.loads(raw) if raw else {'uid': segment, 'enqueued_at': float('-inf')} |
There was a problem hiding this comment.
P2: A missing Redis hint substitutes the hashed segment for the real owner, so multiple captures from one owner bypass the per-owner cap. Load owner_id from the Firestore job before grouping legacy candidates.
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/batch_pipeline/record_attention.py, line 134:
<comment>A missing Redis hint substitutes the hashed segment for the real owner, so multiple captures from one owner bypass the per-owner cap. Load `owner_id` from the Firestore job before grouping legacy candidates.</comment>
<file context>
@@ -0,0 +1,219 @@
+ metadata: dict[str, dict[str, Any]] = {}
+ for segment in dict.fromkeys(list(legacy) + aged + fresh):
+ raw = r.get(base() + segment)
+ meta: dict[str, Any] = json.loads(raw) if raw else {'uid': segment, 'enqueued_at': float('-inf')}
+ if segment not in legacy and (
+ not raw or not attention.serving(meta['uid']) or (r.zscore(base() + 'due', segment) or 0) > now
</file context>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0641077fc8
ℹ️ 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 processing_hold.FIELD in conversation_data and not conversations_db.complete_sync_processing_hold( | ||
| uid, conversation_id, conversation_data.get('sync_content_revision'), None | ||
| ): | ||
| raise SyncConversationPersistenceFenced('hold completion snapshot changed') | ||
| context['hold_skipped'] = True | ||
| return sync_result('no_op') |
There was a problem hiding this comment.
Keep unfinished derived effects retryable after notes persistence
When a sealed run persists its notes and then fails during derived effects, this fingerprint already matches on retry: summary_delivery.merge_result saves it in the notes transaction, before process_conversation calls _extract_memories and _save_action_items. Those calls deliberately propagate retryable failures, but this branch instead clears the hold and acknowledges the obligation without retrying them, permanently losing memory/task updates for that transcript. Require a durable effects-completion receipt before taking this no-op path, or resume the unfinished effects without regenerating notes. The mirrored branch in utils/sync/pipeline.py needs the same treatment.
Useful? React with 👍 / 👎.
| first_summary = first_summary_pending(row) | ||
| if not first_summary and schedule( | ||
| if (not first_summary or pipeline_attention.serving(row['uid'])) and schedule( |
There was a problem hiding this comment.
Carry the patient deadline through demand-priority admission
When demand processing is enabled and higher-priority work remains ready, routing pipeline first summaries through schedule lets the demand gate postpone them beyond their accepted pipeline_dispatch_at. Both FirestoreEnrichmentOutbox.claim_key and the legacy outbox runner call demand_processing.admit before invoking the callback, but that gate only escapes priority blocking after CEILING_HEADROOM_SECONDS (3,540 seconds after indexing); it never receives the new 1,680-second deadline. Consequently, the durable deadline check in hold_decision cannot run at the deadline, and unwatched first notes can miss the 30-minute target even with available worker capacity. Propagate the accepted deadline into demand admission as an escape bound, or preserve the first-summary exemption.
Useful? React with 👍 / 👎.
| candidates.append(segment) | ||
| if len(candidates) >= batch_size: |
There was a problem hiding this comment.
Check remaining capacity before filling the fresh record slots
With the supported RECORD_DRAIN_BATCH=1 setting, every oldest-reservation turn already fills the batch in the preceding loop, but this loop still appends a second record from another owner before checking capacity. A two-owner reproduction returns two records for a batch size of one. Besides exceeding the configured admission bound, this makes drain_recordings return false because its full-page check is len(segments) == batch_size, so the serving loop can enter its 20-second idle wait despite a continuing backlog. Stop before entering or appending in this loop when the reservation has already filled the batch.
Useful? React with 👍 / 👎.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
0641077 to
4a23ac8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4a23ac8165
ℹ️ 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".
| episode_compose_settle_enabled() | ||
| and background | ||
| and not force | ||
| and not pipeline_attention.fast_members(uid, members) |
There was a problem hiding this comment.
Check fast-compose receipts against undecorated member evidence
For watched or promoted conversations with a recognized participant, _members has already replaced each member's transcript with _named(...), which adds person_name through moment_render.name_segments. However, the durable notes_fingerprint was calculated from the conversation's undecorated transcript, and fast_members hashes the entire segment dictionaries. Adding the display name therefore makes an otherwise current receipt fail validation, so background composition takes the ordinary 10-minute settle path instead of the intended fast path. Validate the receipt against the original member evidence before applying prompt-only name decoration.
Useful? React with 👍 / 👎.
# Conflicts: # config/feature-flags.yaml
# Conflicts: # backend/docs/feature-flag-registry.md
# Conflicts: # backend/utils/batch_pipeline/live.py
<!-- claude-projects-attribution: {"github_login":"Git-on-my-level"} -->
_Requested by **David**_
## Summary
Raises testing-library's async wait (`asyncUtilTimeout`) from the 1 s
default to 5 s in the shared web test setup. Test-only change, four
lines, no product code and no UI change.
## Why
Three web tests fail intermittently in the full vitest run, and each
failure is `TestingLibraryElementError` from a `findBy` that expired,
not an assertion about wrong content:
- `DevelopersKeys.test.tsx` "shows genuine empty lists": `findByText('No
API keys created yet')`
- `SettingsDailySummary.test.tsx` "does not save the settings when the
load failed": `findByText('Daily Summary')`
- `SettingsSubscriptionClarity.test.tsx` "shows Plus with its finite
meter and records a real checkout selection": `findByRole('heading', {
name: 'Plus' })`
`vitest.config.mts` sets `testTimeout` to 15 s, which none of them hit.
`vitest.setup.ts` did not override testing-library's 1 s async default,
so a first render slower than 1 s fails under host load. The failing set
changed from run to run, which fits a load-dependent timing race.
## Verification
- Full web suite through `bin/omi-heavy`, same commands as the pre-push
hook (`bun test scripts/moonshine-smoke.test.ts && vitest run --config
vitest.config.mts`), at normal MacBook load:
- run 1: 167/167 files, 1011/1011 tests, 179.5 s
- run 2: 167/167 files, 1011/1011 tests, 140.3 s
- The pre-push hook on this branch also ran the full web suite (see the
push result).
## Scope
Only `web/app/vitest.setup.ts`. The per-test timeout stays at 15 s. The
fix hides nothing and changes no assertion. It bounds an async wait; it
does not skip or retry tests.
## Ownership
Owner: the home-overlap lane. This PR unblocks the pre-push web gate for
`lane/pipeline-approved` (#24866).
🤖 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/24903?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/24903?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24903&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. -->
findBy and waitFor default to 1 s. Under host load the first render of the settings and developer pages can take longer, so three tests failed with element-not-found on a rendered page rather than on wrong content (DevelopersKeys, SettingsDailySummary, SettingsSubscriptionClarity). Raise the async wait to 5 s in the shared setup. The per-test timeout stays at 15 s.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0cb6051be
ℹ️ 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 deadline is not None: | ||
| row['pipeline_dispatch_at'] = deadline | ||
| row['due_at'] = min(row['due_at'], max(current, deadline)) | ||
| row['sync_hold'] = True |
There was a problem hiding this comment.
Preserve accepted pipeline deadlines during redirect transfer
When a conversation with an accepted pipeline deadline is absorbed into another conversation, custody.transfer_redirect copies the donor's ordinary summary deadline and hold metadata but omits pipeline_dispatch_at, pipeline_capture_end, and pipeline_record, then deletes the donor obligation. Consequently, the canonical obligation loses the earlier accepted pipeline bound and can resume under its later deadline or legacy hold timing; after rollback, it also loses the durable pipeline gate. Extend the redirect transfer to preserve the earliest accepted pipeline deadline and the applicable capture/projection metadata.
Useful? React with 👍 / 👎.
| proof = policy.seal_snapshot(row) | ||
| if proof is None: | ||
| metrics.event('seal_denied') | ||
| return False, now + 60 if accepted or record else None, None |
There was a problem hiding this comment.
Handle terminal discards before scheduling another seal check
If a user discards a conversation while its pipeline obligation is waiting, set_conversation_as_discarded leaves the obligation intact, but seal_snapshot permanently rejects the row because discarded is true. This branch then reschedules it every 60 seconds indefinitely—even past its accepted deadline and with the rollout disabled—and both callbacks return before reaching their existing relevance/discard handling. Distinguish a terminal discard from an incomplete upload seal so this work can settle instead of creating an endless retry stream.
Useful? React with 👍 / 👎.
# Conflicts: # config/feature-flags.yaml
…quiet empty exit + digest-approved repair) (#25000) _Requested by **David**_ (P0, user-visible data loss: lead2 freeze exemption 8c0822) ## What changed and why Some `batch_live_v1` captures stay `in_progress` forever. Their live session ended, quiet finalization was never armed, and no batch job exists, so nothing server-side ever closes them. On Home they show as stuck or empty rows. This PR adds two dark exits: 1. **Quiet-check empty exit** (`QUIET_EMPTY_EXIT_ENABLED`, default **off**). Only an exactly owned, proven-empty row qualifies: received=false, no audio/window metadata, no producer tokens or upload failure, an empty storage proof, and the existing expired-lease fence. Such a row exits through the existing lifecycle delete transaction. Every other shape (unowned, markerless, any token, pre-pointer chunks) takes exactly the base path. A row the check can't decide (unknown lease, missing marker) retires its quiet obligation instead of rearming forever, and the repair counts it as `operator_review`. 2. **Digest-approved orphan repair** (`BATCH_LIVE_ORPHAN_REPAIR_ENABLED`, default **off**), an operator CLI that is never scheduled. Dry-run by default, it reports aggregate counts only, including retained-span audio seconds for STT sizing. Apply needs `--apply --approve-plan-sha256 <digest>`, at most 128 rows per page. A sealed capture with received audio is proven against immutable retained audio, then one fenced transaction stamps window/content, completes the capture barrier and creates the canonical batch job, which exits through the normal batch pipeline. Owner-level privacy (consent, deletion, protection) is checked before any row read. Capture-level privacy reads only the three privacy fields before refusing. Discovery is identity-only. Raw audio and GCS objects are never deleted. No `live.py`, timer, due or dispatch changes (#24866). Runbook: `backend/deploy/record-orphan-repair/README.md`. Design: the orphan scope findings (group B of David's Processing rows). ## Tuning - max_count new: 4096 on the repair's retained-archive listing. Before: 0 listings per orphan (no repair existed). After: at most 1 listing of up to 4096 objects per repaired capture, the same bound the record seal/no-job repair uses. A larger archive refuses the capture (parked), not a partial proof. ## New states and exits - privacy_skipped: no data mutation and no storage proof. Exit: an operator re-run after the owner's consent or privacy state changes (runbook "Dispositions and exits"). The row stays as it is, so nothing loops. - operator_review (lease_unknown, barrier_mismatch): exit is an operator decision recorded in the runbook. The quiet obligation is retired, so nothing rearms. - registered: exit is the normal batch pipeline. empty_deleted: exit is the noise/discard terminal through the existing lifecycle delete. ## Product invariants affected - Every new disposition names its exit; no row rearms forever. - Never delete raw audio. - Both switches default off; activation and any prod APPLY need explicit approval (APPLY and delete-empty: David). ## How it was verified - Quiet finalization, orphan repair and recording-session suites through `bin/omi-heavy` with GCP credentials unset: 243 passed on the final head. Pyright: 0 errors. Repository preflight: 44 checks passed (serial, 900 s file budget). - Independent Luna reviews: correctness SHIP (round 2), custody/privacy SHIP (round 3 delta at fa502de, which ran 21 focused privacy/discovery tests). ## Tests `test_conversation_quiet_finalization.py` (the custody fence matrix, unowned-with-token and pre-pointer-chunks regressions, retire-instead-of-rearm), `test_record_orphan_repair.py` (privacy ordering with read-recording fakes, dry-run with/without `--next-file`, operator_review dispositions, audio deletion never called), recording-session tests. ## UI evidence UI-Evidence: none -- backend change only ## Failure class (fixes) Failure-Class: FC-session-owned-job-stranded-after-owner-death Rollback: both switches are off by default. If enabled, set them false; committed jobs drain normally. Code rollback: revert both commits. 🤖 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/25000?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/25000?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F25000&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. -->
) ## 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.
…efault off (#25018) ## Merge-main push 5 Head: `1ec50a75e6e8c34eca7601e768148be7ac2c9830`. Merge-main resolution under lead2 `1c606e`; reviewed patch behavior unchanged. Merged main: `28b447f847fccfa960fecf17312561ab390e82a6`. A final refetch added only main's v0.12.574 desktop changelog (two files, +14 lines) in a second normal merge. The sole textual conflict in the initial main merge sets `flag_budget.count` to the merged registry's actual 269 names. Both sides are preserved. The token-lease metrics and quiet-check, erasure guard, receipt replay, renewal retention and deterministic messaging test remain unchanged. Incoming main changes are preserved; no new workflow or UI change was authored. Fresh qualification on this exact head: 44 seal/custody/privacy/lifecycle, pusher and messaging unit files yielded 1,517 passed and 86 existing xfails, zero failures/skips (includes all 24 flag-budget tests). Loopback emulator/lifecycle suites yielded 30 + 4 + 34 + 75 + 39 passed, with 3 existing lifecycle xfails; all emulators shut down normally. Expanded preflight passed all 75 checks. Normal full pre-push passed: 3 metadata checks, 75 shared checks, zero backend typecheck errors, 851 index-guard passes in 7 files, and 34 selected backend files yielding 2,141 passed / 86 existing xfails / 4 emulator skips / 144 integration deselections. The skipped/deselected emulator coverage passed independently above. Merge delta from the reviewed head, including incoming main: 347 files, +15,679/-952. Full PR diff against merged main: 124 files, +9,626/-159. Commands use `omi-heavy run --` with inherited GCP credentials and CLOUDSDK variables removed. Local static/synthetic and loopback emulator evidence only. Exactly one normal fast-forward push completed from `9a48272644889eae505df59221bf8ccf5da78281` to this head. Its mandatory full hook also passed with the same 75 shared checks, zero typecheck errors, 851 index-guard passes, and 2,141 passed / 86 existing xfails / 4 emulator skips / 144 integration deselections across 34 selected backend files. No rebase, force push or hook bypass. STOP for delta-only Luna. No deploy or merge. Historical qualifications below remain attributed to their recorded heads. ## Flag count and backfill CI diagnosis Earlier head: `9a48272644889eae505df59221bf8ccf5da78281` (parent `7d9126fd6738173a6324dadedd7b6973267fe793`). The only incremental source change corrects `flag_budget.count` from 267 to 268, equal to the merged `names` count; no flag or behavior is added. Incremental diff: one file, +1/-1 (two changed non-test lines). Shard 8's backfill assertions all passed; its failure was the unchanged 1.00s CPU guard at 1.14s for `test_backfill_cleared_discard_restore_recovers_only_owed_unarmed_debt[None-still_refused0]`. Current main is `4e9c70405c53f8efcaced2fea369910ade355058`. Local exact-node runs pass on both main and L1; the full backfill file passes on both (101 passed, one existing emulator skip each). The flag budget file passes all 24 tests. No backfill code, test, skip, xfail or timing limit changed. Current main CI also passed this case at 0.89s (Backend Unit Tests run 42946411215, shard 7). Local CPU measurements were 0.80s main / 0.52s L1 for the isolated node and 0.41s on both full-file runs. The exercised backfill, conversation restore, summary-delivery and strict transaction fake match main. Classification: the backfill failure is not reproduced on current main or locally on L1; evidence supports a CI timing flake, with no established L1 functional regression. A main-wide failure is NOT confirmed. Backfill is left unchanged; no timing limit or marker is relaxed. Normal full pre-push passed on this head: 75 shared checks, supplied-body metadata validation, zero backend typecheck errors; seven embedded index-guard files yielded 848 passes, and 34 selected backend files yielded 2,140 passed, 86 existing xfails, four emulator skips and 144 integration-marker deselections. Both exact failing nodes passed independently (one test each); full focused L1 files yielded 125 passed and one existing emulator skip. All gates ran through `omi-heavy run --` with inherited GCP credentials and CLOUDSDK variables removed, private HOME/config and disabled metadata discovery. These are local static/synthetic results, separate from remote CI. Exactly one normal fast-forward push completed from the parent to this head. Its mandatory hook also passed with the same 75 shared checks, zero typecheck errors, 848 index-guard passes and 2,140 passed / 86 existing xfails / four emulator skips / 144 integration deselections across 34 selected files. No hook bypass or timing relaxation was used. STOP after one green push for delta-only Luna. No deploy or merge. Previous qualification remains attributed to its recorded head. ## Merge-main push 3 Earlier head: `7d9126fd6738173a6324dadedd7b6973267fe793`. Merge-main resolution under lead2 `1c606e`; reviewed patch behavior unchanged. Merged main: `4e9c70405c53f8efcaced2fea369910ade355058`. The two textual conflicts are mechanical unions of worker labels/lease defaults and the monitoring keep-regex. Erasure, receipt replay, renewal retention, repair coordinator and messaging-test fix remain byte-identical to the reviewed parent. No workflow file changed. Fresh credential-free local qualification through `omi-heavy`: 43 focused unit files, 1,493 passed and 86 existing xfails; loopback emulator suites 30 + 4 + 34 + 75 + 39 passed with 3 existing lifecycle xfails; expanded preflight 75 checks passed; normal full pre-push passed with 3 metadata checks, 75 shared checks, 848 index-guard tests, zero backend typecheck errors and 34 selected files yielding 2,140 passed / 86 existing xfails / 4 emulator skips / 144 integration deselections. Emulator coverage passed separately above. Local static/synthetic and loopback-emulator evidence only. Merge delta: 52 files, +1,670/-49 (incoming main included). Full PR diff: 124 files, +9,626/-159. Stop after this one push for delta-only Luna and refactor-lead's custody delta. No deploy, ramp or production access. Exactly one normal fast-forward push completed from `5bbf8212c634a5c38f151fbdf310cbb839f64e12` to this head. The mandatory push hook also passed with the same shared, typecheck, index-guard and selected-backend results. ## Merge-main push 2 qualification Earlier head: `5bbf8212c634a5c38f151fbdf310cbb839f64e12`. Merged current main: `aa3df45721c8714c58c66f69f81ebbc507c2f526`. Mechanical merge-main resolution under lead2 `1c606e`; reviewed L1 runtime behavior preserved. The resolution keeps L1 token-lease metrics, custody maintenance, erasure admission, receipt replay and renewal retention alongside main's urgent/recent repair scheduling and quiet-check behavior. The equivalent deterministic messaging test stub is retained from main. Test-only composition reconciliations isolate priority fixtures from custody maintenance/metrics-server IO and align the emulator expectation with main's newest-first order; no runtime policy change. Fresh local qualification on this exact head ran through `omi-heavy run --` with inherited GCP credentials and CLOUDSDK variables removed, private test HOME/config, metadata discovery disabled and synthetic fixtures: - Seal/custody/privacy/lifecycle and pusher retention/barrier units: 43 files, 1,493 passed, 86 existing xfails, zero failures/skips; includes 11 messaging cases and 39 priority cases. - Loopback emulator/lifecycle: custody append 30 passed; no-job seal 4 passed; lifecycle/properties 34 passed and 3 existing xfails; held custody 75 passed; recovery custody 39 passed. Emulator shut down normally. - Expanded preflight: 75 checks passed, zero failures. - Normal full pre-push: 75 shared checks, 3 metadata prechecks, zero backend typecheck errors; 34 selected backend files, 2,108 passed, 86 existing xfails, 4 existing emulator skips, 144 integration deselections. The skipped/deselected emulator cases passed separately above. Merge delta from reviewed head: 63 files, +2,876/-138, including imported main. Full PR diff against merged main: 124 files, +9,626/-159. The incoming workflow change is exactly main's blob; no workflow change was authored in this resolution. Local static/synthetic and loopback-emulator evidence does not establish remote CI or deployed behavior. Stop after the single push for delta-only Luna and refactor-lead's custody delta. No deploy, ramp or production access. ## Test-only messaging determinism fix Earlier head: `4328ac0ff96324d99e35ce5ab57c7f69885085d1` (parent `cd63b355ba4fefaff836908b9767c681cd353f8e`). Test-only determinism fix for a main-wide messaging flake: the optional continuity-load failure regression now executes its in-memory reads directly so the mocked digest succeeds without executor startup/deadline races; product code is unchanged. Incremental diff: one test file, +6/-1 (under 20 changed lines). Exact `test_optional_load_failure_returns_plain_window[failure2]`: 1 passed; full `test_messaging_review_fixes.py`: 11 passed, including all three continuity-failure parametrizations. Checks run via `/Users/david/workspace/omi-workspace/bin/omi-heavy run --` with inherited GCP credentials and CLOUDSDK variables removed, private HOME/config, and disabled metadata discovery. Normal full pre-push passed on this head: 75 shared checks, 3 supplied-body metadata checks, zero backend typecheck errors; 34 backend files yielded 2,080 passed, 86 existing xfails, 4 emulator skips and 144 integration deselections. This is local static/synthetic evidence; no remote CI or deployed behavior is claimed. Exactly one fast-forward push completed; its mandatory hook also passed with the same shared/typecheck/backend counts. Stopped for delta-only Luna; no deploy or merge. Historical qualifications below remain attributed to their original commits. ## Refused-receipt retry fix Earlier head: `cd63b355ba4fefaff836908b9767c681cd353f8e` (parent `b0cee99fdeb521e32b1e7c71fc8e52ac5ab27b62`). Addresses the single FIX-FIRST: `finish()` replays only accepted receipts, so a same-job retry after a refused `202/failed` clears its newly acquired token and records the accepted revision and recovery obligation. Accepted receipt replay remains idempotent. Incremental scope: 2 files, +45/-3; 5 changed non-test lines, under the 40-line cap. The new request-level regression first failed on the parent with the retry token still active; it verifies refusal has no revision/recovery effect, then successful retry records revision 8, schedules recovery, clears custody and replays without another write or late count. Focused custody/token-lease/erasure/privacy qualification passed all 520 tests in 20 isolated files (custody append: 84 passed). Normal full pre-push passed: 75 shared checks, 3 supplied-body metadata checks, zero backend typecheck errors; 33 selected backend files yielded 2,069 passed, 86 existing xfails, 4 emulator skips and 144 integration deselections. This is local static/synthetic evidence; no emulator integration run or deployed behavior is claimed. Checks use `/Users/david/workspace/omi-workspace/bin/omi-heavy run --` with inherited GCP credentials and CLOUDSDK variables removed, private HOME/config and disabled metadata discovery. Exactly one fast-forward push completed from the parent to this head. Its mandatory hook also passed: 75 shared checks, 3 supplied-body metadata checks, zero typecheck errors, and the same backend counts. No workflow, deployment, ramp, access or production change. Stop after one green push for delta-only Luna and refactor-lead custody delta. Historical qualifications below remain attributed to their original commits. ## Current merge-main qualification Earlier head: `584188bf8e8af86592e8c211ed8982649aa2fc58`. Merge-main resolution under lead2 `1c606e`; one normal push from `2afc561cdb03a95695f603d3873c1433ebceda55`, merging current main `75dc53a81df78643cf74c7638350fecc9082ebfc`. Resolution preserves both adjacent flag-catalog additions verbatim. Each parent independently added one index and moved the fixed field-index counts from 23/25 to 24/26; the combined registry requires 25 requirements / 27 modes. Only those two test literals were reconciled after the initial expanded preflight exposed the automatic merge collision. The reviewed token-lease metrics, quiet-check, erasure guard, receipt replay and renewal-retention behavior remain unchanged. No workflow or action was changed by this merge resolution. Fresh checks on this exact head ran through `/Users/david/workspace/omi-workspace/bin/omi-heavy run --`, with inherited GCP credentials and CLOUDSDK variables unset, private HOME/config, disabled metadata discovery and synthetic fixtures: - Seal/custody/privacy/lifecycle plus pusher retention/barrier units: 40 files, 1,433 passed, 86 existing xfails, no failures or skips. - Real loopback Firestore and lifecycle: custody append 30 passed; no-job seal 4 passed; lifecycle/properties 34 passed and 3 existing xfails; held custody 75 passed; recovery custody 39 passed. Emulator shut down normally. - Expanded preflight: 75 passed, zero failures. - Normal full pre-push and actual mandatory push hook: both passed; 75 shared checks and 3 supplied-body metadata checks; backend typecheck zero errors. Each selected 33 backend files, yielding 2,068 passed, 86 existing xfails, 4 emulator skips and 144 integration deselections. The skipped/deselected emulator suites passed independently above. - Merge delta from prior PR head: 60 files, +4,899/-66, including incoming main. Current PR diff against merged main: 123 files, +9,583/-159. The 86 strict lifecycle-invariant xfails and 3 lifecycle simulator xfails are existing; no xfail or skip was added. This is local static/synthetic and loopback-emulator evidence; remote CI and deployed behavior are separate. Exactly one normal push completed. STOP for delta-only Luna and refactor-lead's custody delta. No deploy, ramp or production access. Historical qualifications below remain attributed to their original commits. ## Previous L1 renewal-budget fix Earlier head: `2afc561cdb03a95695f603d3873c1433ebceda55` (parent `023db969b7d158ba0c518c5cb318be11b90f6aaa`). Addresses the custody delta 3 FIX-FIRST: a Firestore renewal refusal no longer enters the storage upload retry ladder. The unchanged batch stays in the ready lane with its existing audio-budget reservation, without incrementing upload retries or reaching `fail_recording`/the exhaustion drop. Disconnect-drain renewal retries remain paced and cancellable. The receive-window path is unchanged. Incremental scope: 2 files, +68/-2; 11 changed non-test lines (under the 60-line cap). The two router regressions inject renewal errors beyond `PRIVATE_CLOUD_SYNC_MAX_RETRIES` during a live socket and after disconnect, then verify exact PCM reaches the synthetic upload writer without `fail_recording`. Both regressions fail against the parent and pass with the fix. Focused pusher barrier/abandon, custody and token-lease qualification: 413 passed across 14 isolated files, no failures/skips. Normal full pre-push on this head passed: 75 shared preflight checks, supplied-body metadata validation, backend typecheck with zero errors; 33 selected backend files yielded 2,068 passed, 86 existing lifecycle xfails, 4 existing emulator skips and 144 integration-marker deselections. All qualification ran through `omi-heavy run --` with inherited GCP credentials and CLOUDSDK variables removed, private HOME/config, disabled metadata discovery, and synthetic fixtures. This is local static/synthetic evidence. Stop after the single fast-forward push for delta-only Luna and refactor-lead custody delta on this exact head. No deploy, ramp or production access. Exactly one fast-forward push completed from the parent above to this head. Its mandatory pre-push hook also passed with the same 75 shared checks, zero typecheck errors, and backend counts. _Requested by **David**; ship owner: refactor-lead._ ## What changed and why A vanished producer can otherwise keep audio unsealed indefinitely. Part A replaces that indefinite fence with a server-observed lease inside the existing producer map. Only storage-backed custody appends and frame-bearing pusher batches establish accepted late audio; custody heartbeat renewal requires this upload's explicitly acquired session in the eligible serve cohort. Off preserves original producer behavior, shadow observes, and serve uses the fresh `record-token-lease` cohort. Raw audio is retained throughout. Custody uploads acquire an exact request token before staging, finalize after durable acceptance, and clear refusals without a revision bump. The custody lease covers the production backend-sync timeout plus the named 300s margin (currently 3900s); frame leases default to 3600s. Late audio invalidates the captured upload revision and re-arms create-only partial recovery, including interior holes. Recovery of accepted serve bytes survives mode rollback. Separate recovery jobs are parked as `record_recovery_waiting` while the original publication is unsettled. Old worker images cannot schedule this state. The active repair CronJob and current workers transactionally promote it to `record_pending` only after the original ledger/publication completes, in off, shadow or serve; privacy revocation exits to `privacy_blocked`. This prevents a rolled-back worker from bypassing the publication fence. Normal partial processing retains its existing `partial_retired` exit and inventory rearm. Finish receipts are idempotent across lost commit responses, enroll account-erasure authority before every write, and expire through the active repair CronJob after 24h. Expiry uses the existing server `recorded_at`, covering prior receipt versions. It deletes metadata only, never audio or recovery jobs. Pusher metadata-renewal failures retain receive windows or requeue projection batches before durable storage, and failed registration cannot be resurrected by a same-frame renewal. Persisted `append_late` survives registration retries; late metrics count durable acceptance exactly once. **Landing order:** #24866 remains open and is an adjacent-file integration dependency, not a runtime prerequisite. Land #25018 first after this fresh-main merge. Then merge that resulting main into #24866 and preserve both its seal-gated scheduling/callback changes and this lease/revision protocol in shared transactions; regenerate its flag registry and rerun both focused suites. Do not rebase the published #25018 branch. #24832's age-only grace is superseded/absorbed. Main's staged-input alerts and both exact token-lease split-file payloads are retained in the regenerated union. ## Consolidated privacy review fixes Custody admission now checks the canonical owner/erasure authority before any custody token or raw staging, including missing accounts and active purge. Actual custody uses the same conversation privacy checks as finish/recovery; sync opt-out retains its existing no-custody behavior while still enforcing owner erasure. A missing identified target refuses admission. Finish/recovery logic is unchanged. Archive heartbeats now identify the exact session acquired by this upload. Custody renewal requires that session and an eligible serve cohort; unowned, shadow and non-cohort archives retain read-only late observations without extending any custody token. Ordinary frame renewal and dead-letter behavior are unchanged. No flag, ramp, workflow, access or production change is introduced. Previous merged candidate: `023db969b7d158ba0c518c5cb318be11b90f6aaa` (includes current main `85de1985f0fb4fddd05e0de4b36c1ac68108d81e`). Exact-head verification is recorded below; earlier results remain attributed to their recorded commits. ## Product invariants affected - INV-DATA-1: preserves the existing production customer identity and data plane. The changes in `gcp_backend_listen_helm.yml` and `gcp_backend_pusher.yml` only validate and bind the four shared record-token-lease rollout inputs; they do not change customer-data endpoints, Firebase/Auth/Firestore projects, UID authority, service accounts, credentials or IAM. This is not a customer-data migration. - INV-MEM-4: canonical admission remains the sole Long-term authority; runtime wiring does not add an admission path. ## Failure class (fixes) Failure-Class: FC-state-deadline-without-reader-exit lease_would_expire is a shadow diagnostic, not a persisted job state. Its observation ends with the next planner evaluation: a fresh append restores liveness, exact finish clears the fence, or serve-mode retained-tail/privacy proof permits seal/partial finish. Named exits: producer lease lapse still requires the quiet heartbeat/append predicate plus retained-tail/privacy proof; exact finish clears custody; complete seal and partial finish remain distinct; late audio reactivates the revision. Parked recovery exits through `database/record_recovery_gate.py:promote` after original publication, independent of the mode. Finish receipts exit through `database/record_custody_receipts.py:prune` or account erasure after the bounded retry window. ## How it was verified Source inspection checked the INV-DATA-1 routing guard entry in `.github/checks-manifest.yaml`, the production-data-plane declaration in `backend/utils/cloud_tasks.py`, and the two small workflow diffs. Those diffs add rollout-input validation/binding only. This is static source evidence, with no live customer-data or deployed-artifact verification. Historical runtime/custody results remain attributed to their original tested commits. Local commands use `bin/omi-heavy`, credential-free private test environments and the canonical `backend/test.sh`, with 900s per file. The batched pre-review report records the exact focused, all-backend custody, lifecycle/emulator, alert/telemetry, real PromQL, hook typecheck and expanded preflight results. New custody, nojob and lifecycle property proofs are wired into the emulator CI lane; the checksum-pinned PromQL check runs in both local and CI manifest lanes. The 50ms race now uses event-driven expiry inside enqueue without weakening its one-write assertion. Evidence: `backend/docs/listen_pusher_pipeline/changes/2026-11-10-token-lease-batched-prereview.md` (local validation report). No production access or GCP credentials used; refactor-lead performs the single push and subsequent independent review. ## Rollout Default lease mode remains `off` with serve percent `0`. This branch and this qualification apply no deployment, traffic shift, environment-variable change, access grant or customer-data operation. The workflow additions take effect only on a separately authorized workflow execution; a branch push does not authorize or perform the production rollout. Checked-in defaults remain off. Bind the same four `RECORD_TOKEN_LEASE_*` protected-environment inputs to Cloud Run and the shared producer ConfigMap; GKE pods consume explicit key references. Roll all producers through shadow for 48h before serving. Configure the separately typed repair vector to match, and enable repair serve only after producer rollout is verified. Use a fixed preview epoch in shadow, pin the first serve epoch across the whole ramp/restarts, and require lead2 approval plus P4 auto-revert at 1/10/50/100%. Retune 3600s only from the signal-gap histogram at 10%; require RECORD_GAP_FILL_PERCENT >= 10 before 100%. Mode shadow/off rolls back behavior while preserving already-acquired custody and recovery obligations. An old-image worker rollback parks separate recoveries until a current worker resumes safe promotion. Capacity disclosure: receipt cleanup before 0, after max 10000 metadata receipts per active repair run, with 128-document query pages and a 30s maintenance budget. Recovery promotion adds one bounded waiting-state query and up to 100 transactional publication/privacy checks with a CAS write to each record-pending scan, reusing the existing due-page limit, with a new 60s recheck backoff and a fresh transactional availability CAS. The active production repair CronJob invokes the same bounded promoter (one query, up to 100 checks, 30s) without enabling the idle seal worker; promotion and receipt cleanup have separate 30s phases, at most 60s total before the unchanged audio-repair budget. No raw-audio retention, audio inventory cap (8192), worker concurrency, executor size or production capacity is increased. The receipt collection-group `recorded_at` index is declared in the generated manifest; normal schema readiness gates apply before shipping. ## UI evidence UI-Evidence: none -- backend custody and validation change only ## Source growth declarations Line-Count-Exception: backend/database/firestore_index_registry.py | 2343 -> 2344 | Declare the receipt-expiry collection-group index at its schema owner. Line-Count-Exception: backend/routers/pusher.py | 2032 -> 2051 | Renew frame custody at the existing appender; retain metadata-refused batches under the audio budget without consuming storage retries. Line-Count-Exception: backend/routers/sync.py | 3830 -> 3852 | Keep the serve-cohort guard adjacent to the existing manifest heartbeat. Line-Count-Exception: backend/testing/listen_pusher_stack/run.py | 1980 -> 1988 | Bound numerical thread pools in every isolated lifecycle child and restart. ## Recovered-head qualification Registry completion is `41a173de1d79959c5b5ab26ba6e9a8c785db29fc`; the synthetic-account fixture is `70a31d885774680bf576d97712575207ae37d64a`. The earlier test-only completion is `4152755f9c4b5471e6f9841d6037c5ff5cfb8849` (+3/-2, one test file). It synchronizes the custody clock at 10000 and aligns the final expectation with the expired frame lease. No product behavior, privacy guard, query, index, lease policy or flag changed in this completion. The final assertion was corrected because the frame token's lease lapsed at the mocked clock; product behavior unchanged. The earlier runtime/custody, emulator/lifecycle, focused, query/index, PromQL/pre-deploy and typecheck results remain recorded at their actual tested commits; they are not represented as rerun on this merged candidate. On merged candidate `3fc6150cc191140c6ffa8e645bac4871b0cce2e5`, the product-file ratchet passed across 28 changed product source files; product-invariants accepted INV-DATA-1 and INV-MEM-4; expanded preflight passed all 75 checks; normal full pre-push passed, including its backend typecheck with zero errors and 28 selected backend unit files. These are local static and synthetic qualification results; CI and deployed-artifact behavior remain separate evidence. No production access, deployment or ramp. The index-count assertion was updated to match this PR's own registry change (24/26); product behavior unchanged. The ci-budget manifest now records the rationale and expected runs for the emulator-proofs trigger change already in this PR; no workflow behavior changed. ## Staging input completion Staging explicitly sets the four `RECORD_TOKEN_LEASE_*` inputs to off/0/3600/a fixed staging epoch, and `STAGING_DIFF_ALLOWLIST` now permits exactly those four names as independent staging inputs. ## Previous merged-head local qualification Earlier head: `30e3ab980a5fd9c7c509ab9410eda7943d649636`. Merged main: `85de1985f0fb4fddd05e0de4b36c1ac68108d81e`. The final allowlist-only commit adds five lines in one file, including exactly four explicit names; staging retains off/0/3600/1794268800. All gates below ran fresh on this head through `/Users/david/workspace/omi-workspace/bin/omi-heavy run --`, with inherited GCP credentials and CLOUDSDK variables stripped, private HOME/config, disabled metadata discovery, and synthetic fixtures: - Staging overlay: 21 passed, zero failures. - Seal/custody/privacy/lifecycle units: 36 files, 1,343 passed, 86 existing strict lifecycle-invariant xfails, zero skips/failures. - Real loopback emulator: custody append 30 passed; no-job seal 4 passed; lifecycle/properties 34 passed and 3 existing xfails; held custody 75 passed; recovery custody 39 passed. Emulator shut down normally. - Expanded preflight against current main: 75 checks passed, zero failures. - Normal full pre-push: passed; shared preflight 75 passed, metadata precheck 3 passed, backend typecheck zero errors; 30 selected files produced 1,962 passed, 86 existing xfails, 4 emulator skips, and 144 integration cases deselected. Skipped/deselected emulator suites passed independently above. Residual expected failures remain the existing 86 lifecycle invariants plus the 3 lifecycle simulator cases: `test_sealed_no_job_registered_recovered`, `test_upload_failed_gets_retried`, and `test_server_batch_completion_ordering[closed-before-completed]`. No xfail/skip marker was added. Local qualification does not establish remote CI or deployed behavior. Stop after push 2/2 for delta-only Luna; no deploy, ramp or production access. ## Receipt replay completion This change completes Luna finding (2): `begin()` recognizes the accepted exact-session finish receipt before adding custody, preserving idempotent finish replay without leaving a token that blocks sealing. The regression proves begin/finish/retry leaves no token, revision or metric change and no seal refusal. Earlier head: `15fc2627f3d9d923bd88c1358232c8e3521859ae` (parent `30e3ab980a5fd9c7c509ab9410eda7943d649636`). Incremental diff: 2 files, 32 additions; 4 product lines and 28 test lines. Focused custody/erasure/privacy/token-lease suites: 515 passed in 20 files. Real loopback Firestore custody-append suite: 30 passed. The new regression was first observed failing on the parent before the guard was added. Normal full pre-push passed: 75 shared checks with supplied-body metadata validation, backend typecheck with zero errors; 30 selected backend files yielded 1,963 passed, 86 existing xfails, 4 emulator skips, and 144 integration cases deselected. The actual push hook also passed with the same counts. Exactly one fast-forward push completed, from the parent above to this head. All checks ran through `omi-heavy` with inherited cloud credentials and CLOUDSDK variables unset, private HOME/config, disabled metadata discovery, and synthetic fixtures. This is local static/synthetic and loopback-emulator evidence; remote CI and deployed behavior are separate. No deploy, ramp or production access. Stop after the single push for delta-only Luna and refactor-lead custody review on this exact commit. ## L1 CI and pusher correction Candidate: `023db969b7d158ba0c518c5cb318be11b90f6aaa`, based on published `15fc2627f3d9d923bd88c1358232c8e3521859ae`. Batch scope is 120 changed non-test lines (cap 150); no workflow file changes. Finding-by-finding resolution: 1. Deploy assertions: render production separately from the pinned staging overlay, assert its actual timeout plus custody margin, and avoid repeating mode-invariant Helm work inside the CPU-timed test. 2. Pusher renewal P2: a failed metadata renewal returns a refusal. Receive windows keep their audio/WAL unacknowledged; projection batches requeue before storage. A pending refusal survives mode rollback until retry succeeds or ownership is retired. Regressions cover retention, retry, and cleanup. 3. Monitoring inventory drift: regenerate the committed inventory with only the two record-token-lease alert consumers and their count adjustment. 4. Alert serialization: restore the combined export's exact split-source bytes. Parsed alert objects, query expressions, thresholds, and notification behavior are unchanged. 5. Composite action: replace unavailable `vars` reads with four explicit action inputs. Defaults remain off/0/3600/0; the same validator writes the complete vector to GITHUB_ENV only after validation. Existing stack callers omit these inputs and therefore stay at defaults. Protected-environment variable forwarding at those callers is not added in this batch; a future rollout must explicitly supply the inputs under separate authorization. Standalone workflow bindings are unchanged. 6. Test drift: align held-state and isolated-canary inventories and remove stale real-clock allowlist entries. No new skip or xfail marker. Fresh credential-free qualification: 994 passed across 34 isolated files, including the deploy, pusher barrier, custody/token-lease and monitoring/action contracts. The initial run hit the unchanged real-clock scanner CPU guard at 1.02s/1.00s after all assertions passed; the canonical single-file rerun passed all 11 cases with unchanged limits. Pinned formatting was applied to the updated CI test. Final normal full pre-push on `023db969b7d158ba0c518c5cb318be11b90f6aaa` exited 0: 75 shared checks, supplied-body metadata validation, zero backend typecheck errors; 33 selected backend test files yielded 2,066 passed, 0 failed, 4 existing emulator skips, 86 existing lifecycle xfails and 144 integration-marker deselections. The first pre-push attempt stopped on the stale pusher growth declaration; it was corrected to 2032 → 2044 before this green rerun. No source change or check bypass was needed. All checks use `/Users/david/workspace/omi-workspace/bin/omi-heavy run --`, with inherited GCP credentials and CLOUDSDK variables unset, private HOME/config, metadata discovery disabled, and synthetic fixtures. Local static/synthetic evidence does not establish remote CI or deployed behavior. The previous shard-5 collection diagnosis remains resolved: interleaved output came from the inventory assertion, not a collection/import failure. The capture-continuity failure remained unreproduced on main and L1 and is untouched. The previously observed emulator cursor-age clock-boundary issue is also untouched; this batch does not claim a new emulator run. Exactly one normal fast-forward push completed from `15fc2627f3d9d923bd88c1358232c8e3521859ae` to `023db969b7d158ba0c518c5cb318be11b90f6aaa`. Its mandatory pre-push hook also passed: 75 shared checks, zero typecheck errors, and the same 2,066 passed / 86 xfailed / 4 skipped / 144 deselected across 33 selected files. Final batch diff: 12 files, +199/-52; 120 changed non-test lines. Stop here for independent delta and custody review on this exact head. No deploy, ramp, production data/config, credentials/IAM, or UI changes.
|
Closing as part of a stale-PR cleanup David asked for on 2026-11-26 (Shipping lead agent): it has had no activity for days. Nothing is lost: the branch stays, and anyone can reopen this PR if the work is still wanted. If it still matters, reopen it and refresh it against main. |
|
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
What changed and why
Add the approved dark backend fast/patient audio policy using the existing Firestore record and enrichment obligations. Fully sealed, fully projected batch captures can run notes before the absolute deadline; presence selects fast scheduling. With serving mode, owner admission and the seal switch on, every enrolled capture with a valid intake clock uses the complete admitted native
record_rangesend +1,680s as their durable dispatch deadline with a 120s processing reserve, retained across joins, retries and rollback. Notes persistence and episode snapshot close recheck upload/content revisions and member proofs. Raw audio is retained. New native intakes pin the admitted upload barrier; fast notes and deadline compose require the existing all-sibling content-ledger completion. Older untagged intakes retain legacy timing. Deadline settlement refuses pending F-join boundaries at planning, service reread and transaction commit.Record scheduling adds bounded fresh/watched hints, seal wakes, original enqueue age, reserved oldest service and an owner cap. Redis remains scheduling only; existing Firestore claims, retained-tail validation, privacy, producer grace and polling remain authoritative. Batch-covered server-batch captures hand off before preview-derived notes only with the seal switch on, after committing a durable ordinary notes fallback.
Adds stage/capture/close clocks, durable automatic note-version receipts, an open-readiness observation hook, configured-silence/gap instrumentation, and an offline source-frame union adapter for captured hours. Cost is published only with a fresh inventory coverage receipt bound to the exact consumed export, physical population and captured-day hours, plus reconciled cloud/vendor/notes/composer receipts. No savings forecast or production scan is claimed. Existing transcription-based finops allocations remain separate.
The watched target clock starts at seal/close; the full capture-end clock remains visible. Open readiness means existing text with truthful pending notes/episode, per David's ruling A. Generated notes do not become complete within 10 seconds by definition.
Contract and carried risk register:
backend/docs/listen_pusher_pipeline/changes/2026-11-07-pipeline-attention.mdandbackend/docs/listen_pusher_pipeline.mdx#pipeline-attention.Coordination and remaining owner hooks
d5fafb; Shard projection drains by owner, push wakes, fresh first, head deadline #24731's owner rebases later. Mirror the retained non-coalescing callback under its existing AST parity contract; no duplicate projection priority implementation, no owner-branch commits, no pg-short dependency.home_visible=falseat/v1/users/client-state; foreground Home/live renews the lease, generic app open promotes once. Its owner retains foreground preview, English notices/exceptions, Wi-Fi behavior and batch text backfill.demand_processing.promote_owner(uid, trigger='api_read'|'mcp_read')once at authenticated private-data reads, off the event loop. Bounded promotion wakes sealed enrichment and indexed record work without waiting for an LLM. Callpipeline_metrics.open_readyonly after the honest bounded snapshot is visible. This PR supplies hooks; it does not claim client-visible latency samples before that wiring exists.member_notes.before_notesgate covers the enrichment callback (busf19b93); this PR does not override it.Flags, ramp and rollback
All new online behavior requires the remote server-only
pipeline_attentionowner grant (absent/unreadable = off) andPIPELINE_ATTENTION_MODE=serve(defaultoff, invalid = off).shadowmakes decisions only. Reused demand/surface gates must also admit the owner.Default
false:PIPELINE_SEAL_FAST_ENABLED,PIPELINE_RECORD_FAST_ENABLED,PIPELINE_CLOSE_ON_SEAL_ENABLED,PIPELINE_SKIP_SILENCE_ON_SEAL_ENABLED,PIPELINE_CAPTURE_COST_ENABLED. No flag or runtime deployment value is enabled here. Capture-cost is an offline operator switch, not a user cohort ramp. Skip-silence is explicitly UNWIRED/OFF with no cohort ramp until owner implementation and separate review.Project coordinator owns expansion and names backend/mobile operators before activation. Shadow for 24h; dogfood on a named internal allowlist for at least 24h/100 eligible closed captures; then 1%, 5%, 25%, 50%, 100%, each at least 24h/1,000 eligible captures. Coordinator reviews eligible receipts within 48h, completing or recording a hold by 2026-11-21. Do not leave shadow until owner wiring and staging/device acceptance exist; close-on-seal additionally requires the F-join full-ramp receipt.
At every step: zero custody/privacy/stale-seal violations and unchanged-evidence automatic rewrites, oldest debt no worse than control, complete metric series. Watched close-to-notes 120s p50/300s p90; unwatched first notes within 1,800s; open readiness follows ruling A, with cold/warm/pending series separate. Pause for rewrite share +1 percentage point or reconciled cost/hour +5% versus concurrent control. Broad rollout also requires measured pendant life >=24h and acceptable phone drain on Wi-Fi/cellular. The 30min target and 2h alarm are unchanged. The 120s processing reserve still needs staging proof.
Rollback: set attention mode
offand the affected seal/record/close switchfalse; existing obligations drain using exact legacy timing, with accepted deadline metadata retained but inactive while killed. Kill capture reporting and mark prior output stale. No job cancellation, user-data rollback, raw-audio deletion or revert of another owner's PR. Code revert, if needed, is a reviewed PR after flag kill.P1 absolute dispatch deadline (David, 2026-11-08 09:34Z)
Verified both reported sites at
e0cb6051beff4975bdb3f26c5cfe48f71865f462: presence becomes unknown after two 90s leases and the outbox previously required known presence or promotion to accept a deadline. Deadline assignment depends on serving mode, the owner grant, the seal switch, durable intake admission and its valid capture-end clock; presence is not an admission condition. Every such capture gets capture end +1,680s regardless of presence; presence only selects fast scheduling. The 120s processing reserve, all default-off flags, kill switches, seal/projection/privacy fences and legacy rollback timing remain intact.Regression tests in existing suites:
test_unknown_presence_after_double_lease_expiry_still_gets_absolute_deadline: real watched/unwatched/unknown lease transitions still yield capture end +1,680s.test_flag_on_close_on_seal_closes_fully_projected_capture_early: watched, fully sealed/projected row closes before deadline through the real service and strict Firestore transaction with the flag on.test_durable_record_registration_and_intake_precede_deadline_creation: real record registration commits a pending obligation, real retained-audio admission commits the pinned intake, and only then the real receipt/outbox path creates the deadline. No deadline exists before either durable admission step. Storage/cloud boundaries use synthetic fixtures.Skip-silence remains declaration-only and unwired by design. P2 wiring and its path test belong in follow-up #24913 (owner @Git-on-my-level), not this P1.
Merge blockers corrected
PIPELINE_SEAL_FAST_ENABLED=true. New obligations with seal off, mode off or shadow write no deadline and keep legacy hold/notes timing. Saved deadlines become inactive under kill. Tests:test_new_obligation_flags_off_preserve_legacy_hold_and_notes_timing,test_pipeline_kill_resumes_existing_projection_wait_on_legacy_timing, and episode kill regressions.test_pipeline_wait_reaches_normal_notes_and_terminal_state_after_one_hour,test_pipeline_pending_reasons_use_existing_slow_retry_classification,test_ready_notes_run_before_dispatch_ceiling_without_presence, and bounded policy/episode regressions.test_batch_failure_keeps_durable_preview_notes_fallback(provider failure and aged barrier),test_seal_flag_or_mode_off_keeps_legacy_preview_notes_path.test_pipeline_empty_after_seal_and_recovery_exhausts_three_attempts,test_pipeline_empty_output_budget_is_durable_with_first_summary_flag_off.now + delay. Test:test_deferred_record_clock_is_legacy_unless_record_flag_and_cohort_serve.Skip-silence remains declaration-only, unwired by design, default off. Follow-up #24913, assigned to @Git-on-my-level, owns wiring and its producer-path test. No flag default, 120s reserve, +1,680s dispatch point, producer grace or privacy/custody fence changed.
Contract update:
backend/docs/listen_pusher_pipeline/changes/2026-11-08-pipeline-review-bounds.md.Durable episode wake and saved-deadline fixes — publication blocked
Unpublished local candidate: bd951a849be9141a46628c5ee66134e418933e4e.
The HIGH/MEDIUM changes below are implemented and tested locally but are not yet on this PR's published head (
ff7e36a2a16880b12854ae1969131e5211a2f2f1). Publication is blocked by the unchanged normal Firestore guard wall limit under shared-host load. No bypass or budget increase is authorized or used.pipeline_wake_aton the episode before their callback can complete when membership exists. The finalization hook also arms newly created membership. The existing composer drain scans bounded, indexed due pages every 30s, so restarts and a crash between close commit and compose scheduling retain the wake. A metadata-only CAS leaves membership/activity untouched. At the wake, fresh native intake/projection receipts, full seals, unchanged membership/activity and the canonical close transaction are required; pending F boundaries remain blocked. A validated wake skips the additional composer quiet window, including when recovered overdue.pipeline_dispatch_atcap remains unchanged. Older late evidence cannot slide it. Missing proof retries within the existing one-hour capture recovery bound, then falls back honestly to legacy recovery. Mode/seal/cohort/composer kills leave wakes inert.run.finishand Firestoreack.finishresolve mode, seal and owner cohort outside their metadata transaction before clamping savedpipeline_dispatch_at. The shared concurrent-append admission uses the same complete gate, so it cannot pre-clamp a killed deadline before finish. Any kill retains the legacydue_atandtask_due_at; the regression uses real enqueue during the active lease. Three existing synthetic-admission fixtures now explicitly enable the pipeline gate; the required early-notes test itself is unchanged.Named required regressions:
test_early_notes_then_durable_deadline_wake_composes_unwatched_episodetest_deadline_wake_with_newer_member_moves_to_new_capture_without_closingtest_durable_deadline_wake_is_inert_when_mode_seal_or_cohort_off(all three kills)test_finish_saved_deadline_respects_mode_seal_and_cohort(legacy and Firestore paths; three kills plus enabled controls)Additional coverage checks newer activity in the same capture, the hard cap, concurrent activity at close commit, bounded unproven activity, restart after close commit, existing-drain startup recovery, and immediate composition after the original capture budget expires.
test_ready_notes_run_before_dispatch_ceiling_without_presenceis unchanged and passes in the 90-test sync-hold suite.Validation on this change, each test file run as its own
omi-heavy run -- .venv/bin/python -m pytest -q tests/unit/<file>.pycommand frombackend:test_episodes_service.pytest_episode_composer.pytest_outbox_firestore.pytest_sync_processing_hold.pytest_firestore_field_indexes.pytest_enrichment_callback_parity.pytest_firestore_query_shapes.pytest_firestore_outside_query_contract.pyThe due query's collection-group field index is declared in the registry and the manifest regenerated; no index deployment or cloud action was performed. Contract:
backend/docs/listen_pusher_pipeline/changes/2026-11-08-pipeline-durable-episode-wake.md.LOW follow-up placeholder — owner @Git-on-my-level (coordinator); David will open the issue. Intentionally unchanged here:
pipeline_recordretained on kill, preview notes before batch projection, and the renamed log line. No LOW fix is bundled into these HIGH/MEDIUM changes.Skip-silence remains declaration-only, unwired by design, default off; #24913 (@Git-on-my-level) owns wiring and its producer-path test. All flag defaults, kill switches, +1,680s dispatch point and 120s reserve are unchanged.
Implementation commits
42d5a26a4da2andd14873c98fc6are included. Fetched main2958b7c1b3695a25c24510824c8e271459bb5484was merged without rebase or conflicts, retaining main's catalog and the seven branch flags exactly once; the generated registry was regenerated and checked. Final metadata-only preflight passed all 5 checks onbd951a849be9(24.44s); normal-hook publication is blocked. Four normal push attempts failed without publishing. The latest Firestore guard took 447.80s and reportedtest_firestore_query_shapes.py exceeded 300s (TERM, then KILL) and was terminated(status 124). That attempt began at load1 39.33; sampled mean was 59.72, max 75.90. No further push is running; the coordinator quiet-window request is https://anx.scalingforever.com/o/david-zhang/w/omi/r/event:ev_41b852440270e733a83c8f5c3d22d3ee. Resume with a fresh lane fetch and fast-forward check at the coordinator's load gate; documented serial scheduling may be used, but every check and the 300s file budget stay unchanged.The required runtime comparison used identical canonical guard commands on pinned main
5d6e9f963996and candidate3ba4ab9c974b. Synchronized starts were 0.0011s apart at load1 43.38; sampled mean load1 was identical (41.30). Main took 303.54s and branch 303.49s; both reached the unchanged 300s query-shapes limit (status 124). No slower branch guard was measured, but these censored observations are not successful guard results or proof against a small regression. The standalone query suite passed 559 cases. No budget override, force, skip, hook bypass, PR merge, deployment or cloud access. GCP tier: none. GitHub CI remains separate from local validation.Earlier verification on the preceding head
P1 commit
957cec515c9e22f2fc29b6a986c0e067e349ef9ewas published via integration headbcb47380187b0def7521a2392985ba2f4e6e6e07. The integration merged fetched main9dc8553cfc95ae44feb17332f3a18550fd09a5c7without rebase, kept main's catalog entries, added seven branch flags once, regenerated main's registry copy, and passed the registry checker and all five metadata checks.Previous review-fixes head: ff7e36a.
Seven changed suites ran individually from
backendwith/Users/dazheng/workspace/omi/bin/omi-heavy run -- .venv/bin/python -m pytest -q tests/unit/<file>.py:test_pipeline_attention.pytest_sync_processing_hold.pytest_record_finalizer_photo_registration.pytest_episode_composer.pytest_episodes_service.pytest_batch_pipeline_live.pytest_summary_empty_recovery.pySupplemental callback parity: 3 passed; callback fence: 4 passed. 521 targeted passes overall. P1's three requested regressions remain in these suites: unknown presence after double lease expiry, flag-on early close-on-seal, and real durable registration/intake before deadline creation. These are hermetic persistence/scheduling tests; provider/device/battery/production latency acceptance is not claimed.
Firestore runtime comparison used the same pre-push timed guard runner on pinned main and branch. Synchronized runs started 0.18s apart at load1 39.88: main 308.44s, branch 311.93s, sampled mean loads 42.10 and 42.07. Both hit the unchanged 300s query-shapes timeout. Repeated discovery CPU means were 7.934s main / 8.028s branch, 623 discovered functions each. No material branch-caused slowdown identified; no budget increased or check weakened. The first normal push then started at load1 39.06 and passed the complete hook, including Firestore guard 275.15s, backend typecheck/unit tests, OpenAPI and formatters. No budget override, skip, force or bypass; cloud credential variables removed.
Review-fixes commit
ff5608708c29ee1674455adf06aefb606c4d4341is included in this head. Main advanced during validation; mergedd5f49690d7a1ac75d272be0a9644076f217cd3af, retaining all its catalog entries and adding the seven branch flags once, then regenerated the registry. Registry validation: PASS. Review-fixes metadata-only preflight: all 5 checks passed (28.46s). Second normal push attempt 1 was rejected:test_firestore_query_shapes.py exceeded 300s (TERM, then KILL) and was terminated, status 124; total Firestore guard 534.85s. It started at load1 37.30 but sampled mean rose to 59.28 (max 75.27). Normal retry started at load1 39.65 after a fresh fetch and fast-forward check; sampled mean load1 37.74. The complete hook PASSED: all 49 shared preflight checks (704.29s), Firestore guard 292.12s with the default 300s per-file limit, backend typecheck and selected unit suites, OpenAPI/client compatibility, and pinned formatters. The remote PR head was verified asff7e36a2a16880b12854ae1969131e5211a2f2f1. No budget override, force, skip or bypass; cloud credential variables removed. Merge-desk retains merge authority. No PR merge or deployment performed. GCP tier: none; no cloud access used. GitHub CI is tracked separately from the successful normal local hook; no terminal CI claim is made here.Product invariants affected
none
UI evidence
UI-Evidence: none -- default-off backend policy and additive generated request DTOs; no UI behavior changes
Failure class (fixes)
Failure-Class: none
Line-count exceptions
Line-Count-Exception: backend/database/firestore_index_registry.py | 2330 -> 2331 | Declare the required due-wake field index at its canonical registry; scheduling and storage remain in extracted modules.
Line-Count-Exception: backend/routers/users.py | 2759 -> 2760 | Add one optional transport field at its existing owner; all scheduling lives in extracted pipeline modules.
Line-Count-Exception: backend/utils/episodes/service.py | 2217 -> 2266 | Keep canonical close and boundary hooks at their transaction owner; policy and accounting extracted to pipeline modules.
Line-Count-Exception: backend/utils/sync/pipeline.py | 4096 -> 4159 | Mirror the retained callback under its existing AST parity contract; keep the dark guard and custody logic identical until the owning removal.
🤖 Generated with Claude Code
Existing web test timeout
This branch retains the #24903 test-only timeout fix (
configure({ asyncUtilTimeout: 5000 })inweb/app/vitest.setup.ts, prior commite0cb6051bef, identical to9689ef7496on #24903). The P1 change adds no web behavior.