Skip to content

fix(pusher): preserve record seals through graceful drain - #24101

Merged
Git-on-my-level merged 6 commits into
mainfrom
lane/sealpusher
Oct 30, 2026
Merged

Git-on-my-level merged 6 commits into
mainfrom
lane/sealpusher

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

What changes

Pusher can lose the end of its 30-second background drain when uvicorn's 60-second graceful shutdown expires after the load balancer disconnects a session. Raise the pusher-only timeout to 90 seconds and document the 120-second pod budget. After successful durable-tail custody, wait for the existing conversation projection drain and attempt inline finish within one 20-second bound. Timeout retains the background close; RECORD_BARRIER_INLINE_FINISH=false restores background-only behavior. A shutdown-tail exception keeps the producer token and bounded local closure hold. It does not assert permanent custody loss: immutable objects can already exist when ACK delivery fails. Actual-drop paths retain their persistent failure markers. Custody, projection and metadata keep their order.

Expose refused seals through omi_pusher_record_seal_refused_total{reason} with four closed reasons. The generic batch-owned finalizer emits omi_record_register_refused_total and a content-free register_refused log when registration returns false. Finalizer behavior otherwise stays the same.

Firestore InvalidArgument projection rejection now drops refs without the sticky record_upload_failed marker, allowing the retained recording to seal. Emit the projection/invalid_argument reason and degraded fallback; class logs include only a closed gRPC status code, without exception messages or server metadata. This does not claim the exact rejected payload constraint is known.

Validation

  • Targeted backend unit shard: 243 passed across eight files, through BACKEND_PYTEST_WORKERS=1 BACKEND_UNIT_TEST_FILE_LIST=<file-list> bash backend/test.sh under omi-heavy/nice -n 19. Covers seal refusal paths, overlapping sessions, tail success/failure, post-commit ACK failure without a sticky marker, projection failure, bounded fallback, cancellation, kill switch, fifty-frame Firestore transaction count, InvalidArgument rejection, privacy-safe code logs and repeated isolated finalizer imports.
  • Focused CI-fix verification including slow clock-budget guardrail: 149 passed. The timeout stub expires its deadline explicitly; it does not shrink a real-clock budget. Registration telemetry is owned by the existing finalization telemetry module.
  • Hermetic backend E2E: bash backend/testing/e2e/run.sh under omi-heavy/nice -n 19: 175 passed, 3 skipped, 2 expected failures. External dependencies are fake; this does not measure production behavior.
  • make preflight with the supplied PR body: all 46 selected gates passed, including Firestore query guards, runtime image source closure, registry and pusher deployment contracts.
  • Exact backend bash backend/scripts/typecheck.sh: exit 0 after fixing the helper's enum narrowing.
  • No production access or deployment. Lead owns merge and the pusher train; the finalizer counter also requires backend-serving images to gain that signal there.

Product invariants: INV-DATA-1, INV-CAP-1 (preserved; no audio acknowledgement before durable custody).
Failure-Class: FC-pre-durability-audio-eviction
Line-Count-Exception: backend/routers/pusher.py | 1611 -> 1689 | Approved pusher shutdown handshake and deterministic projection rejection stay at their existing lifecycle boundary to preserve custody ordering.

Approved plan: D1 + A, including lead ruling f4e87a: inline finish must follow projection, within a bounded wait, with background fallback. Lead scope addition b7a4d7 includes invalidarg verdict section 4 items 1 and 2. No sweeper, data repair, IAM or workflow changes.

Count closed seal refusals and generic finalizer registration refusals.
Budget pusher graceful shutdown for LB disconnect and background drain.
Attempt bounded inline close only after durable custody and projection.
Preserve retained custody on deterministic Firestore projection rejection.

Failure-Class: FC-pre-durability-audio-eviction
Count closed seal refusals and generic finalizer registration refusals.
Budget pusher graceful shutdown for LB disconnect and background drain.
Attempt bounded inline close only after durable custody and projection.
Preserve retained custody on deterministic Firestore projection rejection.

Failure-Class: FC-pre-durability-audio-eviction
Count closed seal refusals and generic finalizer registration refusals.
Budget pusher graceful shutdown for LB disconnect and background drain.
Attempt bounded inline close only after durable custody and projection.
Preserve retained custody on deterministic Firestore projection rejection.

Failure-Class: FC-pre-durability-audio-eviction
Count closed seal refusals and generic finalizer registration refusals.
Budget pusher graceful shutdown for LB disconnect and background drain.
Attempt bounded inline close only after durable custody and projection.
Preserve retained custody on deterministic Firestore projection rejection.

Failure-Class: FC-pre-durability-audio-eviction
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 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-10-30T09:58:58.319186Z 62da28f Draft marked ready
ℹ️ 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.

Keep the counter in the existing finalization telemetry module so repeated
isolated finalizer loads do not duplicate Prometheus registration. Expire
the projection timeout test's deadline explicitly instead of racing a tiny
real-clock budget.

Failure-Class: FC-pre-durability-audio-eviction
@Git-on-my-level
Git-on-my-level marked this pull request as draft October 30, 2026 09:44
Hold closure locally after a shutdown tail exception. The immutable commit
can succeed before ACK delivery fails, so this arm must not assert durable
audio loss. Preserve the producer token and bounded local fail-closed state;
actual-drop paths retain their existing persistent failure marker.

Failure-Class: FC-pre-durability-audio-eviction
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review October 30, 2026 09:55
@Git-on-my-level
Git-on-my-level merged commit f436f88 into main Oct 30, 2026
63 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/sealpusher branch October 30, 2026 10:13
Git-on-my-level added a commit that referenced this pull request Oct 30, 2026
#24107)

Record-barrier Firestore retries currently occupy the shared DB pool
used by transcript and audio webhook consumers. The 2026-10-30 custody
verdict measured DB saturation at 24/24 after #24084, 121-163 session
closures/hour, and roughly 10k transcript queue drops/hour.

This isolates all four barrier dispatches (begin, clear, seal, failure
marker) on a monitored `record_barrier` executor: 16 workers, 64 queued
calls, asynchronous capacity waits. Existing pusher call sites inherit
the isolation without editing `routers/pusher.py` or #24101's seal
behavior. Shared DB capacity becomes 32 via
`PUSHER_DB_EXECUTOR_WORKERS`; 32 supplies 12 workers of headroom above
the verdict's pre-regression peak of 20, while isolation removes the new
workload. The barrier worker count is tunable through
`PUSHER_RECORD_BARRIER_EXECUTOR_WORKERS`.

Adds `omi_executor_max_workers` so the Prometheus-backed Grafana pusher
alert fires per scrape target at configured DB capacity for 10 minutes,
summing all task labels. Both maintained and combined alert exports are
updated. No production state has been accessed or changed; the lead must
provision the alert and roll pusher in the same train as #24101. Shared
executor defaults also apply to other processes importing
`utils.executors`; no extra threads start until work is submitted.

Validation:
- Targeted `backend/test.sh` via `BACKEND_UNIT_TEST_FILE_LIST`, 4
workers, under `omi-heavy` and `nice -n 19`: executor, strict Firestore
seal, pusher timeline, transcript dispatch, and monitoring contracts.
- New behavioral test forbids shared DB submission during all four
barrier operations and records the actual worker thread.
- New real pusher session test drains transcript and audio webhook
queues through DB-backed fake integrations while a fake barrier executor
holds a transaction pending.
- Based on #24101 merge `f436f8821b58`, preserving its returned
seal-refusal handling and shutdown/ACK logic. After syncing #24105/main,
targeted 15-file unit shard: 362 passed, including the strict custody
and seal/ACK cases. The full 24-file monitoring selector passed 558
tests. Hermetic E2E on the combined tree: 175 passed, 3 skipped, 2
expected failures. Repository preflight: 38 checks passed; full ordinary
push hooks run on each published head.

The first CI run found two alert metadata requirements outside the
initial local subset: a dashboard link and a current source-only GMP
query inventory. Both failures reproduced locally. The correction adds
the committed Pusher dashboard URL to both exports and regenerates the
query inventory offline; it changes no executor or seal logic. All 24
files from the monitoring changed-file selector pass locally (558
tests), including both formerly failing contracts; the expanded 14-file
functional set also passed 327 tests.

Review: Luna full read-only round 1 at
`9320e0eae81eb924f92ab5bb9d0890d8e3d86fb5` was **SHIP, no findings**
(execution `exec-deputy-theme-bottom-donkey-butter-section`). Delta
round 2 at reviewed implementation head
`569982c171eb6d693e819c0771a0ccb8a3d72076` was also **SHIP, no
findings** (execution `exec-endless-unfold-occur-october-leg-meadow`).
Reviewers did not run tests; local validation is recorded above. Each
published head passed ordinary push hooks; fresh exact-head terminal CI
remains required for merge. Lead owns merge and deploy. No `.github/`
edits, data changes, or flag changes.

Main sync: #24105 added the sweeper paragraph at our executor
paragraph's insertion point. Merge
`8e35ec63a5146a153dac65cbcef7acefa286dabe` retains both paragraphs; the
reviewed executor, seal and alert files are byte-identical to
`569982c171eb` (which completed all 64 CI checks green). Lead ruling
`5f2fd4` explicitly approves this docs-only resolution and reuse of both
SHIP reviews without a third round. The synced head requires its own
green CI before the lead merges.

Rollback: restore prior worker env values through the normal release
path for tuning; code rollback requires lead review to retain
#24084/#24101 custody semantics.

Failure-Class: none
Failure-Class-Reason: The registry has no matching shared Firestore
worker contention class; GPU batch/live scheduling and lifecycle
ownership classes describe different contracts. The new
consumer-isolation behavioral test guards this mechanism without
changing registry/workflows in this urgent PR.
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