Repository navigation
fix(batch): add proof-gated exits for aged record-pending jobs - #24703
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
6 issues found across 14 files
Confidence score: 3/5
record_partial.pycan reopen a retired coordinator while its job is stillrecord_pending, without an upload-revision change. Includepartial_run.retired_atin the gate.record_seal_cluster_repair.pycan enqueue a canonical-ID job whose content metadata does not match. Require the canonical content hash before enqueueing.record_pending_repair.pycan crash on a pending job withoutprivacy_generation, leaving it pending and the repair report inerror. Validate the field and returnstate_changedbefore indexing it.record_pending_repair.pycan reportstate_changedafter an ambiguous commit even though cancellation succeeded, leaving the shadow mirror stale. Record when the write committed and refresh the mirror on retry.
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/deploy/record-seal-repair/README.md">
<violation number="1" location="backend/deploy/record-seal-repair/README.md:143">
P2: This section scans `{ns}_jobs` rows and filters on `record_pending` and `enqueued_at`, which contradicts the Discovery section's claim that discovery reads only finish/closed metadata. Narrow that earlier invariant to the completed-row leg, or state the jobs-leg read scope explicitly here.</violation>
<violation number="2" location="backend/deploy/record-seal-repair/README.md:150">
P2: This adds a new maintenance cursor document, but the authorizing rulings cited above cover only `record_seal_repair_cursor_v1`. Cite the approval that covers `record_seal_repair_jobs_cursor_v1`, or note that it is pending, so the write authority is traceable.</violation>
</file>
<file name="backend/database/record_pending_repair.py">
<violation number="1" location="backend/database/record_pending_repair.py:29">
P3: A retry after an ambiguous commit re-reads `state == 'cancelled'` and returns 'state_changed', so the cancellation is reported as a no-op and the shadow mirror is not refreshed. Record that the write committed inside the callable, for example with a closure flag or the `outcome` dict, and return the committed result on retry.</violation>
<violation number="2" location="backend/database/record_pending_repair.py:44">
P2: `cancel_missing` crashes on a pending job without `privacy_generation`, so repair reports `error` and leaves it pending. Validate the generation field and return `state_changed` before indexing it.</violation>
</file>
<file name="backend/database/record_partial.py">
<violation number="1" location="backend/database/record_partial.py:86">
P2: This gate can reopen a retired coordinator when its job still says `record_pending`, because it ignores `partial_run.retired_at`; the later block then removes retirement without an upload-revision change. Also require that `partial_run` is not retired (or explicitly require a changed barrier) before allowing the aged retry.</violation>
</file>
<file name="backend/utils/batch_pipeline/record_seal_cluster_repair.py">
<violation number="1" location="backend/utils/batch_pipeline/record_seal_cluster_repair.py:340">
P2: `discover_jobs` accepts any truthy `record_content_id`, so a canonical-ID job with mismatched content metadata can enter sealing. Require the canonical content hash before enqueueing the job.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| ordinary uploads their existing proof wait without assigning any expiry to a | ||
| producer token. Numeric `enqueued_at` is filtered locally so no new composite | ||
| index is required. Resolution happens inside the existing disposable row budget. | ||
| The jobs leg has its own encrypted maintenance cursor at |
There was a problem hiding this comment.
P2: This adds a new maintenance cursor document, but the authorizing rulings cited above cover only record_seal_repair_cursor_v1. Cite the approval that covers record_seal_repair_jobs_cursor_v1, or note that it is pending, so the write authority is traceable.
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/deploy/record-seal-repair/README.md, line 150:
<comment>This adds a new maintenance cursor document, but the authorizing rulings cited above cover only `record_seal_repair_cursor_v1`. Cite the approval that covers `record_seal_repair_jobs_cursor_v1`, or note that it is pending, so the write authority is traceable.</comment>
<file context>
@@ -137,3 +137,44 @@ switch `RECORD_SEAL_REPAIR_ENABLED=false`), or remove only this job with
+ordinary uploads their existing proof wait without assigning any expiry to a
+producer token. Numeric `enqueued_at` is filtered locally so no new composite
+index is required. Resolution happens inside the existing disposable row budget.
+The jobs leg has its own encrypted maintenance cursor at
+`batch_pipeline_prod_maintenance/record_seal_repair_jobs_cursor_v1`; its candidates
+occupy at most half the first worker group (one for a single-worker run). Both
</file context>
|
|
||
| ## Aged pending discovery and proof-gated exits | ||
|
|
||
| `RECORD_SEAL_REPAIR_JOBS` defaults on; only `off` disables the added discovery |
There was a problem hiding this comment.
P2: This section scans {ns}_jobs rows and filters on record_pending and enqueued_at, which contradicts the Discovery section's claim that discovery reads only finish/closed metadata. Narrow that earlier invariant to the completed-row leg, or state the jobs-leg read scope explicitly here.
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/deploy/record-seal-repair/README.md, line 143:
<comment>This section scans `{ns}_jobs` rows and filters on `record_pending` and `enqueued_at`, which contradicts the Discovery section's claim that discovery reads only finish/closed metadata. Narrow that earlier invariant to the completed-row leg, or state the jobs-leg read scope explicitly here.</comment>
<file context>
@@ -137,3 +137,44 @@ switch `RECORD_SEAL_REPAIR_ENABLED=false`), or remove only this job with
+
+## Aged pending discovery and proof-gated exits
+
+`RECORD_SEAL_REPAIR_JOBS` defaults on; only `off` disables the added discovery
+leg. It scans at most 128 `{ns}_jobs` metadata rows in document order, selecting
+`record_pending` jobs aged at least the existing 30-minute partial wait. Upload
</file context>
| mark = row.get('record_audio_partial') or {} | ||
| if config.partial_barrier(row) and job.get('partial_coordinator'): | ||
| return 'already_partial' | ||
| if not (retry_aged and job.get('state') == 'record_pending' and config.repair_due(row, now)): |
There was a problem hiding this comment.
P2: This gate can reopen a retired coordinator when its job still says record_pending, because it ignores partial_run.retired_at; the later block then removes retirement without an upload-revision change. Also require that partial_run is not retired (or explicitly require a changed barrier) before allowing the aged retry.
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/database/record_partial.py, line 86:
<comment>This gate can reopen a retired coordinator when its job still says `record_pending`, because it ignores `partial_run.retired_at`; the later block then removes retirement without an upload-revision change. Also require that `partial_run` is not retired (or explicitly require a changed barrier) before allowing the aged retry.</comment>
<file context>
@@ -83,7 +83,8 @@ def commit(raw):
mark = row.get('record_audio_partial') or {}
if config.partial_barrier(row) and job.get('partial_coordinator'):
- return 'already_partial'
+ if not (retry_aged and job.get('state') == 'record_pending' and config.repair_due(row, now)):
+ return 'already_partial'
if preview:
</file context>
| if not (retry_aged and job.get('state') == 'record_pending' and config.repair_due(row, now)): | |
| if not ( | |
| retry_aged | |
| and job.get('state') == 'record_pending' | |
| and not (job.get('partial_run') or {}).get('retired_at') | |
| and config.repair_due(row, now) | |
| ): |
| uid, cid, enqueued = job.get('owner_id'), job.get('conversation_id'), job.get('enqueued_at') | ||
| if not isinstance(uid, str) or not uid or '/' in uid or not isinstance(cid, str) or not cid or '/' in cid: | ||
| continue | ||
| if doc.id != record_identity(uid, cid)[1] or not job.get('record_content_id'): |
There was a problem hiding this comment.
P2: discover_jobs accepts any truthy record_content_id, so a canonical-ID job with mismatched content metadata can enter sealing. Require the canonical content hash before enqueueing the job.
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_seal_cluster_repair.py, line 340:
<comment>`discover_jobs` accepts any truthy `record_content_id`, so a canonical-ID job with mismatched content metadata can enter sealing. Require the canonical content hash before enqueueing the job.</comment>
<file context>
@@ -253,6 +278,82 @@ def discover(
+ uid, cid, enqueued = job.get('owner_id'), job.get('conversation_id'), job.get('enqueued_at')
+ if not isinstance(uid, str) or not uid or '/' in uid or not isinstance(cid, str) or not cid or '/' in cid:
+ continue
+ if doc.id != record_identity(uid, cid)[1] or not job.get('record_content_id'):
+ continue
+ if not isinstance(enqueued, (int, float)) or isinstance(enqueued, bool) or not math.isfinite(enqueued):
</file context>
| if doc.id != record_identity(uid, cid)[1] or not job.get('record_content_id'): | |
| if job.get('record_content_id') != record_identity(uid, cid)[0] or doc.id != record_identity(uid, cid)[1]: |
| store.client, transaction, uid, conversation_ids=(cid,), expected_generation=job['privacy_generation'] | ||
| ) | ||
| except BatchPrivacyBlocked: | ||
| fenced = True |
There was a problem hiding this comment.
P2: cancel_missing crashes on a pending job without privacy_generation, so repair reports error and leaves it pending. Validate the generation field and return state_changed before indexing it.
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/database/record_pending_repair.py, line 44:
<comment>`cancel_missing` crashes on a pending job without `privacy_generation`, so repair reports `error` and leaves it pending. Validate the generation field and return `state_changed` before indexing it.</comment>
<file context>
@@ -0,0 +1,60 @@
+ fenced = False
+ try:
+ assert_batch_write_allowed(
+ store.client, transaction, uid, conversation_ids=(cid,), expected_generation=job['privacy_generation']
+ )
+ except BatchPrivacyBlocked:
</file context>
| store.client, transaction, uid, conversation_ids=(cid,), expected_generation=job['privacy_generation'] | |
| ) | |
| except BatchPrivacyBlocked: | |
| fenced = True | |
| generation = job.get('privacy_generation') | |
| if type(generation) is not int or generation < 0: | |
| return 'state_changed' | |
| try: | |
| assert_batch_write_allowed( | |
| store.client, transaction, uid, conversation_ids=(cid,), expected_generation=generation | |
| ) |
| row = row_ref.get(transaction=transaction) | ||
| if not config.jobs_enabled(): | ||
| return 'disabled' | ||
| if row.exists or job.get('state') != 'record_pending': |
There was a problem hiding this comment.
P3: A retry after an ambiguous commit re-reads state == 'cancelled' and returns 'state_changed', so the cancellation is reported as a no-op and the shadow mirror is not refreshed. Record that the write committed inside the callable, for example with a closure flag or the outcome dict, and return the committed result on retry.
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/database/record_pending_repair.py, line 29:
<comment>A retry after an ambiguous commit re-reads `state == 'cancelled'` and returns 'state_changed', so the cancellation is reported as a no-op and the shadow mirror is not refreshed. Record that the write committed inside the callable, for example with a closure flag or the `outcome` dict, and return the committed result on retry.</comment>
<file context>
@@ -0,0 +1,60 @@
+ row = row_ref.get(transaction=transaction)
+ if not config.jobs_enabled():
+ return 'disabled'
+ if row.exists or job.get('state') != 'record_pending':
+ return 'state_changed'
+ if job.get('owner_id') != uid or job.get('conversation_id') != cid or job.get('record_content_id') != content:
</file context>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 441c0da646
ℹ️ 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".
| return ( | ||
| bool(data.get('record_audio_partial')) | ||
| and partial_config.partial_barrier(data) | ||
| and not partial_config.repair_due(data, time.time()) |
There was a problem hiding this comment.
Keep unchanged retired partials out of discovery
When a partial coordinator reaches partial_retired, its valid barrier eventually becomes permanently eligible under this predicate because its timestamps are no longer refreshed. Conversation discovery consequently launches a disposable worker for it on every pass, although repair_one immediately returns already_partial for any valid barrier whose job is not record_pending. This reintroduces the refused-prefix overhead that settled was designed to eliminate, consuming the bounded candidate and worker budgets ahead of actionable captures. Preserve discovery suppression for unchanged retired coordinators while allowing aged pending coordinators to retry.
Useful? React with 👍 / 👎.
| if reason_out is not None: | ||
| reason_out['blocker'] = blocker | ||
| if job and not row and config.jobs_enabled(): | ||
| from database.record_pending_repair import cancel_missing |
There was a problem hiding this comment.
Move the newly added imports to module scope
The new cancellation branch adds a function-local import, contrary to the explicit backend rule, “All imports at module top level — never inside functions.” Move this import and the other newly introduced function-local imports in record_pending_repair.py and config/record_partial.py to their respective module import blocks. Existing local imports elsewhere do not exempt new code from the documented convention.
AGENTS.md reference: backend/AGENTS.md:L168-L168
Useful? React with 👍 / 👎.
| return 'missing_cancel_eligible' | ||
| # No receipt, projection, TTL or content write: cancellation is not a | ||
| # claim of no speech and must never race erasure by recreating the row. | ||
| transaction.update(ref, {'state': 'cancelled', 'merge_pending': False}) |
There was a problem hiding this comment.
Add the required pipeline lifecycle change note
This introduces a terminal cancellation transition for retained recording jobs, alongside new partial-retry and closed-record repair behavior, but the commit adds no pipeline change note. backend/AGENTS.md requires audio and conversation-lifecycle changes to add a note under backend/docs/listen_pusher_pipeline/changes/ in the same PR. Checking the changed-file list and searching the pipeline notes found no coverage of this change; the deployment README does not replace that required note. Add a note describing the proof gates, new flag, cancellation behavior, and verification evidence.
AGENTS.md reference: backend/AGENTS.md:L164-L164
Useful? React with 👍 / 👎.
## Problem Seal repair is the `record_pending` bottleneck: ~5.4k rows and growing ~1,156/h (lead2 ruling 072b5e). Pass 29898470 selected 1,024 rows but attempted only ~157 before the 1,500 s run deadline. The other 867 count as `deferred`, which means not attempted, not refused (`coordinate()` in `record_seal_cluster_repair.py`). That is 16 workers x 1,500 s at ~150 s per row. The pod is not CPU- or memory-bound (in-cluster Prometheus, 10 min): CPU ~0.7 of the 4-CPU limit, CFS throttling 0, working set ~1.1 GB of 8 Gi. Rows wait on I/O, so throughput scales with workers. Both `config/record_seal_repair.py` and the chart template capped workers at 16, and prod already ran 16. More rows per pass or a shorter interval would not help: the pass is time-bound, and Forbid plus a 1,500 s run already runs back to back. ## Fix - Cap workers at `MAX_WORKERS = 64` (was 16), in code and in the chart guard. - Prod `recordSealRepair.workers`: 16 -> 48. - Repair pod requests 1 CPU / 2 Gi -> 2 CPU / 4 Gi; limits unchanged (4 CPU / 8 Gi). At ~70 MB per worker, 48 workers is ~3.3 GB. Expected: ~3x attempted rows per pass (~470), ~900-1,000 sealed/h against ~1,156/h new. It ships on the next batch-pipeline-worker image/chart roll, which also activates #24703's jobs leg (not live today: CronJob image `ced945db` predates it). ## Tests `BACKEND_UNIT_TEST_FILE_LIST=... bash test.sh` over `test_record_seal_cluster_repair.py` (+7 new cases: 1/16/48/64 accepted; 0/65/128 refused), `test_record_seal_cluster_repair_deploy.py` (prod renders 48; 65 refused), `test_record_seal_sweeper.py` and `test_record_seal_worker_guards.py`: 77 + 28 + 13 + 8 passed. Failure-Class: none (Capacity tuning: a worker cap sized before the record_pending surge; not a recurrence of a defect class.) ## Risk / rollback Firestore/GCS read concurrency from repair rises ~3x (each row does the same proof reads as today). Watch the seal-repair summary (`sealed`, `deferred`, `budget_exhausted`), pod memory, and Firestore contention. Rollback: prod `recordSealRepair.workers` back to 16 (values only). Evidence: omi-workspace `data/run-2026-11-05-omi-pipeline/seal-repair-throughput-2030Z.md`. 🤖 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/24729?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/24729?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24729&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. -->
…4943) <!-- claude-projects-attribution: {"github_login":"Git-on-my-level"} --> _Requested by **David**_ ## What changes Retro P6 adds `batch-pipeline-tuning-disclosure` to the shared manifest in both local and CI lanes. Numeric capacity assignments and concurrency environment defaults in the batch config, pipeline source, worker/pusher charts, and `backend/utils/pusher_*.py` require numeric disclosures in one PR-body section naming a matched knob: before/after, from/to, or a nearby numeric arrow (`6 -> 4` or `6 → 4`). A knob with no removed numeric assignment may instead use `new: <num>` or `initial <num>`. Newly added literals directly assigned or compared to state-like names, or passed as state/status/phase/disposition/outcome/reason kwargs, must name an exit, terminal, dead-letter, re-entry, clear, or recovery path; literals already anywhere in the merge-base tree are exempt. `Numbers-waived: <reason>` and `State-exit-waived: <reason>` waive their respective requirement and echo the reason. HTML comments, fenced code blocks and inline code are stripped before validating disclosures, state exits or waivers. Logging arguments and literals merely near state-related words do not count as new states. The same single manifest entry runs hermetic regression tests before checking the body. Only changed lines trigger detection; flags, comment-only lines, and unchanged context do not count. The detector deliberately misses indirect/formula tuning: this is a disclosure ratchet. David approved this exact manifest and script/test change on **2026-11-08 at 16:13Z**. No workflow file changed. The change is limited to `.github/checks-manifest.yaml` and the two P6 files under `.github/scripts/`. ## Why this check The retro's #24481 HPA retune is the design precedent; the sweep below exercises HPA bounds changes such as #24742. Its from/to wording is supported, but its knob names are only in inline code, which the requested prose-only rule excludes. Existing product-invariant and failure-class checks validate different author declarations; neither detects capacity knobs or new lifecycle literals. This check reuses the manifest's existing diff/metadata plumbing without changing workflow wiring or inventing another PR orchestration layer. ## Product invariants affected none Failure-Class: none ## Merged-PR false-positive sweep (2026-11-08T20:01:42.025036+00:00) **200 merged PRs screened; 69 trigger-touching diffs checked; 16 would fail and 53 would pass.** 14 failing PRs require numeric disclosures; 2 require state declarations (3 state literals total). The prior sweep reported 18 failures; the refreshed capped corpus also advances its merge cutoff. Method: `gh pr list --repo BasedHardware/omi --state merged --search 'merged:>=2026-10-09' --limit 200 --json number,title,body,mergeCommit,mergedAt,files`, followed by `gh pr diff <number> --repo BasedHardware/omi` for matching paths. Full paginated file lists were checked whenever the initial listing reached 100 files. Each diff was checked against its PR body and reconstructed PR merge-base: merge-parent merge-base for normal merges; PR-head/merge-parent merge-base cross-checked with the recorded PR base for one-parent merges. State candidates use a whole-tree lookup at that merge-base. The capped corpus spans **2026-11-04T12:58:21Z through 2026-11-08T19:20:24Z**: a sample within the requested 30-day window, not full-month coverage. No production reads or GCP tier were used. The stricter state association passes #24743 (the prior proximity-only candidate). #24733 and #24729 now pass the expanded numeric wording. The required inline-code stripping means #24742 still fails: its from/to numbers are supported, but its matched knob names appear only in inline code. #24884 and #24725 also fail when their state names are excluded as inline code. These are explicit effects of the requested prose-only policy, not claims that those historical PRs omitted all semantic explanation. Sample of would-fail PRs: | PR | Detected change | Missing disclosure | | --- | --- | --- | | [#24889](#24889) | Tuning: `max_count` | Initial/new numeric value naming a matched knob in prose, before/after disclosure, or Numbers-waived | | [#24884](#24884) | New state: `record_barrier_aged` | State literal and exit declaration in prose, or State-exit-waived (inline code is excluded) | | [#24799](#24799) | Tuning: `MIN_STORAGE_PCM_BUDGET_MB` | Initial/new numeric value naming a matched knob in prose, before/after disclosure, or Numbers-waived | | [#24742](#24742) | Tuning: `maxReplicas`, `minReplicas` | Matched knob name in prose alongside the existing from/to numbers | | [#24736](#24736) | Tuning: `PAGE_SIZE` | Initial/new numeric value naming a matched knob in prose, before/after disclosure, or Numbers-waived | | [#24725](#24725) | New state: `marker_retry_overflow`, `marker_write_failed` | State literal and exit declaration in prose, or State-exit-waived (inline code is excluded) | | [#24716](#24716) | Tuning: `limit` | Initial/new numeric value naming a matched knob in prose, before/after disclosure, or Numbers-waived | | [#24712](#24712) | Tuning: `MAX_OWNER_DRAINS` | Numeric before/after, from/to or arrow disclosure naming a matched knob in prose, or Numbers-waived | | [#24710](#24710) | Tuning: `MAX_DELAYED_OWNERS` | Initial/new numeric value naming a matched knob in prose, before/after disclosure, or Numbers-waived | | [#24707](#24707) | Tuning: `MAX_HEAD_REQUEUES` | Numeric before/after, from/to or arrow disclosure naming a matched knob in prose, or Numbers-waived | All would-fail PRs: #24889, #24884, #24799, #24742, #24736, #24725, #24716, #24712, #24710, #24707, #24703, #24697, #24689, #24680, #24643, #24601. ## Validation - **26 focused regression tests passed** on head `1788dd10315e7a709dcaf6150838907638386ad0`, covering fenced/inline examples, direct state association (including the logging regression), from/to and arrows, and first-time versus changed numeric values. - **`make preflight` passed all 14 selected local checks**, including 26 P6 tests and 78 manifest-contract tests, with `OMI_PR_BODY_FILE` and `BACKEND_UNIT_FILE_BUDGET_SECONDS=900`. The normal bounded pre-push gate also passed all 14 checks using the final body and the same budget, with `GOOGLE_APPLICATION_CREDENTIALS` and every `CLOUDSDK_*` variable removed. - `scripts/pr-preflight --suggest` required no invariant citations; `Failure-Class: none` is declared above. - No workflow file changed; only the manifest and two P6 scripts differ from the merge base. - No production reads or GCP tier used. Full-month coverage beyond the 200-PR cap, indirect/formula tuning and product/runtime behavior are not established by this check. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Problem
Seal repair discovers completed conversations, so aged
record_pendingjobs with stuck producers, failed uploads, closed records, partial barriers or missing conversations can remain invisible or refused forever.Fix
Add a default-on jobs discovery leg (
RECORD_SEAL_REPAIR_JOBS=offdisables it) with an independent encrypted cursor. Its 128-document page shares the existing 10,000-read/1,024-row/60-second discovery bounds and existing row/run deadlines. Use the existing 30-minute partial wait; zero-second upload admission grace would attempt repair too early.Reuse fresh producer inventory, full retained-tail proof, same-digest apply and transactional privacy checks. Explicit closed-row repair still proves both current and frozen finishes; admission owns job advancement. Retry aged partial barriers after the existing one-hour inventory interval through
finish_partial, preserving the barrier and generations. Aged retired coordinators rearm through the same fresh-proof transaction.After seven days, transactionally cancel only canonical pending-job metadata when the conversation remains absent. Privacy-fenced cancellation is revocation-only, like
cancel_fenced_recovery; no speech receipt, audio deletion, TTL or conversation write. Add closed blocker/outcome log counters and documented rollback.Tests
cd backend && /Users/dazheng/workspace/omi/bin/omi-heavy run -- .venv/bin/python -m pytest tests/unit/test_record_pending_repair.py tests/unit/test_record_seal_cluster_repair.py tests/unit/test_record_partial.py tests/unit/test_record_seal_repair.py tests/unit/test_record_seal_nojob.py tests/unit/test_record_seal_cluster_repair_deploy.py -q— 281 passed.python -m pytest scripts/test_check_feature_flag_registry.py -q— 46 passed; registered default-on switch and regenerated catalog.Risk and rollback
No custody owner or direct job admission change. Missing-tail/live/unknown-producer/privacy refusals remain protected. Unfinished conversations are discovered but retain
not_completed; finalization stays with its current owner. Seven-day cancellation is terminal only for missing-conversation job metadata and does not claim no speech. No production access or live verification; no merge or deploy.Set
recordSealRepair.jobsDiscovery=offto wireRECORD_SEAL_REPAIR_JOBS=offinto the CronJob and disable both the added jobs leg and aged-partial retries, restoring prior discovery and partial-retry behavior. Existing top-level repair switch also stops the coordinator.Failure-Class: FC-bounded-discovery-pinned-by-blocked-page