Skip to content

fix(pusher): abandon evicted tokens without the dedicated durable pool (#24689b) - #24699

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/abandonb
Nov 5, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/abandonb

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

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.

View guided diff Turn on auto-fix

@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-05T12:51:26.673758Z e07fe91 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 18 files

Confidence score: 3/5

  • In backend/docs/runbooks/audio-durable-outbox.md, removing dedicated admission leaves pusher submissions on an unbounded shared queue; stalled storage can retain PCM across sockets and starve unrelated work. Add a pod-wide PCM/admission bound.
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/runbooks/audio-durable-outbox.md">

<violation number="1" location="backend/docs/runbooks/audio-durable-outbox.md:117">
P1: Removing the dedicated admission leaves pusher submissions on the shared executor's unbounded queue. Add a pod-wide PCM/admission bound; otherwise stalled storage can retain PCM across sockets and starve unrelated storage work before the canary detects it.</violation>
</file>

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

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

capacity/abandoned/abandon_overflow outcomes and repair `upload_pending` before expansion. Do not
Durable custody, PCM reads, uploads and projection refresh use the original
shared `storage_executor` (128 workers) and its existing queue behavior. There
is no separate recording pool, routing override or pool-specific refusal before

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: Removing the dedicated admission leaves pusher submissions on the shared executor's unbounded queue. Add a pod-wide PCM/admission bound; otherwise stalled storage can retain PCM across sockets and starve unrelated storage work before the canary detects it.

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 117:

<comment>Removing the dedicated admission leaves pusher submissions on the shared executor's unbounded queue. Add a pod-wide PCM/admission bound; otherwise stalled storage can retain PCM across sockets and starve unrelated storage work before the canary detects it.</comment>

<file context>
@@ -112,29 +112,19 @@ Refusal removes its local recovery hint, preventing a later producer from
-capacity/abandoned/abandon_overflow outcomes and repair `upload_pending` before expansion. Do not
+Durable custody, PCM reads, uploads and projection refresh use the original
+shared `storage_executor` (128 workers) and its existing queue behavior. There
+is no separate recording pool, routing override or pool-specific refusal before
+ACK. Socket future tracking shields queued and running storage work from caller
+cancellation and waits for actual settlement before abandonment. The closed-worker
</file context>

@Git-on-my-level
Git-on-my-level merged commit cba5d6e into main Nov 5, 2026
70 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/abandonb branch November 5, 2026 13:06
Git-on-my-level added a commit that referenced this pull request Nov 6, 2026
… alerts (#24788)

## Purpose

PR-A adds observational PCM byte accounting around pusher custody
`commit_pcm_window`, plus chart-only storage queue and memory alerts.
Follows phase 2a (#24756, cc9c71b) and the approved metrics-first
split.

- `omi_pusher_storage_pcm_inflight_bytes`: increment payload length
before storage submission; decrement in `finally` on success, exception
or caller cancellation. Defensive metric failures never affect
commit/ACK behavior. Cancellation can leave a running thread completing
storage; this gauge measures the await lifetime, not total retained RSS.
- `omi_pusher_storage_pcm_budget_limit_bytes`: constant zero, meaning no
budget is enforced. Both gauges are zero-initialized, label-free and
registered in the source-backed metric inventory. Pusher exports
directly through `/metrics` to the unfiltered `pusher-metrics`
Prometheus scrape; no GMP sidecar allowlist applies.

## Alert thresholds

| Grafana UID | Threshold | Pending | Tier |
|---|---|---|---|
| omi-pusher-storage-queue-warning | Queued storage tasks >256 per
pusher target | 10m | agent |
| omi-pusher-storage-queue-critical | Queued storage tasks >512 per
pusher target | 10m | page |
| omi-pusher-memory-working-set-high | Pod working set / 3.5 GiB >0.75 |
15m | page |

Queue thresholds are 2x/4x the configured 128 storage workers. The real
executor label is `storage`; custody work has task label `other`, so
queries sum all task kinds per target. RSS uses the same
container/workload selectors as `dashboards/gke/pusher.json`, normalized
by the chart's 3.5 GiB limit. The 75% bar (2.625 GiB) follows the #24699
gate. These are sustained current-state gauges, not rates over
historical incidents. Each source series must be younger than 120s
before aggregation; absent data does not page. Rules have
human-impact/verification/runbook annotations and agent/page routing.
Split/combined rules and generated query inventory are synchronized.

## Scope and rollback

No byte budget, semaphore, refusal logic/counter/alert, flags, extra
reads, executor behavior, ACK/1011/close changes, deployment settings or
`.github` changes. PR-B remains later and must first add a saturation
test. No GCP/prod access, merge or deployment. Rollback: revert this PR;
metrics are inert. Alert definitions require normal monitoring
provisioning to become live.

## Verification

- Targeted metric lifecycle/registration, monitoring alert contracts and
generated inventory: 118 passed.
- Component suites through `bin/omi-heavy` + file-isolated
`backend/test.sh`: 252 passed, 2 existing executor Future timeouts.
Isolated rerun reproduced both. An archived `origin/main` source
snapshot at cc9c71b reproduced the
identical 2 failures / 34 passes with the same Python environment. No
executor source/tests are changed. Other suites include durable outbox
(102 passed), queue wait (28 passed), executor backpressure,
metrics/cardinality/export and monitoring contracts.
- PR metadata validation: 4 checks passed. `make preflight`: all 42
checks passed with the approved 900s file budget. Normal pre-push
passed: 42 contract checks, backend type check (0 errors), all 83
selected tests, OpenAPI/client compatibility and formatting (HTTPS
through the gh credential helper,
`BACKEND_UNIT_FILE_BUDGET_SECONDS=900`, no skip hatches). The first
Firestore guard exceeded its 300s file budget; rerunning with the
approved `BACKEND_UNIT_FILE_BUDGET_SECONDS=900`, without skipping
checks.
- Required Grok review completed via agentctl on m5-mbp with read-only
access: no findings on b103608.
Reviewed gauge accounting/cancellation, metric-failure isolation, queue
aggregation, per-series freshness, 3.5 GiB memory normalization, alert
routing, tests and inventories.

## Product invariants affected

none

Line-Count-Exception: backend/routers/pusher.py | 1857 -> 1872 | Keep
the defensive observational increment/finally next to the sole custody
storage await without changing its control flow.
Line-Count-Exception: backend/utils/metrics.py | 1673 -> 1683 | Register
two label-free pusher gauges alongside the existing shared pusher
collectors used by the metrics endpoint.
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