Skip to content

fix(batch): settle aged batch obligations in code (record dead letter, ghost settle on, assignment expiry) - #24884

Merged
Git-on-my-level merged 9 commits into
mainfrom
lane/pipeline-settle
Nov 8, 2026
Merged

Git-on-my-level merged 9 commits into
mainfrom
lane/pipeline-settle

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What

David 2026-11-07 16:24Z: "settle this the cheapest way possible ... and least debt for future agents". Built into code, with no one-off scripts or operator campaigns. State flips only; raw audio and custody markers are never deleted; no GPU/STT/LLM replays.

  1. Aged record dead letter.
    • Barrier-blocked record_pending jobs ("capture upload/finalization barrier not closed", about 22k on 11-07) retried forever.
    • Inside the record drainer's EXISTING defer transaction (no new loop or query), the first barrier refusal stamps record_dead_letter_deadline_at (+14 d, a full window even for old rows). Once the window passes, the row flips to state='dead', dead_letter_reason='record_barrier_aged'.
    • A malformed deadline never expires a row. Conversation, audio and custody are untouched.
    • Private OIDC requeue-record CASes only this reason back to record_pending through the normal privacy fence.
    • New omi_batch_record_dead_letter_* inflow, stock and freshness metrics, admitted by the Cloud Run ingestion allowlists, plus an alert.
  2. Ghost settle: stays OFF in this PR (no runtime config change).
    • Ghost settle was tripped off on 2026-11-08 at about 02:00Z (lead2 ea819b/f5a331). The ghost branch bypassed _target_restorable, so rows with an unpersisted live record target failed at the head of their owner chain (SyncAssignmentConflict 'batch live target not persisted'), blocking later conversations.
    • Turning ghost on waits for the _target_restorable fix (lcwake/uicleanup) plus a head-error baseline.
    • This PR keeps only the code-side ghost-vs-expiry ordering: ghost classification runs before assignment expiry, so a ghost-eligible or cap/age-skipped row is never expired.
  3. Aged assignment_held expiry.
    • Committed recovery_state=held rows that fail the real-held gate now get the SAME held_expired markers after a full window. They settle through the existing metric and nightly re-drive.
    • Ghost classification runs first: a ghost-eligible row, or one skipped by the cap or age floor, is never stamped or expired.
    • Identity, privacy-refusal and open-operator-intent fences hold; malformed anchors never expire.

Also folds in lead2's #24863 follow-ups (f85d74): a shared barrier-message constant with the raise site, bool/NaN enqueued_at treated as young, and a deterministic kill-switch test.

Kill switches (zero new flags; net-zero rule)

  • BATCH_HELD_DEAD_LETTER_ENABLED=false stops record dead-letter stamps and flips (normal retries continue) and the assignment expiry.
  • BATCH_PIPELINE_PROJECTION_GHOST_SETTLE_ENABLED stays at its default false in every environment (this PR does not enable it).
  • The switches are independent and documented in CONTRACT.md and config/feature-flags.yaml.

Cost (firestore-lead estimate, sent before any live run: bus 051ef4)

  • Record: 0 added reads; the stamp and flip fold into existing defer writes; +1 aggregate count per 5-min leader tick. Nothing settles before about 11-21 (full window).
  • Ghost: none (stays off in this PR).
  • Assignment: reuses the existing 3 reads per observation; +1 stamp and +1 expiry write per row (8.45k rows, at most about 17k writes one-time).

Review

  • Luna correctness + prod safety, one parallel round.
  • Blockers, both fixed in this branch:
    • (1) the new metrics were dropped by ingestion allowlists, so the alert stayed silent;
    • (2) kill-switch scope documentation.
  • Earlier rounds fixed: a new flag replaced by reuse (net-zero), and the ghost-vs-expiry ordering.

Tests

3,294 passed, 75 expected xfails, 51 preflight checks (see the branch's settle reports). Firestore loopback integration passed in the earlier round (28 passed).

Product invariants affected

  • INV-MEM-4: backend/deploy/runtime_env.yaml is touched only to set BATCH_PIPELINE_PROJECTION_GHOST_SETTLE_ENABLED for the batch serving role. No memory intake, Short-term/Long-term promotion, consolidation route or memory projection changes.

Failure-Class: none

🤖 Generated with Claude Code

Git-on-my-level and others added 2 commits November 8, 2026 02:38
Add record barrier deadlines and reason-fenced private requeue under the shared held kill switch. Enable the approved prod ghost selector, classify completed receipts before assignment expiry, and settle aged non-ghost assignment gate failures with retained held expiry markers. Preserve ghost repair fences and protect capped, young and held-job ghost skips from expiry.

Failure-Class: none
…e stays within its unit budget

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T03:52:32.992374Z 8e023b1 New commits
ℹ️ 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.

@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: 040336d035

ℹ️ 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 +192 to +194
import json
from pathlib import Path
from utils.batch_pipeline.metrics import QueueMetrics

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 new test imports to module scope

The new test module imports dependencies inside multiple test functions, contrary to backend/AGENTS.md, which explicitly requires all imports at module top level. Move these imports, along with the other function-local imports added in the projection-release tests, to their respective module import sections.

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

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.

4 issues found across 38 files

Confidence score: 2/5

  • batch_pipeline_projection_release.py can permanently strand receipt-less assignment holds: this fallback marks them held_expired, while nightly re-drive requires held_receipt and this path rejects dead_before calls. Preserve a recovery path for these holds.
  • part_quarantined rows can reach _expire_assignment through the fallback, which does not inspect projection_parts, so aged multipart rows may get held_expired markers. Exclude part_quarantined rows from this fallback.
  • CONTRACT.md labels transition-inflow, stock, and freshness metrics as a dwell metric, which could mislead operators about the alert data. Label the cell as dead-letter observability and identify the existing metric it describes.
  • 2026-11-07-pipeline-settle.md names omi-pipeline as owner, contradicting the linked contract and flag registry. Correct the owner or clarify how system ownership differs.

You’re at about 95% 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/CONTRACT.md">

<violation number="1" location="backend/utils/batch_pipeline/CONTRACT.md:180">
P3: This row labels transition-inflow, stock, and freshness metrics as a dwell metric, which can mislead operators about what the alert data measures. Label the cell as dead-letter observability and identify the existing pending-age metric separately.</violation>
</file>

<file name="backend/docs/listen_pusher_pipeline/changes/2026-11-07-pipeline-settle.md">

<violation number="1" location="backend/docs/listen_pusher_pipeline/changes/2026-11-07-pipeline-settle.md:5">
P3: This note assigns ownership to `omi-pipeline`, contradicting the linked contract and flag registry, which name `uicleanup (omi-lifecycle)` as owner. Correct the owner here or explicitly distinguish system ownership from operational ownership.</violation>
</file>

<file name="backend/database/batch_pipeline_projection_release.py">

<violation number="1" location="backend/database/batch_pipeline_projection_release.py:255">
P2: The new fallback lets `part_quarantined` rows reach `_expire_assignment`, which does not inspect `projection_parts`; aged multipart rows can therefore receive `held_expired` markers. Exclude `part_quarantined` from this expiry path.</violation>

<violation number="2" location="backend/database/batch_pipeline_projection_release.py:272">
P1: This fallback can permanently strand receipt-less assignment holds: it marks them `held_expired`, but the later nightly re-drive still requires `held_receipt` and this branch refuses all `dead_before` calls. Preserve a recoverable quarantine receipt or add a dedicated re-drive path for this expired shape; otherwise target restoration cannot make the retained row runnable again.</violation>
</file>

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

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

and attempts >= 0
and dead_before is None
):
outcome = self._expire_assignment(transaction, segment_id, entry, now, expired, attempts)

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: This fallback can permanently strand receipt-less assignment holds: it marks them held_expired, but the later nightly re-drive still requires held_receipt and this branch refuses all dead_before calls. Preserve a recoverable quarantine receipt or add a dedicated re-drive path for this expired shape; otherwise target restoration cannot make the retained row runnable again.

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/batch_pipeline_projection_release.py, line 272:

<comment>This fallback can permanently strand receipt-less assignment holds: it marks them `held_expired`, but the later nightly re-drive still requires `held_receipt` and this branch refuses all `dead_before` calls. Preserve a recoverable quarantine receipt or add a dedicated re-drive path for this expired shape; otherwise target restoration cannot make the retained row runnable again.</comment>

<file context>
@@ -218,40 +245,44 @@ def commit(transaction):
+                    and attempts >= 0
+                    and dead_before is None
+                ):
+                    outcome = self._expire_assignment(transaction, segment_id, entry, now, expired, attempts)
+                    if outcome == 'expired':
+                        return outcome
</file context>

# shape. Retain it with the SAME expiry markers, never release
# through a failed identity/privacy/operator fence.
if (
classification not in {'privacy', 'job_held', 'young', 'invalid_age'}

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 new fallback lets part_quarantined rows reach _expire_assignment, which does not inspect projection_parts; aged multipart rows can therefore receive held_expired markers. Exclude part_quarantined from this expiry path.

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/batch_pipeline_projection_release.py, line 255:

<comment>The new fallback lets `part_quarantined` rows reach `_expire_assignment`, which does not inspect `projection_parts`; aged multipart rows can therefore receive `held_expired` markers. Exclude `part_quarantined` from this expiry path.</comment>

<file context>
@@ -218,40 +245,44 @@ def commit(transaction):
+                # shape. Retain it with the SAME expiry markers, never release
+                # through a failed identity/privacy/operator fence.
+                if (
+                    classification not in {'privacy', 'job_held', 'young', 'invalid_age'}
+                    and binding is not None
+                    and segment_id in binding.segment_ids
</file context>
Suggested change
classification not in {'privacy', 'job_held', 'young', 'invalid_age'}
classification not in {'privacy', 'job_held', 'young', 'invalid_age', 'part_quarantined'}

| Machine:state | Entry writer | Exit writer | Deadline field | Dwell metric | Alert | Flag / kill switch | Rollback behavior |
| --- | --- | --- | --- | --- | --- | --- | --- |
| `batch:record_pending` | `utils/batch_pipeline/live.py:register_recording.commit` | `utils/batch_pipeline/live.py:admit_recording`, seal repair via B | Per-attempt admission lease only; no total dwell deadline | `omi_batch_record_pending_new_oldest_age_seconds` | `omi-record-pending-dwell` (page) | No held-specific switch | Keep custody; never infer sealed audio from age |
| `batch:record_pending` | `utils/batch_pipeline/live.py:register_recording` | Normal record admission; `utils/batch_pipeline/live.py:drain_recordings` defer CAS → retained `dead` for aged barrier refusal | `record_dead_letter_deadline_at`, stamped on first literal barrier failure; 14 days, including old rows | `omi_batch_record_dead_letter_total`, `omi_batch_record_dead_letter_units`, `omi_batch_record_dead_letter_observed_at_seconds`; existing pending dwell | `omi-batch-record-dead-letter-volume` (agent); existing pending dwell page | `BATCH_HELD_DEAD_LETTER_ENABLED` (true) | False preserves ordinary defer; no custody/audio/conversation writes; private OIDC requeue-record |

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 row labels transition-inflow, stock, and freshness metrics as a dwell metric, which can mislead operators about what the alert data measures. Label the cell as dead-letter observability and identify the existing pending-age metric separately.

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/CONTRACT.md, line 180:

<comment>This row labels transition-inflow, stock, and freshness metrics as a dwell metric, which can mislead operators about what the alert data measures. Label the cell as dead-letter observability and identify the existing pending-age metric separately.</comment>

<file context>
@@ -177,14 +177,14 @@ maintenance (`utils/batch_pipeline/serving.py:start_serving_from_env.run`).
 | Machine:state | Entry writer | Exit writer | Deadline field | Dwell metric | Alert | Flag / kill switch | Rollback behavior |
 | --- | --- | --- | --- | --- | --- | --- | --- |
-| `batch:record_pending` | `utils/batch_pipeline/live.py:register_recording.commit` | `utils/batch_pipeline/live.py:admit_recording`, seal repair via B | Per-attempt admission lease only; no total dwell deadline | `omi_batch_record_pending_new_oldest_age_seconds` | `omi-record-pending-dwell` (page) | No held-specific switch | Keep custody; never infer sealed audio from age |
+| `batch:record_pending` | `utils/batch_pipeline/live.py:register_recording` | Normal record admission; `utils/batch_pipeline/live.py:drain_recordings` defer CAS → retained `dead` for aged barrier refusal | `record_dead_letter_deadline_at`, stamped on first literal barrier failure; 14 days, including old rows | `omi_batch_record_dead_letter_total`, `omi_batch_record_dead_letter_units`, `omi_batch_record_dead_letter_observed_at_seconds`; existing pending dwell | `omi-batch-record-dead-letter-volume` (agent); existing pending dwell page | `BATCH_HELD_DEAD_LETTER_ENABLED` (true) | False preserves ordinary defer; no custody/audio/conversation writes; private OIDC requeue-record |
 | `batch:ready` | `J:Scheduler.enqueue_in_transaction`, `J:Scheduler.requeue_quarantined_in_transaction` | `J:Scheduler._pull_shard.commit` | none | T | T | No held-specific switch | Existing queue/ownership fences |
 | `batch:leased` | `J:Scheduler._pull_shard.commit` | `J:Scheduler.complete`, `J:Scheduler.recover` | `lease_until` | T | T | No held-specific switch | Token-fenced lease expiry |
</file context>
Suggested change
| `batch:record_pending` | `utils/batch_pipeline/live.py:register_recording` | Normal record admission; `utils/batch_pipeline/live.py:drain_recordings` defer CAS → retained `dead` for aged barrier refusal | `record_dead_letter_deadline_at`, stamped on first literal barrier failure; 14 days, including old rows | `omi_batch_record_dead_letter_total`, `omi_batch_record_dead_letter_units`, `omi_batch_record_dead_letter_observed_at_seconds`; existing pending dwell | `omi-batch-record-dead-letter-volume` (agent); existing pending dwell page | `BATCH_HELD_DEAD_LETTER_ENABLED` (true) | False preserves ordinary defer; no custody/audio/conversation writes; private OIDC requeue-record |
| `batch:record_pending` | `utils/batch_pipeline/live.py:register_recording` | Normal record admission; `utils/batch_pipeline/live.py:drain_recordings` defer CAS → retained `dead` for aged barrier refusal | `record_dead_letter_deadline_at`, stamped on first literal barrier failure; 14 days, including old rows | No dead-letter dwell metric; `omi_batch_record_dead_letter_total` is inflow, `omi_batch_record_dead_letter_units` is stock, and `omi_batch_record_dead_letter_observed_at_seconds` is freshness; existing pending dwell | `omi-batch-record-dead-letter-volume` (agent); existing pending dwell page | `BATCH_HELD_DEAD_LETTER_ENABLED` (true) | False preserves ordinary defer; no custody/audio/conversation writes; private OIDC requeue-record |


David's 2026-11-07 16:24Z ruling (bus de6f03 and addendum c5c481) authorizes
code-owned settlement, with retained audio/custody and no provider replay.
The owner is omi-pipeline. [CONTRACT.md](../../../utils/batch_pipeline/CONTRACT.md)

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 note assigns ownership to omi-pipeline, contradicting the linked contract and flag registry, which name uicleanup (omi-lifecycle) as owner. Correct the owner here or explicitly distinguish system ownership from operational ownership.

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/changes/2026-11-07-pipeline-settle.md, line 5:

<comment>This note assigns ownership to `omi-pipeline`, contradicting the linked contract and flag registry, which name `uicleanup (omi-lifecycle)` as owner. Correct the owner here or explicitly distinguish system ownership from operational ownership.</comment>

<file context>
@@ -0,0 +1,43 @@
+
+David's 2026-11-07 16:24Z ruling (bus de6f03 and addendum c5c481) authorizes
+code-owned settlement, with retained audio/custody and no provider replay.
+The owner is omi-pipeline. [CONTRACT.md](../../../utils/batch_pipeline/CONTRACT.md)
+owns shapes, fences, rollback, metrics and the Firestore cost model.
+
</file context>
Suggested change
The owner is omi-pipeline. [CONTRACT.md](../../../utils/batch_pipeline/CONTRACT.md)
The operational owner is uicleanup (omi-lifecycle). [CONTRACT.md](../../../utils/batch_pipeline/CONTRACT.md)

Git-on-my-level and others added 7 commits November 8, 2026 05:32
# Conflicts:
#	backend/tests/unit/test_record_drain_barrier_backoff.py
# Conflicts:
#	backend/charts/monitoring/gmp-query-migration-inventory.json
…rics

The settle change passed service.metrics unconditionally; a service without
metrics (tests' stand-in, any minimal serving) raised before draining.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…wn gap

The worker image carries projection_release but never runs the release scan
(serving maintenance leader only), so the flag is not executed there.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
lead2 f5a331: ghost settle was tripped off after its branch bypassed
_target_restorable (unpersisted live targets failed at the head of owner chains).
Revert every ghost runtime/config hunk to main (listen values, runtime_env,
prod overlay, known gap, cohost diff, classification, flag rows); the change
note records that ghost ON waits for the _target_restorable fix and a head_error
baseline. Record dead letter, assignment expiry and the code-side
ghost-before-expiry ordering are unchanged.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 920bb5b into main Nov 8, 2026
59 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/pipeline-settle branch November 8, 2026 04:24
Git-on-my-level added a commit that referenced this pull request Nov 8, 2026
…d projections (#24898)

## What
Two changes to the ghost-settle release path (default OFF flag
BATCH_PIPELINE_PROJECTION_GHOST_SETTLE_ENABLED, currently tripped OFF in
prod):

1. **Fail closed on the record target.** The ghost branch skipped the
`_target_restorable` fence the normal release applies. In window 2 about
29% of settled rows (no target 45, deleted 2, discarded 5, processing 1
of 185) were rows the normal release would have refused, and
omi-pipeline reported owner-chain `head_error` stops
(SyncAssignmentConflict LIVE_TARGET_NOT_PERSISTED). The settle
transaction now calls `_target_restorable` before writing; new skip
class `target_not_restorable`.
2. **Wake settled rows.** Settled rows sit at the oldest end of the
committed_at-ordered follow-up cursor and complete only when it wraps
the backlog (hours). After a successful settle the settled segment ids
are handed to the existing tail channel `Projector.owe_followups`
(bounded 256, behind the current discovery page). No committed_at
re-stamp, no new index, no new job type. Kill switch
`BATCH_PIPELINE_PROJECTION_GHOST_SETTLE_WAKE_ENABLED` (default on; only
effective when ghost settle itself runs). Wake lost on process death
falls back to cursor wrap.

## Safety
Completion fences re-run at completion time (source_deleted,
conversation_deleted, BatchPrivacyBlocked); tests cover a deleted or
privacy-blocked settled id being refused at completion and publishing
nothing. Settle cap (16/pass), 24h floor and count_only unchanged.
`release()` otherwise untouched (open #24884 changes it; merge in either
order).

## Tests
Release and follow-up unit tests (137 pass locally), Firestore driver
tests for the new skip class and wake, registry consistency.

## Rollback
`BATCH_PIPELINE_PROJECTION_GHOST_SETTLE_WAKE_ENABLED=false` disables the
wake; the settle flag stays OFF.

Failure-Class: new

Line-Count-Exception: backend/utils/batch_pipeline/projection.py | 1720
-> 1723 | three lines to hand settled ids to owe_followups behind the
kill switch; the logic lives in the release module

🤖 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/24898?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/24898?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24898&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 added a commit that referenced this pull request Nov 8, 2026
Brings #24884 (920bb5b: record barrier dead letter, assignment-hold expiry
via _expire_assignment) onto the backlog state machine.

Code conflicts, resolved in favor of this branch while main's paths run
unchanged with the backlog switches off:
- utils/batch_pipeline/live.py: keep main's record_barrier_aged dead letter
  and its robust age; class 4 (RECORD_PENDING_BARRIER_DEAD_LETTER_ENABLED,
  default off) owns present-but-unfinished rows only while on, and main's
  dead letter is skipped just for those rows. BARRIER_NOT_CLOSED now comes
  from config.record_audio (main).
- database/batch_pipeline_projection_release.py: take main's
  _expire_assignment; the class 6 counter and terminal stop move into it,
  and both call sites return expired_rearm_exhausted as well.
- utils/batch_pipeline/held_dead_letter.py: keep both imports.

Generated files (additive, both sides kept, regenerated from sources):
backend/charts/monitoring/alert-rules.json,
backend/charts/monitoring/gmp-query-migration-inventory.json,
backend/docs/feature-flag-registry.md.

BATCH_PIPELINE_PROJECTION_GHOST_SETTLE_ENABLED is unchanged (main's code
default). New test file tests/unit/test_backlog_main_paths_switches_off.py
proves main's two paths are byte-identical with every new switch off and
each new path runs only with its switch on.
Git-on-my-level added a commit that referenced this pull request Nov 8, 2026
…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)
Git-on-my-level added a commit that referenced this pull request Nov 24, 2026
…PL-487/482) (#24963)

## What changed and why

A record whose capture barrier stays open needs bounded retries and a
recoverable terminal state without releasing audio custody. Follow-up to
#24884 and #24863: add the same production-drainer and reason-bound
requeue contract on legacy Firestore, replacement Postgres and the
simulator, covering parity rows **PL-487/PL-482**.

The suite pins a full nonrenewing expiry window, exact deadline
settlement, malformed deadline refusal, stale selection leases, current
account/conversation/generation privacy fences, idempotent requeue and
complete custody/policy preservation. It also proves age-based barrier
delays, discovery at the retry deadline and both kill switches. Only
audio admission and the drainer clock are injected; Store discovery,
transactions and privacy checks remain real.

The existing emulator runner executes the suite. Its
`*_emulator_test.py` path matches the existing workflow trigger, so
future test-only changes still select the proof. CI requires simulator
and emulator; full local qualification requires
`OMI_REQUIRE_STORE_BACKENDS=all`. No serving implementation,
configuration, workflow, language gate or firmware changes.

## Product invariants affected

none

## How it was verified

- Simulator: 27 passed / zero skips or expected failures.
- All-required simulator/Firestore/Postgres matrix: **80 passed, one
strict expected failure, zero skips**. The unannotated run first
reproduced 80 passes / one failure.
[#24960](#24960) tracks
Postgres rejecting a legacy boolean enqueue age in its generated-column
cast. The strict annotation accepts only that exact SQL error; PL-482
remains incomplete. Every PL-487 case passes on all stores.
- The existing full emulator runner passed every pre-existing group; its
sole initial failing group was the new boolean-age case. The corrected
new suite passes as qualified above.
- `make preflight` passed all 34 selected checks. The ordinary
final-commit push gates pass, including full backend typecheck (zero
errors).
- Three in-memory mutations fail at their intended assertions (renewed
expiry, stale expiry, flattened retry); a simulated repaired boolean
backend produces strict XPASS. Production files stay unchanged.

Measured layer: local synthetic store conformance, not a deployed
migration or physical audio erasure.

## Tests

`backend/scripts/record_dead_letter_emulator_test.py`;
`backend/scripts/run-emulator-proofs.sh` runs it with the mandatory
backend matrix. Missing required infrastructure fails.

## UI evidence

UI-Evidence: none -- test-only backend conformance.

## Failure class (fixes)

Failure-Class: none

## New guards

The merged #24884 recording-settlement change and #24863 barrier-retry
incident motivate this regression contract. It extends the existing
shared Store harness around the production drainer and requeue instead
of adding another state authority or standalone gate.




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

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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