Repository navigation
fix(batch): stop seal repair spending every pass on rows it can only refuse - #24603
Conversation
…refuse record-seal-repair discovery selects every completed batch-owned row that is not closed or is partial, oldest finished first. In prod (2026-11-04 12:07Z) 207 of 208 attempts in a pass were already_partial or privacy_refused rows, so the cursor crawled (oldest unsealed 34 h) and recent stuck captures, with failed uploads or leaked upload sessions, waited for a full wrap. Discovery now skips rows that can only be refused until their state changes: a valid partial barrier for the current upload revision, or a deleted, discarded or sync-disabled conversation. A new upload revision or privacy change makes the row eligible again. No seal, proof or custody rule changes. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
2 issues found across 2 files
Confidence score: 3/5
- In
record_seal_cluster_repair.py, discovery can keep selecting rows that the privacy fence or planner will always refuse, including owner-level opt-outs and legacy rows with a missing orNonesync flag. Align discovery with the repair privacy predicate to avoid repeated no-op attempts.
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_seal_cluster_repair.py">
<violation number="1" location="backend/utils/batch_pipeline/record_seal_cluster_repair.py:177">
P2: `settled` does not match the repair planner’s privacy predicate, so legacy rows with a missing or `None` sync flag are repeatedly selected despite always returning `privacy_refused`. Use the same falsey check as `seal_refusal`.</violation>
<violation number="2" location="backend/utils/batch_pipeline/record_seal_cluster_repair.py:216">
P2: Discovery cannot see owner-level privacy opt-outs, so rows whose conversation flag remains true are still selected after the transaction privacy fence makes every repair attempt refuse. Consult the owner privacy fence before enqueueing candidates, or atomically mirror that state onto conversation rows.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| 'record_upload_revision', | ||
| 'deleted', | ||
| 'discarded', | ||
| 'private_cloud_sync_enabled', |
There was a problem hiding this comment.
P2: Discovery cannot see owner-level privacy opt-outs, so rows whose conversation flag remains true are still selected after the transaction privacy fence makes every repair attempt refuse. Consult the owner privacy fence before enqueueing candidates, or atomically mirror that state onto conversation rows.
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 216:
<comment>Discovery cannot see owner-level privacy opt-outs, so rows whose conversation flag remains true are still selected after the transaction privacy fence makes every repair attempt refuse. Consult the owner privacy fence before enqueueing candidates, or atomically mirror that state onto conversation rows.</comment>
<file context>
@@ -191,7 +205,17 @@ def discover(
+ 'record_upload_revision',
+ 'deleted',
+ 'discarded',
+ 'private_cloud_sync_enabled',
+ )
+ )
</file context>
| crawled while recent stuck captures waited. Any change to the mark, upload | ||
| revision or privacy fields makes the row eligible again on the next pass. | ||
| """ | ||
| if data.get('deleted') or data.get('discarded') or data.get('private_cloud_sync_enabled') is False: |
There was a problem hiding this comment.
P2: settled does not match the repair planner’s privacy predicate, so legacy rows with a missing or None sync flag are repeatedly selected despite always returning privacy_refused. Use the same falsey check as seal_refusal.
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 177:
<comment>`settled` does not match the repair planner’s privacy predicate, so legacy rows with a missing or `None` sync flag are repeatedly selected despite always returning `privacy_refused`. Use the same falsey check as `seal_refusal`.</comment>
<file context>
@@ -165,6 +165,20 @@ def repair_one(store, storage, artifacts, path, *, flags, inventory, budget, mod
+ crawled while recent stuck captures waited. Any change to the mark, upload
+ revision or privacy fields makes the row eligible again on the next pass.
+ """
+ if data.get('deleted') or data.get('discarded') or data.get('private_cloud_sync_enabled') is False:
+ return True
+ return bool(data.get('record_audio_partial')) and partial_config.partial_barrier(data)
</file context>
| if data.get('deleted') or data.get('discarded') or data.get('private_cloud_sync_enabled') is False: | |
| if data.get('deleted') or data.get('discarded') or not data.get('private_cloud_sync_enabled'): |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a410b3eed
ℹ️ 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 data.get('deleted') or data.get('discarded') or data.get('private_cloud_sync_enabled') is False: | ||
| return True | ||
| return bool(data.get('record_audio_partial')) and partial_config.partial_barrier(data) |
There was a problem hiding this comment.
Add the required audio-pipeline change note
This changes which completed recordings the seal-repair coordinator revisits, but the commit contains only implementation and test changes. backend/AGENTS.md explicitly requires a pipeline change note in the same PR for audio or conversation-lifecycle changes. Add a dated note under backend/docs/listen_pusher_pipeline/changes/ describing the skipped states, what makes them eligible again, and the rollout/validation evidence so the operational record reflects this recovery-policy change.
AGENTS.md reference: backend/AGENTS.md:L164-L164
Useful? React with 👍 / 👎.
…24613) <!-- claude-projects-attribution: {"github_login":"Git-on-my-level"} --> _Requested by **David**_ Every batch-pipeline-worker roll from main fails the image smoke: `missing installed dependency modules: deepgram, ..., langdetect, ...` (run 41860715660, main c8304ee). cl2-deploy's static bisect traced it: - #24490 made `deepgram` reachable from the worker image; - #24366 made `langdetect` reachable. The last good worker roll was e24fa48 (11-03). This blocks #24603 (the seal-repair discovery fix for today's admission jam) from reaching prod. Change: add `deepgram-sdk==4.8.1`, `langdetect==1.0.9`, `websockets==12.0` and `aiofiles==24.1.0` to `backend/diarizer/requirements-batch-pipeline.txt`, all matching `backend/requirements.txt`, and recompile `pylock.batch-pipeline.toml` with the file's own uv command. The lock gains 8 packages; marshmallow moves 4.3.1 -> 3.26.2, which is the backend's pin required by dataclasses-json. No code changes. A lazy-import cleanup can follow separately. Validation: - `backend/scripts/runtime_image_contracts.py check`: passed for 19 registered images. - Lock and image tests pass: `test_batch_pipeline_lock_jobstore` 2, `test_admit_role_image` 19, `test_diarizer_batch_prereqs` 6. - The authoritative check is the image smoke in the worker deploy workflow; cl2-deploy re-rolls right after merge. Rollback: revert (the worker keeps rollback digest sha256:4faf8b7a8c53). Failure-Class: none 🤖 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/24613?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/24613?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24613&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. -->
BasedHardware#24490 (speakers final pass) and BasedHardware#24366 (artifact restore) made the STT helpers reachable from the batch-pipeline worker, but its lock never gained their dependencies. The image smoke now fails on every main commit since, which blocks all worker rolls, including the BasedHardware#24603 seal-repair discovery fix for the admission jam (run 41860715660). Pin deepgram-sdk 4.8.1 and langdetect 1.0.9, plus websockets 12.0 and aiofiles 24.1.0, to backend/requirements.txt and recompile pylock.batch-pipeline.toml (marshmallow resolves to the backend's 3.26.2). Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
Requested by David
This is part of the admission-jam work and David's 11:06Z ruling 2 (failed-upload retry and open recorder sessions). A read-only sample at 11:45Z found 359 of 500 due
record_pendingrows blocked byrecord_upload_failedor leakedrecord_upload_sessions.The prod
record-seal-repairCronJob (job 29896560, 12:07Z) reporteddiscovery_saturated=truewith dispositionsalready_partial117,privacy_refused90 andpartial_finished1.oldest_unsealed_secondswas 123669 (34 h).discover()re-selects every not-closed-or-partial completed row infinished_atorder. Rows that can only be refused take nearly every worker slot, so the cursor crawls and recent stuck captures wait for a full wrap.Change:
discover()now skips rows that repair can only refuse until their state changes:partial_barrier);private_cloud_sync_enabled is False.A changed mark, upload revision or privacy field makes the row eligible on the next pass. Seal, proof, producer-liveness and custody rules are unchanged. The projection adds four metadata fields and no content.
Validation:
test_record_seal_cluster_repair.pypasses 70, including a new parametrized skip test (privacy fields, valid barrier, changed revision).test_record_seal_cluster_repair_deploy.py7 andtest_record_partial.py67 also pass. Local results only.Rollback: revert.
Related: #24598 (draft, held after a BLOCK review) addresses producer liveness separately.
Failure-Class: none
🤖 Generated with Claude Code