Skip to content

fix(deploy): keep prod LLM-gateway serving off until the gateway exists - #9922

Merged
kodjima33 merged 1 commit into
mainfrom
kodjima33/fix-prod-chat-broken
Jul 17, 2026
Merged

kodjima33 merged 1 commit into
mainfrom
kodjima33/fix-prod-chat-broken

Conversation

@kodjima33

@kodjima33 kodjima33 commented Jul 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Prod chat (mobile TestFlight + App Store) went down after today's prod backend deploy — every POST /v2/messages hung 122–560s (vs the normal 3–10s) until mobile clients gave up.

Root cause: d83e37d21a ("feat(llm-gateway): enable production serving", merged Jul 13) turned on OMI_LLM_GATEWAY_FEATURE_MODE=gateway for all prod backend services, but the llm-gateway itself was never deployed to prod:

  • Cloud Run services point at http://172.16.160.108 — the static IP prod-omi-self-hosted-llm-ip-address is RESERVED with no forwarding rule (TCP blackhole; audit logs show no forwarding rule ever attached).
  • GKE backend-listen points at prod-omi-llm-gateway.prod-omi-backend.svc.cluster.local — no such helm release/service exists in the prod cluster.

Because prod deploys had been failing since Jul 14 (fixed by #9911), the flag sat unshipped until today's deploy (backend:7290a41, ~11:43 UTC) released it. Every omi:auto:* LLM call (chat_agent, chat_extraction, fair_use, onboarding) then hung through connect timeouts + openai-client retries before falling back to the direct path.

This PR flips the five prod OMI_LLM_GATEWAY_FEATURE_MODE entries to 'off' (Cloud Run backend / backend-sync / backend-sync-backfill via anchor / backend-integration, plus GKE backend-listen), matching the live mitigation already applied to prod, and updates the deploy contract test to encode "wiring declared, serving off until the gateway is actually deployed". URL/token wiring stays so re-enablement is a one-line flip once a reachable prod gateway exists.

Live mitigation already applied (prod is healthy now)

  • Removed OMI_LLM_GATEWAY_FEATURE_MODE from Cloud Run backend (revision backend-01158-lmd, 100% traffic), backend-sync, backend-sync-backfill, backend-integration; same for GKE prod-omi-backend-listen via kubectl set env.
  • This PR makes the repo manifest match prod so the next deploy doesn't re-break chat.

Verification

  • Before: real-user POST /v2/messages latencies 122s/248s/364s/505s on backend-7290a41; gateway telemetry outcome=error reason=unexpected_error (fair_use, onboarding) and outcome=fallback reason=timeout (chat_agent, chat_extraction).
  • After: real-user POSTs 3.5s/3.6s/8.8s 200 on backend-01158-lmd; authenticated end-to-end send as a real user (viUv7Gt…) via https://api.omi.me/v2/messages returned the AI reply over SSE in 3.9s.
  • pytest tests/unit/test_llm_gateway_deploy_contract.py tests/unit/test_backend_runtime_env_validator.py → 61 passed.
  • validate-backend-runtime-env.py --env dev --check-workflows and --env prod --check-workflows → both pass.
  • helm lint charts/backend-listen -f prod_omi_backend_listen_values.yaml → 0 failed.
  • Note: scripts/pre-deploy-check.sh not run locally (uv cannot fetch cpython 3.11.15 on this machine right now); CI runs the same contract.

Product invariants affected

none

Failure class (fixes)

Failure-Class: new

Adds .github/failure-classes/FC-unprovisioned-rollout-target.json: a rollout flag routing production traffic to a service endpoint must not be enabled for an environment until that endpoint is provisioned and reachable there (evidence: #9651).

Follow-up

  • Deploy the llm-gateway to prod (helm release + ingress bound to prod-omi-self-hosted-llm-ip-address, service token, Vertex WI perms) before flipping FEATURE_MODE back to gateway.

🤖 Generated with Claude Code

The 2026-07-17 prod deploy (first successful since 07-14) shipped
OMI_LLM_GATEWAY_FEATURE_MODE=gateway to every prod backend service, but
the llm-gateway was never deployed in prod: the Cloud Run URL
http://172.16.160.108 is a RESERVED static IP with no forwarding rule
(prod-omi-self-hosted-llm-ip-address), and the GKE URL points at
prod-omi-llm-gateway.prod-omi-backend.svc.cluster.local which has no
helm release. Every omi:auto:* LLM call hung through connect timeouts
and openai-client retries before falling back, driving POST /v2/messages
from 3-10s to 122-560s — mobile chat read as fully down (TestFlight +
prod App Store builds).

Flip the five prod FEATURE_MODE entries (backend, backend-sync,
backend-sync-backfill via anchor, backend-integration, gke backend-listen)
to 'off', matching the live mitigation already applied to prod, and
update the deploy contract test to encode disabled-until-deployed.
Gateway URL/token wiring stays declared so re-enablement is a one-line
flip once the prod gateway actually exists.

Verification:
- Live prod (before): POST /v2/messages latencies 122-560s on revision
  backend-7290a41; gateway events outcome=error/timeout for chat_agent,
  chat_extraction, fair_use, onboarding.
- Live prod (after removing the flag): real-user POSTs 3.5-8.8s on
  backend-01158-lmd; authenticated real chat send as uid viUv7Gt...
  returned an AI reply over SSE in 3.9s.
- backend: pytest tests/unit/test_llm_gateway_deploy_contract.py
  tests/unit/test_backend_runtime_env_validator.py -> 61 passed.
- validate-backend-runtime-env.py --env dev/prod --check-workflows both pass.
- helm lint charts/backend-listen -f prod values: 0 failed.

Failure-Class: new

Co-Authored-By: Claude Fable 5 <[email protected]>
@kodjima33
kodjima33 merged commit 382ae17 into main Jul 17, 2026
37 of 43 checks passed
@kodjima33
kodjima33 deleted the kodjima33/fix-prod-chat-broken branch July 17, 2026 16:09
undivisible pushed a commit to undivisible/omi that referenced this pull request Sep 29, 2026
…ts (BasedHardware#9922)

## Summary

Prod chat (mobile TestFlight + App Store) went down after today's prod
backend deploy — every `POST /v2/messages` hung 122–560s (vs the normal
3–10s) until mobile clients gave up.

**Root cause:** `d83e37d21a` ("feat(llm-gateway): enable production
serving", merged Jul 13) turned on
`OMI_LLM_GATEWAY_FEATURE_MODE=gateway` for all prod backend services,
but the llm-gateway itself was never deployed to prod:

- Cloud Run services point at `http://172.16.160.108` — the static IP
`prod-omi-self-hosted-llm-ip-address` is **RESERVED with no forwarding
rule** (TCP blackhole; audit logs show no forwarding rule ever
attached).
- GKE `backend-listen` points at
`prod-omi-llm-gateway.prod-omi-backend.svc.cluster.local` — **no such
helm release/service exists** in the prod cluster.

Because prod deploys had been failing since Jul 14 (fixed by BasedHardware#9911), the
flag sat unshipped until today's deploy (`backend:7290a41`, ~11:43 UTC)
released it. Every `omi:auto:*` LLM call (chat_agent, chat_extraction,
fair_use, onboarding) then hung through connect timeouts + openai-client
retries before falling back to the direct path.

**This PR** flips the five prod `OMI_LLM_GATEWAY_FEATURE_MODE` entries
to `'off'` (Cloud Run backend / backend-sync / backend-sync-backfill via
anchor / backend-integration, plus GKE backend-listen), matching the
live mitigation already applied to prod, and updates the deploy contract
test to encode "wiring declared, serving off until the gateway is
actually deployed". URL/token wiring stays so re-enablement is a
one-line flip once a reachable prod gateway exists.

## Live mitigation already applied (prod is healthy now)

- Removed `OMI_LLM_GATEWAY_FEATURE_MODE` from Cloud Run `backend`
(revision `backend-01158-lmd`, 100% traffic), `backend-sync`,
`backend-sync-backfill`, `backend-integration`; same for GKE
`prod-omi-backend-listen` via `kubectl set env`.
- This PR makes the repo manifest match prod so the next deploy doesn't
re-break chat.

## Verification

- Before: real-user `POST /v2/messages` latencies 122s/248s/364s/505s on
`backend-7290a41`; gateway telemetry `outcome=error
reason=unexpected_error` (fair_use, onboarding) and `outcome=fallback
reason=timeout` (chat_agent, chat_extraction).
- After: real-user POSTs 3.5s/3.6s/8.8s 200 on `backend-01158-lmd`;
authenticated end-to-end send as a real user (`viUv7Gt…`) via
`https://api.omi.me/v2/messages` returned the AI reply over SSE in
**3.9s**.
- `pytest tests/unit/test_llm_gateway_deploy_contract.py
tests/unit/test_backend_runtime_env_validator.py` → 61 passed.
- `validate-backend-runtime-env.py --env dev --check-workflows` and
`--env prod --check-workflows` → both pass.
- `helm lint charts/backend-listen -f
prod_omi_backend_listen_values.yaml` → 0 failed.
- Note: `scripts/pre-deploy-check.sh` not run locally (uv cannot fetch
cpython 3.11.15 on this machine right now); CI runs the same contract.

## Product invariants affected

none

## Failure class (fixes)

Failure-Class: new

Adds `.github/failure-classes/FC-unprovisioned-rollout-target.json`: a
rollout flag routing production traffic to a service endpoint must not
be enabled for an environment until that endpoint is provisioned and
reachable there (evidence: BasedHardware#9651).

## Follow-up

- Deploy the llm-gateway to prod (helm release + ingress bound to
`prod-omi-self-hosted-llm-ip-address`, service token, Vertex WI perms)
before flipping FEATURE_MODE back to `gateway`.

🤖 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