Skip to content

fix(deploy): model Pusher surge capacity the way the scheduler and autoscaler do - #12429

Merged
mdmohsin7 merged 2 commits into
mainfrom
fix/pusher-capacity-gate-autoscaler
Aug 30, 2026
Merged

mdmohsin7 merged 2 commits into
mainfrom
fix/pusher-capacity-gate-autoscaler

Conversation

@mdmohsin7

@mdmohsin7 mdmohsin7 commented Aug 30, 2026 •

Copy link
Copy Markdown
Member

Fixes #11245.

Summary

The live Pusher capacity gate has been failing both deploy lanes on a condition that is not a capacity shortage. It asked whether every surge pod fits on one already-Ready node. Two things are wrong with that question.

Kubernetes never makes a rollout's surge pods share a node. The scheduler places them independently, so requiring the aggregate on a single node is stricter than the thing it is modelling.

A node pool below its autoscaler maximum can still supply the room. The autoscaler provisions a node when a pod is Pending — but this gate runs before Helm, so no Pending pod ever exists for it to react to. The pool is never asked, and its remaining growth is invisible to the check. That is the deadlock #11245 describes for dev, where the lane has been red since 2026-08-05.

Prod is the same shape, and worse: pusher-pool-v3 runs 6 nodes of a maximum 50, each with about 150m CPU and 3.2Gi free, while maxSurge: 2 at 700m/4.5Gi asks for 1400m and 9.66Gi on one node. An n4-highmem-2 has 1930m allocatable, so after the DaemonSets no node of that pool can ever hold both surge pods. The prod lane was not intermittently unlucky; it was permanently red.

What changed

capacity_evidence now models placement the way the cluster behaves:

  • surge pods are placed one at a time across the matching nodes;
  • when those are full, remaining pool growth counts as capacity — but only when one fresh node of that pool would fit a pod, measured as its allocatable minus the DaemonSet requests its siblings carry, since a new node inherits those too.

Growth comes from the kube-system/cluster-autoscaler-status ConfigMap, which GKE already publishes with each group's maxSize and registered node count. No new credential, CLI, or workflow input.

The gate stays closed on exactly what it was written to catch: nothing placeable anywhere, a pool already at its maximum, a pool whose empty nodes are too small for the request, and a cluster that publishes no autoscaler status at all (treated as "cannot grow").

Verification

Run against the live prod cluster, read-only, with the digest the failing deploy was carrying:

$ verify_pusher_live_deployment_gate.py --environment prod --namespace prod-omi-backend \
    --image gcr.io/based-hardware/pusher@sha256:2711daf1…
OK: live Pusher capacity gate passed: 2 surge pod(s) requiring 1400m CPU and 9663676416 bytes
    memory have room across 6 matching node(s): 0 on existing nodes, 2 through node-pool growth.

The same command on main produces the failure that killed runs 33314737324 and 33316563662: insufficient schedulable Pusher headroom … need 1400m CPU and 9663676416 bytes memory for 2 surge pod(s). The evidence line is deliberately explicit that both pods come from growth rather than existing headroom.

Measured on that cluster while diagnosing, for the record:

node (pusher-pool-v3) free CPU free memory surge pods it fits
×6 112–169m ~3.2Gi 0

Pool: 6 nodes, autoscaler max 50. An empty n4-highmem-2 (1930m / 12.9Gi) fits both.

backend/tests/unit/test_verify_pusher_live_deployment_gate.py: 14 passed, six of them new — spread placement across two nodes, growth supplying full nodes, and fail-closed for pool-at-max, fresh-node-too-small, absent autoscaler status, and unparseable status. test_pusher_deployment_control_workflow.py also passes (20 together).

Two pre-existing assertions changed: they asserted fitting_nodes, a count of nodes that could each hold the whole surge wave, which no longer exists as a concept. Both now assert placed_on_existing_nodes, and both still assert the same pass/fail outcome they did before — the first still passes with room on one node, the second still fails closed when a node can hold only one of two pods. The rewrite renames the evidence, it does not relax the guard.

Not verified: I did not run a real deploy. That needs the prod approval gate and is the next step after this merges.

Not in this PR

#11245 also asks for a break-glass on the dev auto-deploy lane, which has no workflow_dispatch at all. The prod lane already has skip_live_capacity_gate. That is a workflow change with its own review surface, so it stays separate — this PR removes the reason to need it.

Failure class

Failure-Class: none

Review in cubic

…toscaler do

The gate demanded that every surge pod fit on one already-Ready node. Two
things are wrong with that. Kubernetes never makes a rollout's surge pods
share a node, and a node pool below its autoscaler maximum can still supply
the room - but the gate fails before Helm creates the Pending pod the
autoscaler reacts to, so the pool is never asked. Prod pusher-pool-v3 sits at
6 of a maximum 50 with ~150m CPU free per node, and maxSurge 2 at 700m/4.5Gi
can never fit on one n4-highmem-2: the lane was permanently red.

Surge pods are now placed one at a time across matching nodes, and remaining
pool growth counts as capacity when one fresh node of that pool - allocatable
minus the DaemonSets it will inherit - would fit a pod. Growth comes from the
cluster-autoscaler status ConfigMap, so no new credential or CLI is involved.

The gate stays closed on what it was written to catch: nothing placeable, a
pool at its maximum, a pool whose empty nodes are too small, and a cluster
that publishes no autoscaler status.
Six new cases: surge spread across two nodes, full nodes passing on growth,
and fail-closed for a pool at max, a fresh node too small for the request,
an absent autoscaler status, and an unparseable one.
@mdmohsin7
mdmohsin7 merged commit 6134ebd into main Aug 30, 2026
41 checks passed
@mdmohsin7
mdmohsin7 deleted the fix/pusher-capacity-gate-autoscaler branch August 30, 2026 15:07
Git-on-my-level added a commit that referenced this pull request Aug 30, 2026
…equires (#12443)

## What broke

Live-captured conversations stopped finalizing in production at
**2026-08-30T15:21:42Z** and are still failing.

The pusher had not deployed since **2026-07-01** (`2ae7f78841`). #12429
fixed the pre-Helm capacity gate that was failing the lane, and the
rollout that followed (Helm applied 15:16:28Z, complete 15:28:51Z)
carried two months of change onto a Deployment whose environment was
never extended to match.

The old pusher never ran this code. Its opcode-104 handler called
`process_conversation` directly and never touched the durable-job
architecture. Today is the **first time the pusher has ever executed
`finalize_persisted_conversation`** — cold activation of a dormant
subsystem, not a contract drift. Verified: `backend/routers/pusher.py`,
`backend/utils/listen_pusher_session.py` and
`_claim_finalization_job_txn` are byte-identical across
`6f7c57ac15..6134ebd`.

## Root cause

The pusher chart ships **68 env vars where backend-listen ships 115**,
and `MEMORY_ENABLED` is among the 50 it lacks. Confirmed against the
live cluster:

```
prod-omi-pusher          68 env vars, zero MEMORY_* vars
prod-omi-backend-listen  115 env vars, MEMORY_ENABLED=on
```

`rollout_mode_env_value()` fail-closes to `off` when the flag is unset
(`backend/config/memory_rollout.py`).
`MemoryService.ensure_canonical_mutation_ready()` — called
**unconditionally and unwrapped** by `_extract_memories_inner` for every
non-discarded conversation — then raises `HTTPException(503, "Memory
writes are globally paused")`. `finalizer.py` converts that to
`ConversationFinalizationError('processing_failed')`, and the listen
session retries roughly 4x per conversation.

Measured distribution in a clean window (23:00–23:10Z, all entries):

| Exception | Count | Share |
| --- | --- | --- |
| `HTTPException` (this bug) | 366 | 89.5% |
| `LegalHoldAuthorityUnavailable` | 43 | 10.5% |

This PR fixes the 89.5%. The remainder is a separate, older regression —
see below.

## Why nothing paged

`finalizer.py` logs only `type(error).__name__`. Production emitted
~16k/hour of bare `error=HTTPException` carrying no status code, no
detail and no traceback, so the signature read as already-known. The
listener itself stayed healthy throughout — WS connections in band, 5/5
ready pods, listen-LB 5xx at zero, every `Backend-listen` critical rule
inactive, and no client-side Sentry spike. Audio was captured and
transcribed; it simply never became a conversation.

## The fix

Set `MEMORY_ENABLED=on` for dev and prod pusher, matching
backend-listen. It is a plain literal, so it requires no key from the
pusher's ExternalSecret — deliberately avoiding the failure class from
#12298, where a chart consumed a secret key the ExternalSecret did not
enumerate.

The test asserts the **contract**, not the key: the env a chart ships
must resolve to a mode that permits memory writes, and the two co-hosts
may not disagree. Against the charts as they stood during the incident
it fails with `assert 'off' == 'write'`.

## Failure class

This reopens an existing class. Its prevention artifact,
`test_conversation_notes_v2_beta_rollout.py`, pins three named flags
across backend-listen and the Cloud Run backend. It does not generalize
to other flags, and it does not know the pusher is now a third host of
`process_conversation`.

Failure-Class: FC-rollout-flag-absent-from-a-cohost-of-its-code-path

## Deliberately not in this PR

- **The other 49 missing env vars**, including `GEMINI_API_KEY`,
`USE_VERTEX_AI`, `LISTEN_FINALIZATION_ORPHAN_STALE_SECONDS` and the
`FAIR_USE_*` set. Real exposure, but several are secret refs and
widening them under incident pressure risks the #12298 class. Needs its
own change.
- **`LegalHoldAuthorityUnavailable`** (10.5% of failures) —
`current_destructive_operation_token()` at
`backend/database/legal_holds.py:403`, reached from
`canonical_memory_adapter.py:2029`, requires an active
`destructive_operation_gate(...)` context that this call site never
enters. Introduced by #12084, first seen in prod 2026-08-28T01:51:36Z
and firing continuously for ~2.5 days on
`/v1/conversations/from-segments`. Independent of this bug and of
today's deploy.
- **`/v1/embeddings` 404s at the LLM gateway.** `prod-omi-llm-gateway`
runs image `c61d815` (2026-08-20), which predates #12337's gateway
embeddings route; `gcp_llm_gateway.yml` is dispatch-only and was never
run after that merge. Swallowed at `vector_db.py`, so not user-visible
as an error — but `save_structured_vector` has been failing silently
since ~13:44Z, meaning **no conversation created since then has a
summary vector in Pinecone**, and it will not self-heal without a
backfill. Fix is to deploy the gateway, not to change code.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/12443?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="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
pull Bot pushed a commit to codingwatching/omi that referenced this pull request Aug 31, 2026
…equires

Every conversation stopped finalizing in prod at 2026-08-30T15:21:42Z. The
pusher had not deployed since 2026-07-01; BasedHardware#12429 fixed the pre-Helm capacity
gate blocking the lane, and the 15:16:28Z rollout brought two months of code
onto a Deployment whose env was never extended to match. The pusher chart
ships 68 env vars where backend-listen ships 115, and MEMORY_ENABLED is among
the 50 it lacks.

rollout_mode_env_value() fail-closes to `off` when the flag is unset, so
MemoryService.ensure_canonical_mutation_ready() -- called unconditionally by
_extract_memories_inner for every non-discarded conversation -- raised
HTTPException(503). finalizer.py catches it and logs only
type(error).__name__, so prod showed ~16k/hour of bare `error=HTTPException`
carrying no status, no detail and no traceback, which is why the signature
looked already-known and nothing paged on it.

Set MEMORY_ENABLED=on for dev and prod pusher, matching backend-listen. It is
a plain literal, so it needs no key from the pusher ExternalSecret.

The test asserts the contract rather than the key: the env the chart ships
must resolve to a mode that permits memory writes. It fails with
`assert 'off' == 'write'` against the charts as they stood during the incident.

This reopens FC-rollout-flag-absent-from-a-cohost-of-its-code-path. Its
prevention artifact, test_conversation_notes_v2_beta_rollout.py, pins three
named flags across backend-listen and Cloud Run backend; it does not
generalize to other flags or to the pusher as a third host of
process_conversation.

The remaining 49-var gap between the two charts is real and not addressed
here; widening it under incident pressure risks the ExternalSecret failure
class from BasedHardware#12298.

Failure-Class: FC-rollout-flag-absent-from-a-cohost-of-its-code-path

Co-Authored-By: Claude Opus 5 <[email protected]>
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.

Dev Pusher deploy lane has been red for 4 days: live capacity gate cannot pass on an autoscaling 1-node pool

1 participant