Skip to content

Make batch diarizer installation isolated, observable and image-qualified - #21448

Merged
Git-on-my-level merged 2 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/diarizer-batch-prereqs
Oct 14, 2026
Merged

Git-on-my-level merged 2 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/diarizer-batch-prereqs

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Make the separate production batch diarizer installable without sharing embedding GPU capacity. Its opt-in overlay removes inherited embedding affinity, pins a dedicated tainted L4 node pool, starts at one replica for David-only shadow and retains the later 6/18 capacity path. A separate reserved-IP internal ingress makes the endpoint reachable from Cloud Run; the lead runbook specifies node creation, DNS, digest-pinned Helm install and readiness checks.

The cluster's live prometheus-adapter v0.12.0 reads in-cluster Prometheus. Add a direct batch pod scrape carrying namespace/pod labels and the matching per-pod queue-depth rule, so the Pods HPA metric can be served through custom.metrics.k8s.io. Missing telemetry is not zero-filled. Existing adapter rules and embedding ingress/node settings remain untouched.

The runtime-image registry now imports both diarizer apps under python -I with /app on the path and pretrained model loads forbidden. Its additional real-tensor PCM/WAV probe blocks TorchCodec imports, torchaudio file loading and external decoders. The existing image workflow runs these probes before publication; no workflow file is added or changed. Models still warm at startup before readiness.

Product invariants: none mapped by scripts/pr-preflight --suggest.

Failure-Class: none

Validation: 64 focused tests through backend/test.sh pass, including real Helm rendering, pool/taint isolation, HPA scrape/resource wiring, digest validation and isolated imports from the canonical Docker COPY surface. Removing the copied turn module fails the import probe. The initial CI failure identified a missing expected-targets inventory entry; the scrape is now declared, and all 30 telemetry contract tests plus the five batch prerequisite tests pass. Read-only prod checks used ro-prod and explicit context; no pod env or workload YAML was printed. Built GPU-image smoke has not run locally because Docker is unavailable: source-staged/native-stubbed tests are not an artifact qualification. The registered real probe must pass in the lead-owned build. make preflight passes all 34 selected checks; changed-source Pyright has zero errors. All six GitHub backend unit shards and the aggregate suite pass on exact head 36dc564.

No backend/pusher cutover is enabled by this PR. The David-only flag change is published separately as 3ec0377bc16 on lane/diarizer-batch-david-cohort (not part of this PR), with four admission and 26 exact-value co-host tests plus its own preflight; merge it only after pool, metric, DNS and Cloud Run/pusher reachability gates pass. Node-pool IaC is intentionally absent: the repo's OpenTofu foundation explicitly excludes GKE, so the exact lead-only gcloud command is documented in backend/scripts/diarization_eval/batch_install.md. No node, metric configuration, DNS record or Helm release was applied by this work.

Rollback: disable David cohort/select legacy first and drain in-flight shadow requests; restore the batch digest or remove only the batch release. Revert just the new scrape/adapter rule, retaining unrelated monitoring changes. Remove the new pool, reserved IP and DNS only when unused. Embedding capacity/endpoint and stored speaker history are not rollback targets.

@Git-on-my-level
Git-on-my-level marked this pull request as ready for review October 14, 2026 01:11
@Git-on-my-level
Git-on-my-level merged commit 0a9df17 into BasedHardware:main Oct 14, 2026
57 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 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-14T01:26:45.321453Z 36dc564 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.

Git-on-my-level added a commit that referenced this pull request Oct 14, 2026
…rrupted-stream rule

Review revision of #21455 round 1:

- Prometheus CPU limit back to "2": load is sustained 1.5-2.2 cores over
  14h (the ~2.9-core spikes were kubelet scrape-timeout artifacts), 0%
  CFS-throttled, and the Prometheus-backed rules already time out - the
  1600m cap would throttle them and the adapter's HPA metrics further.
  Starvation is fixed with requests plus the pool resize runbook instead.
- Loki read path (ingester/querier 50m/256Mi, index-gateway/ruler
  20m/128Mi) gets requests, arithmetic in the values file: jzv7 1913m of
  1930m allocatable, mczx 1488m. loki values normalized CRLF->LF
  (file untouched since #2708; the hygiene check rejects new CRLF lines).
- README: rollback now records the pre-apply helm revision (rolling back
  to rev 14 would revert #21306/#21389/#21358/#21409; #21389 is
  screenshots-off, the 10-13 502 fix); corrected the "renders with no
  diff" claim; added the 4-vCPU pool resize runbook (exact gcloud create
  + cordon/drain, zonal us-central1-a so the Grafana/Prometheus PVCs
  reattach); stack applies marked off-peak (Prometheus WAL replay of
  ~700k-980k head series freezes the pusher/listen/parakeet/VAD/diarizer
  HPAs; #21448's inert diarizer scrape job rides along); the 109/286
  down-target count (34 stale kubelet endpoints) noted as operator
  crash-loop fallout expected to clear.
- New metric rule omi-listen-audio-decode-failures shadows the paused
  corrupted-stream log rule on omi_listen_audio_decode_failures_total
  (startup zero-init children added); listen-429, ASGI-handshake and
  direct-OpenAI-quota gaps tracked in #21461.
Git-on-my-level added a commit that referenced this pull request Oct 14, 2026
…g-node CPU (#21455)

* fix(monitoring): hold raw-line Loki alert rules and reserve monitoring-node CPU

2026-10-14 prod: Grafana /api/health flapped 502, alert evaluation logged
190 failures + 120 dropped ticks over 20 minutes, the prometheus operator
restarted 48x and the adapter 35x in 31h, and every pusher deploy failed on
alert provisioning. Two causes, both read-verified against prod:

1. Four committed alert rules query the Loki datasource for raw log lines
   (whole-namespace regex scans, 60s ticks, one with [$__auto]). They caused
   340 of 410 rule-eval failures in 3h (196 from afd0krbk1bugwf alone), each
   timing out past the 30s datasource budget - the same failure class as the
   2026-10-13 Cloud Logging rule (#21390). Pause all four and hold them in
   metric-inventory admission_holds; re-admit only on bounded counters.

2. Grafana, the operator and the adapter ran BestEffort on a ~1.93
   allocatable-core monitoring node while Prometheus's 2-CPU limit exceeded
   total node capacity, so Prometheus bursts starved kubelet probes (the
   operator/adapter restart mechanism - SIGTERM after probe timeout) and
   Grafana's HTTP server. Cap Prometheus at 1600m and give Grafana, the
   operator and the adapter explicit requests.

New contract test rejects any unpaused rule referencing a log datasource
(type or prod Loki UID); README documents the policy. The 2-vCPU monitoring
node pool remains undersized for 592k head series - resizing it is the
follow-up (owner: infra).

* fix(monitoring): Loki read-path requests, metric shadow for paused corrupted-stream rule

Review revision of #21455 round 1:

- Prometheus CPU limit back to "2": load is sustained 1.5-2.2 cores over
  14h (the ~2.9-core spikes were kubelet scrape-timeout artifacts), 0%
  CFS-throttled, and the Prometheus-backed rules already time out - the
  1600m cap would throttle them and the adapter's HPA metrics further.
  Starvation is fixed with requests plus the pool resize runbook instead.
- Loki read path (ingester/querier 50m/256Mi, index-gateway/ruler
  20m/128Mi) gets requests, arithmetic in the values file: jzv7 1913m of
  1930m allocatable, mczx 1488m. loki values normalized CRLF->LF
  (file untouched since #2708; the hygiene check rejects new CRLF lines).
- README: rollback now records the pre-apply helm revision (rolling back
  to rev 14 would revert #21306/#21389/#21358/#21409; #21389 is
  screenshots-off, the 10-13 502 fix); corrected the "renders with no
  diff" claim; added the 4-vCPU pool resize runbook (exact gcloud create
  + cordon/drain, zonal us-central1-a so the Grafana/Prometheus PVCs
  reattach); stack applies marked off-peak (Prometheus WAL replay of
  ~700k-980k head series freezes the pusher/listen/parakeet/VAD/diarizer
  HPAs; #21448's inert diarizer scrape job rides along); the 109/286
  down-target count (34 stale kubelet endpoints) noted as operator
  crash-loop fallout expected to clear.
- New metric rule omi-listen-audio-decode-failures shadows the paused
  corrupted-stream log rule on omi_listen_audio_decode_failures_total
  (startup zero-init children added); listen-429, ASGI-handshake and
  direct-OpenAI-quota gaps tracked in #21461.
Git-on-my-level added a commit that referenced this pull request Oct 29, 2026
…Prometheus (#24079)

## Why

The prometheus-adapter (`prod-omi-prometheus-adapter`) reads the
in-cluster
Prometheus (`prod-omi-kube-prometheus-stack`), not GMP. The external
rules
behind the batch worker HPA (#23891) —
`omi_batch_pipeline_admissible_ready_units`
and `omi_batch_pipeline_ready_age_seconds`, already present in
`prod_omi_prometheus_adapter.yaml` — match zero series today because no
scrape
job selects the `batch-pipeline-worker` pods into that Prometheus; they
only
feed GMP. Until this lands, the worker HPA cannot scale batch to 100%:
the
external metrics API returns no values.

## What

Adds a `batch-pipeline-worker-metrics` job to `additionalScrapeConfigs`,
mirroring the `diarizer-batch-metrics` precedent from #21448 (the
2026-10-14
diarizer-batch cutover):

- `scrape_interval: 15s`, `role: pod`, `namespaces: [prod-omi-backend]`
- keeps on the `app.kubernetes.io/name: batch-pipeline-worker` label
(selects
  every chart release, not one instance name), the `http` container port
(8080 — the same port the chart's GMP PodMonitoring scrapes), and
`Running`
  phase
- relabels exactly `namespace` + `pod`: the adapter's freshness joins
run
`on (namespace, worker_release, pod)`, so the scrape must attach those
two;
`priority` and `worker_release` ride the metric samples themselves and
are
  left untouched (no `metric_relabel_configs`)

Declares the job in `expected-targets.prod.yaml` (mechanism
`additionalScrapeConfigs`, `auth: null` — the worker's `/metrics`
handler is
unauthenticated, namespace `prod-omi-backend`, `coverage_status:
declared`
with no coverage alert, same class as `diarizer-batch-metrics`) and pins
the
whole shape in `test_batch_pipeline_chart.py` next to the worker's other
scrape contracts. The telemetry contract test enforces values↔inventory
bidirectionally, so both sides land together.

## Series this enables (at today's 3 replicas)

| family | labels | series |
| --- | --- | --- |
| `omi_batch_pipeline_admissible_ready_units` | priority,
worker_release, namespace | 9 (3 pods × 3 priorities) |
| `omi_batch_pipeline_capacity_refreshed_at_seconds` | worker_release,
namespace | 3 |
| `omi_batch_pipeline_ready_age_seconds` | priority, worker_release,
namespace | 9 |
| `omi_batch_pipeline_metrics_refreshed_at_seconds` | worker_release,
namespace | 3 |

## Risk

- **Cardinality:** the four adapter-consumed families add 24 series at 3
  pods. The job scrapes the worker's full `/metrics` exposition (as the
diarizer job does for its pods), bounded by the runtime's registry — an
O(100) series addition against the 2.25M-series head, ingested locally
by
  both Prometheus replicas, no Cloud Monitoring reads. Negligible.
- **No behavioral change until applied:** this only edits repo values.
The
rollout lead applies the stack with the pinned-chart runbook (helm
upgrade
`prod-omi-kube-prometheus-stack`, chart 75.15.1, per the monitoring
README)
in the same window as the prometheus-adapter apply that carries the HPA
rules. No `.github/` changes, no flag flip, no IAM change, no data
mutation.
- **Target growth is bounded:** targets exist only while worker pods run
  (today 3; #23891's maxReplicas 16 bounds the ceiling).

## Test plan

- Local backend unit shard (BACKEND_UNIT_TEST_FILE_LIST) green: 86
passed
  across `test_batch_pipeline_chart.py` (new pin),
  `test_monitoring_telemetry_contract.py` (inventory bidirectional +
  declared-gap rules), `test_diarizer_batch_prereqs.py` (neighbor job
  unaffected).
- CI backend unit shard covers the same three files.

Failure-Class: none


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/24079?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/24079?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24079&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. -->
MichaelC001 pushed a commit to MichaelC001/omi that referenced this pull request Oct 30, 2026
…Prometheus

The prometheus-adapter reads the in-cluster Prometheus, not GMP, so the
omi_batch_pipeline_* external rules behind the worker HPA (BasedHardware#23891) matched
zero series: nothing scraped the batch-pipeline-worker pods into that
Prometheus. Add a batch-pipeline-worker-metrics additionalScrapeConfigs job
mirroring diarizer-batch-metrics (BasedHardware#21448): 15s, role pod, prod-omi-backend,
keep on the app.kubernetes.io/name label, the http port and Running phase,
relabel exactly namespace+pod so the adapter's per-pod freshness join
(namespace, worker_release, pod) resolves; priority and worker_release ride
the metric samples. Declare the job in expected-targets.prod.yaml as a
declared batch target with no coverage alert, and pin the whole contract in
test_batch_pipeline_chart.py alongside the worker's other scrape checks.
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