Skip to content

fix(batch): stop seal repair spending every pass on rows it can only refuse - #24603

Merged
Git-on-my-level merged 1 commit into
mainfrom
fix/seal-repair-skip-settled-rows
Nov 4, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
fix/seal-repair-skip-settled-rows

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

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_pending rows blocked by record_upload_failed or leaked record_upload_sessions.

The prod record-seal-repair CronJob (job 29896560, 12:07Z) reported discovery_saturated=true with dispositions already_partial 117, privacy_refused 90 and partial_finished 1. oldest_unsealed_seconds was 123669 (34 h). discover() re-selects every not-closed-or-partial completed row in finished_at order. 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:

  • a valid partial barrier for the current upload revision (partial_barrier);
  • a deleted or discarded conversation, or one with 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.py passes 70, including a new parametrized skip test (privacy fields, valid barrier, changed revision). test_record_seal_cluster_repair_deploy.py 7 and test_record_partial.py 67 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

View guided diff Turn on auto-fix

…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]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T13:03:37.780218Z 6a410b3 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 or None sync 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',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Suggested change
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'):

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +177 to +179
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit cf60188 into main Nov 4, 2026
64 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/seal-repair-skip-settled-rows branch November 4, 2026 13:27
Git-on-my-level added a commit that referenced this pull request Nov 4, 2026
…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. -->
Dimank92 pushed a commit to Dimank92/omi that referenced this pull request Nov 4, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant