Skip to content

fix(pusher): abandon evicted tokens and tune closed-drain cap - #24689

Merged
Git-on-my-level merged 5 commits into
mainfrom
pusher-abandon-evicted-tokens
Nov 5, 2026
Merged

Git-on-my-level merged 5 commits into
mainfrom
pusher-abandon-evicted-tokens

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Problem

Capacity eviction cancels a closed pusher drain but leaves its exact upload token alive until pod restart, stalling record_pending. The supplied investigation reported 1829+ capacity evictions since 02Z; this is incident evidence supplied with the task, not a refreshed production measurement. Implements lead2 88ba4d (GO, one PR) and Luna's overflow FIX-FIRST ruling.

Design

  • Cancel the same worker at closed-drain capacity. An admitted process coordinator waits for worker settlement and every socket storage/record-barrier executor future, including timed-out metadata and cancellation racing a late registration response.
  • Transactionally add abandoned_at to each exact remaining token owned by that socket, including its own pending clear. Inherited pending clears from another socket are excluded. Writes are idempotent, tolerate absent/deleted rows, and retry _close_metadata admission/refusal with bounded exponential jitter while the process lives. Process death retains the existing dead-pod fallback.
  • Remove recovery hints at eviction, including coordinator refusal. Normal token clears refuse abandoned tokens, including stale recovery snapshots. A new reconnect token stays live.
  • Producer proof accepts finite abandoned_at >= process_started_at without pod proof. Live non-abandoned and legacy tokens keep their rules. Repair still requires list_audio_chunks(require_archive=True), retained-tail validation against finish, transaction state checks and the unchanged privacy write gate before sealing. Abandonment never certifies a projected tail.
  • Bound overflow coordinators independently. Full admission starts no new task or abandon write, preserves the durable token fence for existing process/pod-death repair, and logs event=record_closed_finish outcome=abandon_overflow. Removing its local hint prevents a later successful producer from certifying this still-running writer. Completion releases coordinator admission.
  • Bound actual durable custody/projection storage submissions in a dedicated pool with no extra admission queue. Projection waits with receipts only, then hydrates/uploads/refreshes inside one admitted leaf. Actual future completion owns the slot despite cancellation. PCM-bearing custody refuses saturation before ACK so the client's WAL retains custody. Overflow refusal cannot accumulate an unbounded executor queue of PCM.
Setting Default / bounds Prod source values
PUSHER_MAX_CLOSED_RECORD_DRAINS 32 / 8..128 64
PUSHER_MAX_ABANDON_RECORD_DRAINS 4 / 0..16 4
PUSHER_RECORD_STORAGE_WORKERS 4 / 1..8 4

Invalid values use defaults. Prod Helm values, source overlay and generated runtime manifest agree. Startup logs report the selected bounds. The production memory limit remains 3.5 GiB; 128 closed drains remains rejected for production.

Each admitted storage leaf has at most 20 MiB canonical PCM: 4 * 20 = 80 MiB, independent of 64 closed workers and four metadata coordinators. Source/slice/join/codec/encryption copies can coexist; the runbook reserves an unmeasured eightfold planning allowance of 640 MiB for this work. Live ingress, other executors, SDK buffers and Python overhead are additional. This bounds detached recording work, not total RSS; the canary memory gate remains required.

The lifecycle writer inventory declares abandon_record_upload_session.commit as the conditional automatic capturing-to-abandoned exit and as the abandoned entry. Refused overflow stays capturing/fenced with the old death-proof exit. abandoned_at is an age anchor, not a deadline; metadata attempt deadlines/backoff are not end-to-end repair deadlines. Missing abandoned-token deadline, dwell metric and alert remain declared strict xfails. No guard is weakened.

Kill switches, rollback and pusher-train ramp

PUSHER_ABANDON_EVICTED_TOKENS=off restores cancel-and-strand; on unless explicitly off. Roll back the closed cap separately with PUSHER_MAX_CLOSED_RECORD_DRAINS=32. Coordinator cap 0 also refuses all new abandonment coordination; keep storage admission bounded.

Ship pusher only, off-peak, with the standard drain. Start one canary pod at 64. The pusher rollout lead reviews per-pod memory p99 against 3.5 GiB, record_closed_finish outcome=capacity, outcome=abandoned, outcome=abandon_overflow, and seal repair's upload_pending before fleet expansion. Review throughput/backpressure with the reduced storage concurrency. This PR does not merge, deploy, change live capacity or read/write production data. No GCP tier used.

Validation

  • Outbox, abandon, producer-proof, seal-repair, audio-seal, barrier-executor and queue-wait suites: 270 passed. Includes eight closing workers under stalled storage, bounded actual PCM weak references/coordinators, refusal fencing, a later producer unable to clear old tokens or seal, capacity reuse, error traceback cleanup, and real WebSocket cleanup with coordinator cap zero and kill switch off.
  • Lifecycle writer/invariant suites: 893 passed, 71 strict xfailed.
  • Extended seal/sweeper/worker, executor and co-host fixtures: 407 passed; the executor inventory was updated for the new pool and its 35-test suite rerun.
  • Hermetic deployment fixtures: 453 passed. Async blocker scan: 0 selected findings.
  • Independent Luna review: GO, after removing recovery hints on coordinator refusal. A recovery snapshot already held by another socket is preexisting behavior outside this bounded follow-up's review; the regression covers refusal followed by a new reconnect.
  • make preflight: 53 checks passed. Final normal pre-push hooks passed all 53 checks on the committed head, full backend type checking (0 errors), selected file-isolated unit tests, runtime checks and OpenAPI compatibility. No hooks, timeouts or guards were skipped or loosened.

Product invariants affected

  • INV-MEM-4 preserved: shared runtime changes are pusher drain/storage admission controls and the abandon kill switch; canonical intake, consolidation, promotion admission and projection authority are unchanged.
  • INV-CAP-1 preserved: accepted audio retains durable custody.

Failure-Class: none
No registered class covers a live-process producer fence stranded by capacity cancellation; the completion tracker and route/repair/stall regressions provide reusable guards.

Line-Count-Exception: backend/routers/pusher.py | 1832 -> 1897 | Wire session-scoped executor settlement and bounded storage admission into existing socket ownership; hydrate, upload and refresh receipts in a single admitted leaf to prevent detached PCM queue growth.

View guided diff Turn on auto-fix

🤖 Generated with Claude Code

Attest only the evicted socket's owned tokens after its worker and all storage/barrier futures settle. Keep repair's retained-tail proof and reconnect fences; make the closed-drain cap configurable with prod values 64.

Failure-Class: none
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 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-05T10:40:51.518640Z 0c972eb 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.

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

6 issues found across 21 files

Confidence score: 3/5

  • In executors.py, setting PUSHER_ABANDON_EVICTED_TOKENS=off still leaves tracked storage and record-barrier futures shielded, so it does not restore the old cancellation behavior. Make the shielding conditional on the flag.
  • The production values in prod_omi_pusher_values.yaml reach all pusher pods because the HPA has minReplicas: 12; this is not a canary rollout. Stage the env values separately before enabling them across the fleet.
  • The retry cadence in audio-durable-outbox.md conflicts with the exponential-backoff contract in the pipeline design doc. Align the runbook with that contract.
  • The tests leave two behaviors unclear: the proof boundary at abandoned_at == process_started_at, and whether late I/O completes after owners settle. Add the boundary case and assert the completed write in test_audio_durable_outbox.py.
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/docs/listen_pusher_pipeline/changes/2026-11-05-pusher-abandon-evicted-tokens.md">

<violation number="1" location="backend/docs/listen_pusher_pipeline/changes/2026-11-05-pusher-abandon-evicted-tokens.md:14">
P3: This note repeats the env var defaults, the 8..128 clamp, and the retry contract, which the change-notes README says belong only in the pipeline doc. Trim these details to a link to the section 8 contract so the values are not duplicated across the note, runbook, and registry.</violation>
</file>

<file name="backend/docs/runbooks/audio-durable-outbox.md">

<violation number="1" location="backend/docs/runbooks/audio-durable-outbox.md:101">
P2: The runbook describes transient close metadata retries as a fixed one-second cadence. The pusher design doc in `listen_pusher_pipeline.mdx` describes per-close exponential backoff with jitter (1–2s initially, capped at 30–60s). Align the runbook's retry description with the pusher design doc, or state which retry applies to close metadata and which applies to admission.</violation>
</file>

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

<violation number="1" location="backend/tests/unit/test_record_producer_proof.py:123">
P3: The boundary is untested: nothing asserts that `abandoned_at` equal to `process_started_at` proves dead. Add a positive case for 900 next to the rejection cases, and rename the test so it does not call the too-early 899 value 'malformed'.</violation>
</file>

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

<violation number="1" location="backend/tests/unit/test_audio_durable_outbox.py:1904">
P3: `assert writes == []` is vacuous: `late_io` cannot append until `release` is set, which happens after this line. Assert the completed write after the owners settle instead, e.g. `assert writes == [stage]` in the `kill_switch == 'on'` branch after the `gather`.</violation>
</file>

<file name="backend/utils/executors.py">

<violation number="1" location="backend/utils/executors.py:515">
P2: The `PUSHER_ABANDON_EVICTED_TOKENS=off` kill switch does not restore the old cancel behavior here. `run_blocking` shields tracked storage and record-barrier futures unconditionally, and `routers/pusher.py` always opens the tracker scope. Queued work now keeps running after socket cancellation even when the switch is off. Gate tracking on the same switch, for example by having `track_executor_future` or `ExecutorFutureTracker.scope()` no-op when the env var is `off`.</violation>
</file>

<file name="backend/charts/pusher/prod_omi_pusher_values.yaml">

<violation number="1" location="backend/charts/pusher/prod_omi_pusher_values.yaml:118">
P2: These production env entries roll out to all pusher pods, not one canary: the chart’s HPA has `minReplicas: 12`. Use a separate canary Deployment/selector or otherwise stage the env values before enabling them in the fleet-wide chart.</violation>
</file>

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

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

`PUSHER_ABANDON_EVICTED_TOKENS` on (anything except `off`), a tracked coordinator
waits for the worker and every socket storage/barrier executor future, then marks
each exact owned token `abandoned_at` and forgets its recovery hint. The immutable
receipts and token remain for repair. Inherited pending clears from another socket are excluded because its writer settlement is not proven by this eviction. Admission refusal/failure retries with

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 runbook describes transient close metadata retries as a fixed one-second cadence. The pusher design doc in listen_pusher_pipeline.mdx describes per-close exponential backoff with jitter (1–2s initially, capped at 30–60s). Align the runbook's retry description with the pusher design doc, or state which retry applies to close metadata and which applies to admission.

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/runbooks/audio-durable-outbox.md, line 101:

<comment>The runbook describes transient close metadata retries as a fixed one-second cadence. The pusher design doc in `listen_pusher_pipeline.mdx` describes per-close exponential backoff with jitter (1–2s initially, capped at 30–60s). Align the runbook's retry description with the pusher design doc, or state which retry applies to close metadata and which applies to admission.</comment>

<file context>
@@ -93,13 +94,23 @@ Transient close metadata errors keep retrying at the drain's one-second cadence,
+`PUSHER_ABANDON_EVICTED_TOKENS` on (anything except `off`), a tracked coordinator
+waits for the worker and every socket storage/barrier executor future, then marks
+each exact owned token `abandoned_at` and forgets its recovery hint. The immutable
+receipts and token remain for repair. Inherited pending clears from another socket are excluded because its writer settlement is not proven by this eviction. Admission refusal/failure retries with
+bounded exponential jitter while the process lives. Abandonment proves stoppage,
+never tail durability: repair still requires archive discovery, retained-tail
</file context>

# Backpressure stays in the async caller, without occupying another worker.
await asyncio.sleep(0.05)
result = await future
result = await asyncio.shield(future) if track_executor_future(executor, future) else await future

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 PUSHER_ABANDON_EVICTED_TOKENS=off kill switch does not restore the old cancel behavior here. run_blocking shields tracked storage and record-barrier futures unconditionally, and routers/pusher.py always opens the tracker scope. Queued work now keeps running after socket cancellation even when the switch is off. Gate tracking on the same switch, for example by having track_executor_future or ExecutorFutureTracker.scope() no-op when the env var is off.

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/executors.py, line 515:

<comment>The `PUSHER_ABANDON_EVICTED_TOKENS=off` kill switch does not restore the old cancel behavior here. `run_blocking` shields tracked storage and record-barrier futures unconditionally, and `routers/pusher.py` always opens the tracker scope. Queued work now keeps running after socket cancellation even when the switch is off. Gate tracking on the same switch, for example by having `track_executor_future` or `ExecutorFutureTracker.scope()` no-op when the env var is `off`.</comment>

<file context>
@@ -461,7 +512,7 @@ async def run_blocking(executor: ThreadPoolExecutor, fn: Callable[P, T], *args:
                 # Backpressure stays in the async caller, without occupying another worker.
                 await asyncio.sleep(0.05)
-        result = await future
+        result = await asyncio.shield(future) if track_executor_future(executor, future) else await future
     finally:
         if token is not None:
</file context>


env:
# lead2 88ba4d: pusher train, canary one pod before fleet expansion.
- name: PUSHER_MAX_CLOSED_RECORD_DRAINS

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: These production env entries roll out to all pusher pods, not one canary: the chart’s HPA has minReplicas: 12. Use a separate canary Deployment/selector or otherwise stage the env values before enabling them in the fleet-wide chart.

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/pusher/prod_omi_pusher_values.yaml, line 118:

<comment>These production env entries roll out to all pusher pods, not one canary: the chart’s HPA has `minReplicas: 12`. Use a separate canary Deployment/selector or otherwise stage the env values before enabling them in the fleet-wide chart.</comment>

<file context>
@@ -114,6 +114,11 @@ envFrom:
 
 env:
+  # lead2 88ba4d: pusher train, canary one pod before fleet expansion.
+  - name: PUSHER_MAX_CLOSED_RECORD_DRAINS
+    value: "64"
+  - name: PUSHER_ABANDON_EVICTED_TOKENS
</file context>

validation and privacy transaction gate. A new reconnect token remains live;
normal clears cannot remove an abandoned token from a stale recovery snapshot.

`PUSHER_ABANDON_EVICTED_TOKENS` is on unless set to `off`. Metadata admission

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 repeats the env var defaults, the 8..128 clamp, and the retry contract, which the change-notes README says belong only in the pipeline doc. Trim these details to a link to the section 8 contract so the values are not duplicated across the note, runbook, and registry.

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-05-pusher-abandon-evicted-tokens.md, line 14:

<comment>This note repeats the env var defaults, the 8..128 clamp, and the retry contract, which the change-notes README says belong only in the pipeline doc. Trim these details to a link to the section 8 contract so the values are not duplicated across the note, runbook, and registry.</comment>

<file context>
@@ -0,0 +1,31 @@
+validation and privacy transaction gate. A new reconnect token remains live;
+normal clears cannot remove an abandoned token from a stale recovery snapshot.
+
+`PUSHER_ABANDON_EVICTED_TOKENS` is on unless set to `off`. Metadata admission
+refusal and write failures retry with bounded exponential jitter while the
+process lives. Death mid-abandon falls back to the existing dead-pod proof.
</file context>

)


@pytest.mark.parametrize('abandoned', [None, True, '950', float('nan'), float('inf'), 899])

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: The boundary is untested: nothing asserts that abandoned_at equal to process_started_at proves dead. Add a positive case for 900 next to the rejection cases, and rename the test so it does not call the too-early 899 value 'malformed'.

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

<comment>The boundary is untested: nothing asserts that `abandoned_at` equal to `process_started_at` proves dead. Add a positive case for 900 next to the rejection cases, and rename the test so it does not call the too-early 899 value 'malformed'.</comment>

<file context>
@@ -109,6 +109,24 @@ def test_absence_inventory_must_postdate_process_start_uncertainty(load):
+    )
+
+
[email protected]('abandoned', [None, True, '950', float('nan'), float('inf'), 899])
+def test_malformed_abandon_attestation_never_proves_dead(load, abandoned):
+    token = {'t': {'pod': 'live', 'process_started_at': 900, 'abandoned_at': abandoned}}
</file context>

try:
await asyncio.wait_for(entered.wait(), 5)
await asyncio.wait_for(handler, 5)
assert writes == []

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: assert writes == [] is vacuous: late_io cannot append until release is set, which happens after this line. Assert the completed write after the owners settle instead, e.g. assert writes == [stage] in the kill_switch == 'on' branch after the gather.

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_audio_durable_outbox.py, line 1904:

<comment>`assert writes == []` is vacuous: `late_io` cannot append until `release` is set, which happens after this line. Assert the completed write after the owners settle instead, e.g. `assert writes == [stage]` in the `kill_switch == 'on'` branch after the `gather`.</comment>

<file context>
@@ -1861,6 +1861,68 @@ async def drain():
+    try:
+        await asyncio.wait_for(entered.wait(), 5)
+        await asyncio.wait_for(handler, 5)
+        assert writes == []
+        token = barrier.upload_sessions['conversation']
+        assert 'abandoned_at' not in client.rows[path]['record_upload_sessions'][token]
</file context>

Git-on-my-level and others added 4 commits November 5, 2026 16:23
Inventory the exact record_upload_sessions writer and the conditional capturing-to-abandoned transition. Preserve retained-tail repair and declare missing abandoned-state deadline, dwell gauge, and alert as strict-xfail gaps.

Failure-Class: none
The late IO blocks on release.wait(10), so the deadlines still expire
deterministically. Test-only; satisfies test_no_new_tiny_real_clock_budgets.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 015fe4f into main Nov 5, 2026
66 of 68 checks passed
@Git-on-my-level
Git-on-my-level deleted the pusher-abandon-evicted-tokens branch November 5, 2026 11:04
Git-on-my-level added a commit that referenced this pull request Nov 5, 2026
…l (#24689b) (#24699)

## Problem

#24689 was rolled back after its dedicated queue-zero recording storage
pool saturated live custody and killed sockets. This is the forward
follow-up (#24689b) to restore the original shared-storage route while
keeping the eviction lifecycle fix (lead2 ruling `8fea2c`).

## Change

- Keep exact-token `abandoned_at` writes after worker and executor
settlement, producer proof, recovery-hint removal, reconnect isolation,
and lifecycle table/writer invariants.
- Keep prod `PUSHER_MAX_CLOSED_RECORD_DRAINS=64`,
`PUSHER_MAX_ABANDON_RECORD_DRAINS=4`, and the default-on kill switch
`PUSHER_ABANDON_EVICTED_TOKENS` (`off` restores cancel-and-strand; cap
32 is an independent rollback).
- Remove the dedicated durable-storage pool, `executor_overrides`,
receipt-only saturation exception, pool-specific PCM-refusal-before-ACK
path, `PUSHER_RECORD_STORAGE_WORKERS`, its
chart/runtime/overlay/registry entries, and pool-only tests/docs.
Durable custody, reads, upload and refresh again use the unchanged
shared `storage_executor` (128 workers) with the original queue
behavior. No new pool sizing.
- Keep actual-future tracking and cancellation shielding: queued and
running shared-storage work must settle before abandonment. Regression
coverage includes queued work, eight concurrent shared-storage writers,
the four-coordinator limit, overflow refusal, late upload/refresh, exact
tokens, and kill-switch off.

## Rollout gate (operator follow-up)

Use the standard pusher train with one canary pod held for 15 minutes.
Before fleet roll, require socket kills <=15/15min and memory p99 <75%
of the unchanged 3.5 GiB limit. Also inspect
capacity/abandoned/abandon_overflow outcomes and repair upload_pending.
This PR does not authorize or perform merge/deploy.

## Validation

All test commands ran with `GOOGLE_APPLICATION_CREDENTIALS`,
`CLOUDSDK_CONFIG`, `CLOUDSDK_CORE_PROJECT` and `GOOGLE_CLOUD_PROJECT`
unset, through `~/workspace/omi/bin/omi-heavy run --` and this
worktree's `backend/.venv`.

- Isolated `backend/.venv/bin/python -m pytest -q` per file from
`backend/`: `test_pusher_record_abandon.py` (20),
`test_audio_durable_outbox.py` (102), `test_executors.py` (36),
`test_pusher_queue_wait.py` (28), `test_record_producer_proof.py` (17),
`test_record_seal_repair.py` (39), `test_lifecycle_invariants.py` (214
passed, 69 existing declared xfails),
`test_lifecycle_state_table_writers.py` (682). Total: 1,138 passed, 69
expected failures.
- Config contracts: isolated `pytest -q` on
`test_backend_runtime_env_validator.py`,
`test_render_backend_runtime_env.py`,
`test_verify_pusher_cohost_env_diff.py`,
`test_verify_pusher_config_references.py`,
`test_runtime_env_manifest_compat.py`, `test_config_train.py`: 390
passed.
- `backend/.venv/bin/python
scripts/test_check_feature_flag_registry.py`: 46 passed; regenerated the
registry with `scripts/render_feature_flag_registry.py`.
- `PATH="$PWD/backend/.venv/bin:$PATH" bash
backend/scripts/pre-deploy-check.sh` (hermetic mode): 453 pytest tests
and 36 source-admission fixtures passed; dev/prod manifests and source
contracts passed.
- `make preflight`: 52 checks passed on final head (417.40s), after
adding the required `INV-MEM-4` citation to this body.
- `scripts/pr-preflight --pr-body-file
/Volumes/Ephemeral/scratch/abandonb-pr-body.md`: 52 checks passed on
retry (204.41s); metadata-only validation also passed all 4 checks. The
earlier concurrent run hit the unchanged Firestore query-shape file's
300-second wall timeout; the same guard subsequently passed without cap
or timeout changes in make preflight, the normal pre-push hook, and this
standalone retry.
- Grok review via `agentctl-portable` / `cursor-delegation`: no findings
on the full change at `bdc86e85af19`, then no findings on the only
follow-up delta through final head
`e07fe915a2b009d70abe144e88199bf2aee0e9f2`. Runs:
`exec-latin-churn-tomorrow-final-tragic-adapt` plus native continuation.
The reviewer could read files but not execute terminal commands; parent
independently verified the Git diffs, all 26 original files,
shared-executor behavior, and test results.
- Normal pre-push hook: passed on
`e07fe915a2b009d70abe144e88199bf2aee0e9f2`, including 52 shared
preflight checks, full backend type checking (0 errors), the existing
bounded selection of four changed test files, runtime env/source
closure, and OpenAPI compatibility. Branch pushed normally; no bypass,
force, cap or timeout changes.

Not measured: production socket kills, memory p99/RSS, canary behavior,
fleet throughput, deployed playback, or installed-client WAL behavior.
Count caps do not establish a retained-PCM byte budget.

## Product invariants affected

- INV-MEM-4: the runtime manifest only removes the recording pool
setting; canonical intake, promotion, projection acknowledgements and
privacy fences retain their existing authorities.

Failure-Class: none

This change removes the incident's dedicated-pool admission boundary and
restores the existing shared executor primitive; no new guard or
failure-class registry change is introduced.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/24699?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/24699?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24699&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 6, 2026
## What changed and why

Add process-wide non-waiting admission for custody PCM queued/running on
the existing storage executor. PR-A #24788 supplied the gauges and
pressure alerts. This PR adds admission, bounded refusal/error counters,
an agent-tier refusal alert, hermetic saturation tests and the runbook.
**The flag remains 0 everywhere.**

A full budget returns before submission, without a receipt, commit
callback or opcode-203 ACK. It never raises into receive supervision or
selects a close code. Original PCM, exact checkpoints, owner and start
remain charged to the socket's existing 20 MiB budget. **The first live
refusal immediately pauses intake** in that same cancellable receive
task; it probes every 50 ms until the window commits, before reading
another frame. Refusals cannot accumulate windows toward socket byte
exhaustion. There is no extra retry task or global waiter list. Enabled
windows cap at 4096 checkpoints.

Live admission uses 75% of the total; shutdown tails may use the full
limit and bypass the intake pause. A full tail returns without an ACK
and retains its producer fence. Outer-handler cancellation interrupts a
paused receive task but skips the cancellation-time tail commit
entirely. Connected or disconnected, this path submits no storage,
produces no receipt and sends no ACK; the held producer fence and client
WAL replay own recovery. Cleanup cannot wait for a new PCM storage
operation or its retries. Already-submitted storage still holds its
reservation until actual settlement and cannot send a late ACK. The
existing external-cancellation close classification is preserved. Record
begin/fail/seal/abandon/markers and projection operations remain
ungated; executor pools are unchanged. Known-deleted retained owners use
the existing gone-owner disposition. Every unresolved owner stays fenced
in finalization: A's receipt cannot certify B's uncommitted tail.

Acquire faults roll back partial mutation and fail open using flag-0
storage dispatch. Release faults retire exactly their own reservation
and are swallowed. Acquire fail-open also calls the shared fallback
helper for every fault; the caller owns the rate-limited warning. Both
acquire/release errors use `omi_pusher_storage_pcm_errors_total{reason}`
through the enum helper and logs limited to one per reason per minute.
Late post-cancellation storage failures are counted/logged through the
same bounded path. Enabled capacity remains held until actual storage
settlement, including caller cancellation.

Flag 0 preserves successful PCM/checkpoint/receipt/opcode-203 bytes,
storage dispatch/cancellation and observational gauge semantics. It does
**not** promise identical failure finalization: the new finalizer can
still hold unresolved fences and defer inline finish after genuine
failures at flag 0. Genuine storage-error handling remains in effect.

## Flag, ramp and rollback

`PUSHER_STORAGE_PCM_BUDGET_MB=0` is off / kill switch in code, manifests
and dev/prod charts. Enabled deployment values must be >=27 MiB: ceil(20
MiB x 4/3), so an idle live lane admits any legal socket window.
Smaller/malformed unvalidated startup values select off. Proposed canary
size: 512 MiB (384 MiB live / 128 MiB reserved).

Separate approved enablement train, owner uicleanup (omi-lifecycle): dev
chart -> one canary pod for 15 minutes with socket kills <=15/15min and
memory p99 <75% of 3.5 GiB; inspect refusals, accounting/GCS errors and
capacity/abandon outcomes -> fleet within one day of a clean canary, or
report the failed gate. Rollback: chart value 0 through ordinary
rollout, without rebuilding or changing custody objects/tokens. No
enablement, GCP access, PR merge or deploy in this task.

## Product invariants affected

INV-MEM-4: the runtime manifest adds only the pusher admission setting;
canonical memory admission/promotion authority is unchanged.

## How it was verified

- Test FIRST on base d478192: first run
2 passes / 1 strict xfail; expanded baseline 2 passes / 7 strict xfails.
Unbounded submitted bytes and missing refusal retention were expected
failures. Final tests have no xfail escape.
- Real commit helper/executor with event-controlled GCS: 50 producers,
512 KiB windows, synthetic 8 MiB budget, <=6 MiB live submissions and 38
refusals. Thirty further refusal probes preserve exact input without
increasing submissions; recovery commits all 50 once. Current/high-water
RSS plateaus, Python allocations fall and byte accounting drains. The
recorder retains digests, not PCM history. 50 x 4 KiB tails fit the
reserve during live saturation.
- Final focused delta: **38 saturation tests passed**. The real receive
loop is offered 30 full-minute windows while admission stays full for
>=30 probes: only the first enters, its byte charge stays below half the
socket limit, and there is no receipt/ACK/close. Recovery commits once;
cancellation keeps the original window/checkpoints and fence for WAL
replay without submitting a tail; a fully saturated normal tail keeps
its fence. Acquire/release exceptions before and after mutation preserve
another socket's reservation, still store/ACK, never close, increment
bounded counters and produce rate-limited logs. Late post-cancellation
failures are observed, counted and logged.
- Final focused validation: **168 saturation/queue-wait/outbox tests
passed** (38 + 28 + 102). New disconnected-peer and
event-stalled-storage cancellation cases complete cleanup within one
second without a new storage call, receipt or ACK; original
PCM/checkpoints and producer fences remain intact. Already-submitted
storage keeps its byte reservation until actual completion and releases
exactly once without a late ACK, on success or failure. Earlier
validation passed **362 surrounding tests**, including the closed-reason
guard, executors, metrics, alert contracts, abandonment and record
barriers. The earlier cancellation-flush behavior was removed after
focused review: cancellation of an admission pause now leaves the
unacknowledged window for WAL replay instead of starting storage during
cleanup. The final shared-fallback accounting check also passed all **4
cases**. Earlier broader implementation checks passed **456 offline
pre-deploy tests** and **55 make preflight checks**.
- Final normal pre-push **passed on
`2e94b0753d5c1951aa53a1c1110180d2a9dfbc63`**: all guards enabled,
approved 900-second file budget, two-check scheduling, zero type errors,
all 38 saturation cases and all 115 route-verifier cases rerun
successfully, OpenAPI compatibility and formatting passed. Final
metadata validation passed all 4 checks. [CI
checks](https://github.com/BasedHardware/omi/pull/24799/checks) track
the exact published head.
- Two parallel independent custody reviews, including Grok, were
completed with regressions for their findings. The final Luna FIX-FIRST
delta addresses both P1s (first-refusal pause and fail-open accounting),
plus the GLM documentation/late-failure observations. No further review
round requested; lead2 owns the focused delta review.

Not measured: listen re-offer cadence, projection-debt aggregate, GCS
client buffering, real sockets/pod, 48 kHz prevalence or production tail
distribution. The budget bounds submitted PCM, not total pod RSS;
allocator pages need not immediately return to the OS. No deployed
playback or installed-client WAL proof is claimed.

## Tests

Primary regression:
`backend/tests/unit/test_pusher_storage_pcm_saturation.py`; flag
declarations: `test_pusher_storage_pcm_config.py`; exact rendered
binding: `test_verify_pusher_config_references.py`. Heavy checks use
`bin/omi-heavy` with cloud credential/project variables unset. The
handoff-approved `BACKEND_UNIT_FILE_BUDGET_SECONDS=900` is used for the
Firestore guard, with no skipped guard.

## UI evidence

UI-Evidence: none -- backend admission/configuration only.

## Failure class (fixes)

Failure-Class: FC-cancel-path-unbounded-terminal-send

## New guards

Saturation/retention tests protect the socket-kill class exposed by
#24689: refusal cannot raise, close, trim PCM or falsely ACK. Long
refusal, accounting-fault, disconnected-peer cancellation and
stalled-storage cleanup regressions protect the review findings.
Cancelling admission skips storage and ACK while retaining the producer
fence for WAL replay.

Line-Count-Exception: backend/routers/pusher.py | 1872 -> 2032 | Keep
first-refusal intake control, fault isolation and producer-close proof
at the existing receive-loop custody seam; isolate transactional byte
accounting without pool or ACK refactors.
Line-Count-Exception: backend/utils/metrics.py | 1715 -> 1736 | Add and
zero-initialize bounded refusal and accounting-error counters alongside
the PR-A gauges.
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)
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