Skip to content

fix(batch): stop seal repair waiting on a live pusher pod for aged captures - #24598

Closed
Git-on-my-level wants to merge 1 commit into
mainfrom
fix/seal-live-producer-grace
Closed

Git-on-my-level wants to merge 1 commit into
mainfrom
fix/seal-live-producer-grace

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

David's ruling of 2026-11-04 11:06Z gave the lead the failed-upload retry and open recorder-session leaks. A read-only sample of 500 due record_pending rows at 11:45Z found 359 blocked by record_upload_sessions and/or record_upload_failed. All of them were status=completed; 181 had finished more than 1 hour earlier.

Cause: fail_recording deliberately keeps its producer token (utils/pusher_record_barrier.py). Seal repair then refuses upload_pending unless it can prove the producing pusher pod has died or restarted (record_producer_proof.producer_tokens_dead). Pusher pods are long-lived, so these rows wait until a pod restart, and admission retries them every 60 s in the meantime.

Change: in seal_refusal, a completed capture finished more than RECORD_SEAL_LIVE_PRODUCER_GRACE_SECONDS ago (default 3600; 0 restores the previous rule) counts as quiesced when every token carries producer identity. The custody gates are unchanged:

  • the full retained-tail proof and the plan/apply unchanged-state fence still apply;
  • pre-identity (True) tokens still need the operator --producers-stopped attestation;
  • partial arming (database/record_partial.py) keeps the pod-restart rule, because it can admit without a full tail;
  • the pusher runtime seal is untouched.
    No audio is deleted; repair writes only conversation and job metadata.

Wiring: chart recordSealRules.liveProducerGraceSeconds goes to the record-seal-worker and record-seal-repair jobs; flag registry, deployment classification and pipeline doc are updated.

Validation: new test_record_seal_live_producer_grace.py (17). Existing test_record_partial 67, test_record_seal_repair 37, test_record_seal_cluster_repair 64, test_record_seal_nojob 44, test_record_seal_rules 21, seal deploy tests 14 and test_cross_service_deploy_contract 23 all pass. Local results only; deploy effect is measured by the admission retry reason=capture_upload_finalization_barrier_not_closed and omi_record_seal_attempts_total{disposition}.

Rollback: set recordSealRules.liveProducerGraceSeconds=0, or revert.

Failure-Class: none

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

…ptures

fail_recording keeps its producer token as a fence, and seal repair refused
'upload_pending' until that long-lived pusher pod restarted. Completed
recordings with failed uploads or leaked upload sessions therefore stayed
record_pending for hours (359 of 500 due rows sampled 11:45Z).

A completed capture finished more than RECORD_SEAL_LIVE_PRODUCER_GRACE_SECONDS
(default 3600, 0 restores the old rule) ago now counts as quiesced in seal
repair when every token carries producer identity. The full retained-tail proof
and unchanged-state fencing still gate the seal; pre-identity tokens still need
the operator attestation; partial arming and the pusher runtime seal keep the
pod-restart rule.

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-04T12:23:35.738669Z 43dd1ce 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.

@Git-on-my-level
Git-on-my-level marked this pull request as draft November 4, 2026 12:19

@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: 43dd1ce009

ℹ️ 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".

Repair-only exemption from the pod-restart proof. Pre-identity (bare True)
tokens still require the explicit operator attestation.
"""
from config.record_seal_rules import live_producer_grace_seconds

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 Move the grace-setting import to module scope

The new function-local import violates the explicit rule in backend/AGENTS.md that all imports must be at module scope. Move live_producer_grace_seconds alongside the existing configuration imports; its implementation already reads the environment when called, so importing it at module scope preserves dynamic flag evaluation.

AGENTS.md reference: backend/AGENTS.md:L166-L168

Useful? React with 👍 / 👎.

Comment on lines +178 to +181
A completed capture finished more than `RECORD_SEAL_LIVE_PRODUCER_GRACE_SECONDS`
(default 3600; 0 disables) ago no longer waits for its producer pod to restart:
seal repair treats identified producer tokens as quiesced and still requires the
full retained-tail proof. Partial arming keeps the pod-restart rule.

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 commit changes audio-custody sealing behavior but does not add a note under backend/docs/listen_pusher_pipeline/changes/. The changed-file list and a search of that directory show only the contract-document update, whereas backend/AGENTS.md requires a separate change note for audio and conversation-lifecycle changes. Add a dated note covering the rationale, rollout and rollback setting, and verification evidence, linked to this contract section.

AGENTS.md reference: backend/AGENTS.md:L164-L164

Useful? React with 👍 / 👎.

@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.

9 issues found across 11 files

Confidence score: 2/5

  • producers_quiesced in backend/utils/batch_pipeline/record_producer_proof.py can treat a token with only a pod name as identified, letting incomplete identity bypass the producer fence. Require the same process identity fields as producer_tokens_dead, and add a negative test for a missing process_started_at.
  • The grace branch in backend/utils/batch_pipeline/record_seal_repair.py treats identified producers as quiesced once the grace period expires, without checking that the pod stopped. Keep the restart proof in this path or otherwise confirm the producer has stopped.
  • Setting recordSealRules.liveProducerGraceSeconds to 0 has no effect because the sweeper CronJob does not receive the setting and falls back to its default. Pass the configured value to the CronJob.
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/charts/batch-pipeline-worker/templates/record-seal-repair.yaml">

<violation number="1" location="backend/charts/batch-pipeline-worker/templates/record-seal-repair.yaml:60">
P3: This new env var has no chart-level validation, unlike `recordSealRepair.workers` above. Add a `fail` guard for non-numeric or negative values so a bad override cannot silently fall back to the 1-hour default.</violation>
</file>

<file name="backend/charts/batch-pipeline-worker/values.yaml">

<violation number="1" location="backend/charts/batch-pipeline-worker/values.yaml:9">
P2: Setting `recordSealRules.liveProducerGraceSeconds: 0` does not disable the grace exception in the sweeper. The sweeper CronJob never receives `RECORD_SEAL_LIVE_PRODUCER_GRACE_SECONDS`, so it falls back to the code default of 3600 through `plan_seals`/`apply_seals` → `seal_refusal`. Either pass the env var in `record-seal-sweeper.yaml` or narrow the comment and the rollback claim to the worker and repair jobs.</violation>
</file>

<file name="backend/tests/unit/test_record_seal_live_producer_grace.py">

<violation number="1" location="backend/tests/unit/test_record_seal_live_producer_grace.py:3">
P2: Remove the unused `timedelta` import; Ruff will fail this new test file with `F401`.</violation>

<violation number="2" location="backend/tests/unit/test_record_seal_live_producer_grace.py:48">
P1: Add a negative case for an identity token with a pod name but no `process_started_at`. The current cases do not catch quiescence admitting incomplete producer identity, which can bypass the intended producer fence for aged captures.</violation>
</file>

<file name="backend/docs/listen_pusher_pipeline.mdx">

<violation number="1" location="backend/docs/listen_pusher_pipeline.mdx:179">
P2: The rollback guidance omits the chart key. Add `recordSealRules.liveProducerGraceSeconds` (set to 0 to restore the pod-restart-only rule) so operators can find the control where the other seal rollback knobs are documented.</violation>

<violation number="2" location="backend/docs/listen_pusher_pipeline.mdx:180">
P3: 'identified producer tokens' reads per token. The code requires every producer token to carry a pod identity, and any pre-identity token keeps the restart rule. State that all producer tokens must be identified, and mention the unchanged-state fence the PR description requires.</violation>
</file>

<file name="backend/utils/batch_pipeline/record_seal_repair.py">

<violation number="1" location="backend/utils/batch_pipeline/record_seal_repair.py:69">
P2: The grace branch treats any identified producer token as quiesced once the grace period has elapsed, without checking that the producing pod has stopped. The restart proof that the other branch uses is skipped entirely, and this branch ignores `producer_proof`. Please confirm that a live pusher cannot still append or upload its held tail after the grace period, or gate this branch on a pod-liveness check.</violation>
</file>

<file name="backend/utils/batch_pipeline/record_producer_proof.py">

<violation number="1" location="backend/utils/batch_pipeline/record_producer_proof.py:116">
P3: This local import violates the backend's module-import rule and is unnecessary because `record_seal_rules` has no cycle here. Move it to the module-level import block.</violation>

<violation number="2" location="backend/utils/batch_pipeline/record_producer_proof.py:132">
P1: `producers_quiesced` treats any dict with a nonempty `pod` as identified, even when `process_started_at` is missing or malformed. Require the same process identity fields as `producer_tokens_dead` before bypassing the restart proof.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

(86400, {'s': POD, 't': POD}, 'completed', True),
(86400, {'s': True}, 'completed', False), # pre-identity token needs the operator attestation
(86400, {'s': POD, 't': True}, 'completed', False),
(86400, {'s': {'pod': ''}}, 'completed', 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.

P1: Add a negative case for an identity token with a pod name but no process_started_at. The current cases do not catch quiescence admitting incomplete producer identity, which can bypass the intended producer fence for aged captures.

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/tests/unit/test_record_seal_live_producer_grace.py, line 48:

<comment>Add a negative case for an identity token with a pod name but no `process_started_at`. The current cases do not catch quiescence admitting incomplete producer identity, which can bypass the intended producer fence for aged captures.</comment>

<file context>
@@ -0,0 +1,78 @@
+        (86400, {'s': POD, 't': POD}, 'completed', True),
+        (86400, {'s': True}, 'completed', False),  # pre-identity token needs the operator attestation
+        (86400, {'s': POD, 't': True}, 'completed', False),
+        (86400, {'s': {'pod': ''}}, 'completed', False),
+        (86400, {'s': POD}, 'in_progress', False),
+        (86400, {}, 'completed', False),
</file context>
Suggested change
(86400, {'s': {'pod': ''}}, 'completed', False),
(86400, {'s': {'pod': 'pusher-synthetic'}}, 'completed', False),

if now - finish < grace:
return False
return all(
isinstance(value, dict) and isinstance(value.get('pod'), str) and value['pod'] for value in tokens.values()

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: producers_quiesced treats any dict with a nonempty pod as identified, even when process_started_at is missing or malformed. Require the same process identity fields as producer_tokens_dead before bypassing the restart proof.

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_producer_proof.py, line 132:

<comment>`producers_quiesced` treats any dict with a nonempty `pod` as identified, even when `process_started_at` is missing or malformed. Require the same process identity fields as `producer_tokens_dead` before bypassing the restart proof.</comment>

<file context>
@@ -105,3 +105,29 @@ def producer_tokens_dead(tokens, proof, *, producers_stopped=False):
+    if now - finish < grace:
+        return False
+    return all(
+        isinstance(value, dict) and isinstance(value.get('pod'), str) and value['pod'] for value in tokens.values()
+    )
</file context>
Suggested change
isinstance(value, dict) and isinstance(value.get('pod'), str) and value['pod'] for value in tokens.values()
isinstance(value, dict)
and isinstance(value.get('pod'), str)
and bool(value['pod'])
and isinstance(value.get('process_started_at'), (int, float))
and not isinstance(value['process_started_at'], bool)
and math.isfinite(value['process_started_at'])
and value['process_started_at'] > 0
for value in tokens.values()

overlapTrimEnabled: true
uploadFailedRepairEnabled: true
# Completed captures older than this stop waiting on a live pusher pod restart; 0 restores that rule.
liveProducerGraceSeconds: 3600

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: Setting recordSealRules.liveProducerGraceSeconds: 0 does not disable the grace exception in the sweeper. The sweeper CronJob never receives RECORD_SEAL_LIVE_PRODUCER_GRACE_SECONDS, so it falls back to the code default of 3600 through plan_seals/apply_seals → seal_refusal. Either pass the env var in record-seal-sweeper.yaml or narrow the comment and the rollback claim to the worker and repair jobs.

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/charts/batch-pipeline-worker/values.yaml, line 9:

<comment>Setting `recordSealRules.liveProducerGraceSeconds: 0` does not disable the grace exception in the sweeper. The sweeper CronJob never receives `RECORD_SEAL_LIVE_PRODUCER_GRACE_SECONDS`, so it falls back to the code default of 3600 through `plan_seals`/`apply_seals` → `seal_refusal`. Either pass the env var in `record-seal-sweeper.yaml` or narrow the comment and the rollback claim to the worker and repair jobs.</comment>

<file context>
@@ -5,6 +5,8 @@ recordSealRules:
   overlapTrimEnabled: true
   uploadFailedRepairEnabled: true
+  # Completed captures older than this stop waiting on a live pusher pod restart; 0 restores that rule.
+  liveProducerGraceSeconds: 3600
 image:
   repository: ""
</file context>

@@ -0,0 +1,78 @@
"""Aged completed captures stop waiting on a long-lived pusher pod's restart."""

from datetime import datetime, timedelta, timezone

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: Remove the unused timedelta import; Ruff will fail this new test file with F401.

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/tests/unit/test_record_seal_live_producer_grace.py, line 3:

<comment>Remove the unused `timedelta` import; Ruff will fail this new test file with `F401`.</comment>

<file context>
@@ -0,0 +1,78 @@
+"""Aged completed captures stop waiting on a long-lived pusher pod's restart."""
+
+from datetime import datetime, timedelta, timezone
+
+import pytest
</file context>
Suggested change
from datetime import datetime, timedelta, timezone
from datetime import datetime, timezone


Only the independent repair job opts into retrying `record_upload_failed` rows.
A completed capture finished more than `RECORD_SEAL_LIVE_PRODUCER_GRACE_SECONDS`
(default 3600; 0 disables) ago no longer waits for its producer pod to restart:

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: The rollback guidance omits the chart key. Add recordSealRules.liveProducerGraceSeconds (set to 0 to restore the pod-restart-only rule) so operators can find the control where the other seal rollback knobs are documented.

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/docs/listen_pusher_pipeline.mdx, line 179:

<comment>The rollback guidance omits the chart key. Add `recordSealRules.liveProducerGraceSeconds` (set to 0 to restore the pod-restart-only rule) so operators can find the control where the other seal rollback knobs are documented.</comment>

<file context>
@@ -175,6 +175,10 @@ object span, retaining the earlier accepted bytes within that span. A wholly
 
 Only the independent repair job opts into retrying `record_upload_failed` rows.
+A completed capture finished more than `RECORD_SEAL_LIVE_PRODUCER_GRACE_SECONDS`
+(default 3600; 0 disables) ago no longer waits for its producer pod to restart:
+seal repair treats identified producer tokens as quiesced and still requires the
+full retained-tail proof. Partial arming keeps the pod-restart rule.
</file context>
Suggested change
(default 3600; 0 disables) ago no longer waits for its producer pod to restart:
(default 3600; 0 disables; chart `recordSealRules.liveProducerGraceSeconds`) ago no longer waits for its producer pod to restart:

row['record_upload_sessions'], producer_proof, producers_stopped=producers_stopped
if row.get('record_upload_sessions') and not (
producer_tokens_dead(row['record_upload_sessions'], producer_proof, producers_stopped=producers_stopped)
or producers_quiesced(row, row['record_upload_sessions'])

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: The grace branch treats any identified producer token as quiesced once the grace period has elapsed, without checking that the producing pod has stopped. The restart proof that the other branch uses is skipped entirely, and this branch ignores producer_proof. Please confirm that a live pusher cannot still append or upload its held tail after the grace period, or gate this branch on a pod-liveness check.

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_repair.py, line 69:

<comment>The grace branch treats any identified producer token as quiesced once the grace period has elapsed, without checking that the producing pod has stopped. The restart proof that the other branch uses is skipped entirely, and this branch ignores `producer_proof`. Please confirm that a live pusher cannot still append or upload its held tail after the grace period, or gate this branch on a pod-liveness check.</comment>

<file context>
@@ -64,8 +64,9 @@ def seal_refusal(job, row, *, producer_proof=None, producers_stopped=False, repa
-        row['record_upload_sessions'], producer_proof, producers_stopped=producers_stopped
+    if row.get('record_upload_sessions') and not (
+        producer_tokens_dead(row['record_upload_sessions'], producer_proof, producers_stopped=producers_stopped)
+        or producers_quiesced(row, row['record_upload_sessions'])
     ):
         return 'upload_pending'
</file context>

- {name: RECORD_AUDIO_PARTIAL_ENABLED, value: {{ .Values.recordSealRules.partialEnabled | quote }}}
- {name: RECORD_SEAL_OVERLAP_TRIM_ENABLED, value: {{ .Values.recordSealRules.overlapTrimEnabled | quote }}}
- {name: RECORD_SEAL_UPLOAD_FAILED_REPAIR_ENABLED, value: {{ .Values.recordSealRules.uploadFailedRepairEnabled | quote }}}
- {name: RECORD_SEAL_LIVE_PRODUCER_GRACE_SECONDS, value: {{ .Values.recordSealRules.liveProducerGraceSeconds | quote }}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: This new env var has no chart-level validation, unlike recordSealRepair.workers above. Add a fail guard for non-numeric or negative values so a bad override cannot silently fall back to the 1-hour default.

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/charts/batch-pipeline-worker/templates/record-seal-repair.yaml, line 60:

<comment>This new env var has no chart-level validation, unlike `recordSealRepair.workers` above. Add a `fail` guard for non-numeric or negative values so a bad override cannot silently fall back to the 1-hour default.</comment>

<file context>
@@ -57,6 +57,7 @@ spec:
                 - {name: RECORD_AUDIO_PARTIAL_ENABLED, value: {{ .Values.recordSealRules.partialEnabled | quote }}}
                 - {name: RECORD_SEAL_OVERLAP_TRIM_ENABLED, value: {{ .Values.recordSealRules.overlapTrimEnabled | quote }}}
                 - {name: RECORD_SEAL_UPLOAD_FAILED_REPAIR_ENABLED, value: {{ .Values.recordSealRules.uploadFailedRepairEnabled | quote }}}
+                - {name: RECORD_SEAL_LIVE_PRODUCER_GRACE_SECONDS, value: {{ .Values.recordSealRules.liveProducerGraceSeconds | quote }}}
                 - {name: RECORD_SEAL_REPAIR_MODE, value: {{ .Values.recordSealRepair.mode | quote }}}
                 - {name: RECORD_SEAL_REPAIR_WORKERS, value: {{ .Values.recordSealRepair.workers | quote }}}
</file context>

Only the independent repair job opts into retrying `record_upload_failed` rows.
A completed capture finished more than `RECORD_SEAL_LIVE_PRODUCER_GRACE_SECONDS`
(default 3600; 0 disables) ago no longer waits for its producer pod to restart:
seal repair treats identified producer tokens as quiesced and still requires the

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: 'identified producer tokens' reads per token. The code requires every producer token to carry a pod identity, and any pre-identity token keeps the restart rule. State that all producer tokens must be identified, and mention the unchanged-state fence the PR description requires.

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/docs/listen_pusher_pipeline.mdx, line 180:

<comment>'identified producer tokens' reads per token. The code requires every producer token to carry a pod identity, and any pre-identity token keeps the restart rule. State that all producer tokens must be identified, and mention the unchanged-state fence the PR description requires.</comment>

<file context>
@@ -175,6 +175,10 @@ object span, retaining the earlier accepted bytes within that span. A wholly
 Only the independent repair job opts into retrying `record_upload_failed` rows.
+A completed capture finished more than `RECORD_SEAL_LIVE_PRODUCER_GRACE_SECONDS`
+(default 3600; 0 disables) ago no longer waits for its producer pod to restart:
+seal repair treats identified producer tokens as quiesced and still requires the
+full retained-tail proof. Partial arming keeps the pod-restart rule.
 `RECORD_SEAL_UPLOAD_FAILED_REPAIR_ENABLED=false` disables that rule. After full
</file context>
Suggested change
seal repair treats identified producer tokens as quiesced and still requires the
seal repair treats the capture as quiesced only when all producer tokens are identified, and still requires the

Repair-only exemption from the pod-restart proof. Pre-identity (bare True)
tokens still require the explicit operator attestation.
"""
from config.record_seal_rules import live_producer_grace_seconds

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: This local import violates the backend's module-import rule and is unnecessary because record_seal_rules has no cycle here. Move it to the module-level import block.

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_producer_proof.py, line 116:

<comment>This local import violates the backend's module-import rule and is unnecessary because `record_seal_rules` has no cycle here. Move it to the module-level import block.</comment>

<file context>
@@ -105,3 +105,29 @@ def producer_tokens_dead(tokens, proof, *, producers_stopped=False):
+    Repair-only exemption from the pod-restart proof. Pre-identity (bare True)
+    tokens still require the explicit operator attestation.
+    """
+    from config.record_seal_rules import live_producer_grace_seconds
+
+    grace = live_producer_grace_seconds()
</file context>

Git-on-my-level added a commit that referenced this pull request Nov 4, 2026
…refuse (#24603)

<!-- claude-projects-attribution: {"github_login":"Git-on-my-level"} -->
_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](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/24603?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/24603?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24603&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. -->
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Closing: superseded by the merged seal-repair work (#24703 jobs leg, #24738 efficiency, #24733/#24729 workers, #24736 held-row dead-letter). Parked draft for 65 h with no owner; lead2 call per loop-audit. Reopen if a unique change remains.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

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:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

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!

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