Skip to content

fix(metrics): supply GMP scrape token and collector RBAC - #24961

Merged
Git-on-my-level merged 2 commits into
mainfrom
fix/gmp-scrape-token-rbac
Nov 10, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
fix/gmp-scrape-token-rbac

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Problem and change

GMP pusher had 25 targets and sum(up)=0 at both 2026-11-08 13:45Z and 13:56Z (scope investigation, not a new measurement in this implementation). The pusher scrape gap remains all-down: cl2-fixnow reports a newer verification at 2026-11-09 00:10Z of 19 targets, 0 up. The earlier count was 25 targets, 0 up; the target count changed, while scrape availability remained zero. This implementation did not independently remeasure production. The authenticated PodMonitoring was shipped without its app-namespace scrape Secret and collector RBAC prerequisites. The missing RBAC was measured; Secret absence and the exact scrape error were inferred because read-only access cannot inspect Secrets or per-target errors.

ACCESS CHANGE — approval required

ACCESS CHANGE: new secret copy in the app namespace + RBAC for the Google-managed collector. David's approval is required before merge. Do not merge or deploy before that approval.

  • Sync metrics-scrape-token key token through the existing backend-secrets SecretStore in both prod-omi-backend and dev-omi-backend. Derive its remote key from the existing app METRICS_SECRET mapping (currently remote key METRICS_SECRET in both stages), with the existing refresh interval and Owner policy.
  • Each pusher/listen release owns its own Role/RoleBinding for gmp-system/collector, limited to get/list/watch on the named metrics-scrape-token Secret. Render both only when podMonitoring.enabled is true.
  • Pin dev/prod renders, source-key linkage, RBAC scope and monitoring-disabled behavior in Helm render regression tests. App /metrics token enforcement remains unchanged.

The record-seal-worker scrape was fixed separately in #24931; that independent fix is not part of this PR.

Required deployment sequence after approval

  1. backend-secrets first, for each environment: apply the updated chart through backend/scripts/deploy-backend-secrets.sh in its approved deploy context. Wait separately for ExternalSecret metrics-scrape-token-store Ready and confirm the target Secret has key token without printing its value. The helper currently waits/force-syncs only the existing app ExternalSecret; its success does not establish readiness of the new token copy.
  2. Pusher chart next: roll pusher, or Helm-upgrade its chart while retaining the running image/digest and existing release overrides, to apply its Role/RoleBinding. Standalone .github/workflows/gcp_backend_pusher.yml does not apply backend-secrets; only its optional LLM Gateway branch calls deploy-llm-gateway.sh, which applies secrets first. Development auto-pusher also upgrades only pusher. A pusher-only roll cannot supply the Secret.
  3. Listen with its operator-approved 22:00Z roll: apply the updated backend-listen chart and its Role/RoleBinding. .github/workflows/gcp_backend_listen_helm.yml has Upgrade backend-secrets Helm chart immediately before Upgrade backend-listen Helm chart. The full backend workflow (gcp_backend.yml -> .github/actions/deploy-backend-stack/action.yml) also applies backend-secrets before listen when deploy_targets=all; Cloud Run-only does not reach this step. The listen-chart main-push trigger defaults to development; the 22:00Z prod roll remains an operator-planned action, not a schedule added by this PR.
  4. Verify nonzero target counts plus sum(up{job="prod-omi-pusher"}) == count(up{job="prod-omi-pusher"}). After listen's roll require sum(up{job="prod-omi-backend-listen"}) == count(up{job="prod-omi-backend-listen"}). Also require pusher_active_ws_connections / backend_listen_active_ws_connections series under their respective GMP job names. Use the analogous dev jobs in dev; dev runtime health was not measured by this task.

This PR applies no live resources and dispatches no workflows.

Rollback

Revert and reapply the three charts to remove the new token copy and access, or set podMonitoring.enabled=false on pusher/listen and upgrade them to remove the monitors and collector RBAC. Disabling monitoring leaves the separately managed token copy in place.

Validation

  • omi-heavy run -- backend/.venv/bin/python -m pytest -q backend/tests/unit/test_serving_podmonitoring_chart.py backend/tests/unit/test_backend_secrets_chart.py: 8 passed, 3.11s after merging current main (2026-11-09T01:37:36Z; head 6f526c62fdb26966f01d0bff4f91c4fd6402da57).
  • Dev/prod helm lint for backend-secrets, pusher and backend-listen: all six passed; strict lint with synthetic image settings also passed 6/6 (2026-11-08T14:31:30Z).
  • Fresh guarded-push preflight: 43 checks passed in 313.87s, followed by the selected 38 backend test files and the complete bounded pre-push gate. Push completed successfully (log timestamp 2026-11-09T01:44:53Z; verified at 01:45:54Z).

Previous publication blockers are fixed on main: #24948 scopes the Parakeet cleanup timeout to its receiver task, and #24950 repairs the dated flag-registry gate. This branch merged current origin/main without rebasing and includes both fixes. Fresh render validation and the full guarded push passed with TZ=UTC and BACKEND_UNIT_FILE_BUDGET_SECONDS=900; no tests or hooks were skipped. The remote branch matches head 6f526c62fdb26966f01d0bff4f91c4fd6402da57. GitHub CI is separate from these local checks.

No production/data reads in this implementation; no GCP tier used. Local render checks do not establish live GMP recovery.

Product invariants affected

none

Failure-Class: none

Failure mechanism: deploy gap — PodMonitoring shipped without its auth prerequisites. No registered failure class directly covers this access-prerequisite omission; this PR adds behavioral render guards without editing the failure-class registry.

View guided diff Turn on auto-fix

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T01:50:38.804646Z 6f526c6 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.

Git-on-my-level added a commit that referenced this pull request Nov 9, 2026
…swap (#24974)

## What changed and why

Episode join variant F has been at 100% since 2026-11-08 06:29Z and has
made zero Jev decisions. Every attempt (78 by 07:45Z today, all in the
pusher) fell back to the time-only join with `reason=other` and no log
line. Among the `other` sources in `utils/episodes/f_join.py`, only
`mark_pending`'s `EpisodeConflict` branch is silent. The logs show one
`synced_failed`, which accounts for one fallback, and no
`previous_failed`, `gate_failed` or `recheck_failed`.

`mark_pending` writes the F marker in a second transaction after the
recorded attach, using the `state_version` from attach time. A live
episode is written on every moment, so that version is usually stale by
the time the marker is written, and the marker gave up on the first
conflict. It also rebuilt `pending_boundary` from the stale copy, which
could drop a concurrent writer's marker.

Now `mark_pending`:
- re-reads the episode and retries, three attempts in all, while the
join still stands: live, the conversation still a member, and not
already marked;
- merges into the fresh `pending_boundary`;
- logs `event=episode_f_join outcome=pending_conflict reason=<conflict>
attempts=<n>` when it gives up, so the next readout shows which conflict
it was.

Known limit: if the conflict is `current_episode_changed` rather than a
stale version, retrying won't help. The new log line will show that, and
that case needs a follow-up.

Related, not changed here: backend-listen still serves
`backend:9ad243c`, which has no F code, so live joins handled by listen
can't use F until it rolls.

## Product invariants affected

none

## How it was verified

- `pytest tests/unit/test_episode_f_join.py
tests/unit/test_episode_f_join_guards.py`: 190 passed (Python 3.11 venv
in a cloud sandbox).
- `scripts/backend-python-format --write` on both files: no changes.
- `scripts/pr-preflight --pr-body-file`: 36 checks passed.
- Not verified in prod. The pusher isn't scraped until #24961 lands, so
the check after deploy is the new `pending_conflict` log line, plus F
fallbacks per hour compared with today's 1 to 4.

## Tests

-
`test_a_marker_that_loses_the_cas_rereads_and_merges_into_the_fresh_live_episode`:
fails before this change (one commit, then a fallback). It now retries
at the fresh version and keeps a concurrent `c0` marker.
- `test_a_marker_stops_retrying_once_the_join_no_longer_stands`: episode
missing, closed, member gone, or already marked → one attempt, then a
fallback.
- `test_a_marker_gives_up_after_bounded_retries`: exactly
`MARK_PENDING_ATTEMPTS` commits, then one fallback.

## UI evidence

UI-Evidence: none -- backend only

## Failure class (fixes)

Failure-Class: none

---
_Generated by [Claude
Code](https://claude.ai/code/session_017CeWy1WMfSseNThvZxKRKb)_

<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/24974?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/24974?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24974&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. -->
@Git-on-my-level
Git-on-my-level merged commit 48eaf3e into main Nov 10, 2026
64 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/gmp-scrape-token-rbac branch November 10, 2026 08:59
Git-on-my-level added a commit that referenced this pull request Nov 10, 2026
)"

This reverts commit 6f526c6, merged as
48eaf3e, restoring main to the green
state at ded44ab.

Reason: the fresh merge-ref CI on main (run 42786950639) failed
"Backend unit shard 5/8" twice (original attempt and one --failed rerun,
both reproduced): the shard step exits nonzero ~80s after the
tests/unit/test_tts_deploy_contract.py group starts, with zero FAILED
test lines — the backend-listen chart contract test group hangs or kills
the step. The suite was green on ded44ab (immediate first parent)
and the only delta on main is this merge, so main-red is repaired by
reverting. #24961 can re-land once the chart-contract interaction is
understood and fixed on the PR.

Merge-desk revert per lead2 ruling 64285e (revert only on a real failure
of the fresh run) and merge decision ab0747's rollback line.

Failure-Class: main-red repair
Git-on-my-level added a commit that referenced this pull request Nov 10, 2026
#25033)

## Summary

The quiet-check counters never reached GMP. Two independent causes, one
per
ingestion path:

1. **Cloud Run copies were dropped by the GMP sidecar keep rule.** Both
names
predate the `omi_` prefix, and both keep rules kept only `omi_.*` plus a
short exception list. `listen_quiet_check_empty_exit_total` is born
*only*
in the finalization route, which runs on backend-sync, so it was never
   ingested anywhere.
2. **The GKE listen/pusher copies are not scraped at all.** The
`prod-omi-backend-listen` / `prod-omi-pusher` PodMonitoring targets
report
`up=0` and `scrape_samples_scraped=0`; the GMP collector's secret
watcher
   cannot read `metrics-scrape-token`
(`watch: unknown (get secrets)`). That is a deployment gap, not a code
gap,
and its fix (#24961) was reverted from `main` at `8141729fccd9` for an
   unrelated CI hang.

This PR fixes (1) in code and documents (2) as the exact deploy steps
below.

## Per-counter cause

| Counter | Increment site | Process | Why it is absent from GMP |
| --- | --- | --- | --- |
| `listen_quiet_check_arm_total{outcome}` |
`backend/database/conversation_quiet_checks.py:137`
(`ARM_METRICS[outcome].inc()`), children created at import (`:32`) |
listen + pusher (GKE) and the finalization route (Cloud Run
backend-sync) | GKE: PodMonitoring scrape `up=0` (collector cannot read
the scrape secret). Cloud Run: dropped by the keep rule at
`backend/deploy/cloud_run_gmp_sidecar.yaml:19` and
`backend/deploy/cloud_run_gmp_sync.yaml:48` — the name has no `omi_`
prefix. |
| `listen_quiet_check_empty_exit_total{disposition,mode}` |
`backend/database/conversation_quiet_checks.py:226`
(`EMPTY_OUTCOMES.labels(...).inc()`), inside `_evaluate_quiet_check` |
finalization route only (Cloud Run backend-sync); never runs in
listen/pusher — confirmed absent from the in-cluster Prometheus
`backend-listen-metrics` and `pusher-metrics` jobs | Dropped by the same
two keep rules. This is the only counter that had no scraped process at
all. |
| `omi_episode_boundary_total{outcome}` |
`backend/utils/episodes/metrics.py:366` (`record_boundary`), children
primed at import (`:272`) | listen + pusher (GKE) and Cloud Run | Passes
the keep rule (`omi_` prefix), so GMP holds only the Cloud Run zero
children (`namespace=backend` 180 series, `desktop-backend` 8). The real
listen/pusher increments are missing for the same GKE scrape reason as
the arm counter. |

Evidence (read-only, 2026-11-10):

- GMP `based-hardware`: `up{job="prod-omi-backend-listen"}` = 0 for all
34
  targets, `scrape_samples_scraped` = 0; same for `prod-omi-pusher` (23
  targets). `omi_episode_boundary_total` exists only under
  `job="omi-cloud-run-application-metrics"`.
- In-cluster Prometheus `prod-omi-gke`: `listen_quiet_check_arm_total`
has 140
  series on `backend-listen-metrics` and 92 on `pusher-metrics`;
`omi_episode_boundary_total` has 700 / 460;
`listen_quiet_check_empty_exit_total`
  has none — the evaluate path never runs in a listen/pusher process.
- GMP collector log: `{"component":"secret manager","err":"watch:
unknown (get
secrets)","msg":"secret watcher failed to
start","name":"metrics-scrape-token",
"namespace":"prod-omi-backend"}`. The live prod Role/RoleBinding and the
`metrics-scrape-token` ExternalSecret were applied at 09:07Z today, but
no
collector has restarted since, and the source change (#24961) is no
longer on
  `main`.
- Dev `based-hardware-dev`: `up{job="dev-omi-backend-listen"}` = 0 and
  `up{job="dev-omi-pusher"}` = 0; dev has the PodMonitoring but no
  `*-metrics-scrape` Role/RoleBinding at all.

## Fix

- `backend/deploy/cloud_run_gmp_sidecar.yaml` and
  `backend/deploy/cloud_run_gmp_sync.yaml`: keep `listen_quiet_check_.*`
explicitly. Names are unchanged, so the in-cluster series the quiet-exit
  rollout is judged on keep their continuity.
- `backend/charts/monitoring/metric-inventory.prod.json`: declare
  `listen_quiet_check_empty_exit_total` (source-backed, not yet in the
  snapshot).
- `backend/tests/unit/test_quiet_check_metrics_are_scraped.py`: pins
both
counter names against both keep rules and asserts the module registers
them.
- `backend/tests/unit/test_attach_cloud_run_gmp_sidecar.py`: updates the
pinned
  shared-regex contract.
- `.github/failure-classes/FC-metric-dropped-by-scrape-allowlist.json`:
adds the
  new test as a guard artifact.
- Change note under `backend/docs/listen_pusher_pipeline/changes/`.

## Tests

```
cd backend
.venv/bin/python -m pytest -q \
  tests/unit/test_quiet_check_metrics_are_scraped.py \
  tests/unit/test_attach_cloud_run_gmp_sidecar.py \
  tests/unit/test_monitoring_telemetry_contract.py \
  tests/unit/test_monitoring_alert_rule_contract.py \
  tests/unit/test_conversation_quiet_finalization.py \
  tests/unit/test_quiet_check_retirement.py \
  tests/unit/test_serving_podmonitoring_chart.py \
  tests/unit/test_monitoring_alert_backtest.py
```

Result: 429 passed (247 + 182 across the two runs), 0 failed.

## Deploy steps (cl2-deploy)

Repository changes alone do not mutate Cloud Run or GKE.

1. **Cloud Run allowlist** — the sidecar config is revision-local
(`OMI_GMP_RUN_MONITORING_CONFIG`), so it ships with the next normal
deploy of
   each service. Dev first, then prod:
- `gh workflow run gcp_backend_auto_dev.yml --ref main` (backend +
backend-sync
     + backend-integration candidates), then the prod backend dispatch.
- Confirm the new revision's collector env carries the updated regex
before
     promotion; the deploy helper validates the config locally.
2. **GKE scrape auth** — blocked on re-landing #24961 (reverted at
`8141729fccd9`). Until it re-lands, the listen/pusher PodMonitoring
targets
stay `up=0` and no GKE-sourced counter can reach GMP. The live prod
cluster
already has the Role/RoleBinding and the `metrics-scrape-token` secret
from
   the 09:07Z apply; dev has neither.
3. **Restart the GMP collectors** so the secret watcher starts with the
RBAC:
   ```
   kubectl --context gke_based-hardware-dev_us-central1_dev-omi-gke \
     -n gmp-system rollout restart daemonset/collector
   kubectl --context gke_based-hardware_us-central1_prod-omi-gke \
     -n gmp-system rollout restart daemonset/collector
   ```
4. **Verify** (read-only):
   ```
sum(up{job="prod-omi-backend-listen"}) ==
count(up{job="prod-omi-backend-listen"})
   sum(up{job="prod-omi-pusher"}) == count(up{job="prod-omi-pusher"})
   ```
   Require a nonzero target count and nonzero `scrape_samples_scraped`.

## Confirming one series in dev after deploy

With `QUIET_EMPTY_EXIT_ENABLED=true` on dev listen and the dev Cloud Run
services:

```promql
# GKE listen copy (after the collector restart)
sum by (outcome) (increase(listen_quiet_check_arm_total{
  job="dev-omi-backend-listen"}[15m]))

# Finalization-route copy (after the dev backend-sync deploy)
sum by (disposition, mode) (increase(listen_quiet_check_empty_exit_total{
  job="omi-cloud-run-application-metrics", namespace="backend-sync"}[15m]))

# Episode boundary decisions from the listen fleet
sum by (outcome) (increase(omi_episode_boundary_total{
  job="dev-omi-backend-listen"}[15m]))
```

A single non-zero
`listen_quiet_check_empty_exit_total{disposition="delete_empty",mode="serve"}`
series is the acceptance signal for the quiet-exit rollout.

Failure-Class: FC-metric-dropped-by-scrape-allowlist

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Git-on-my-level added a commit that referenced this pull request Nov 10, 2026
…25040)

Re-land [#24961](#24961),
reverted by
[8141729](8141729).
The reland restores the chart, chart-test, and pipeline-note changes
from that revert. This review fix marks the 50-socket saturation stress
test `slow`, removes its duration allowlist exemption, completes chart
test selection, pins the cross-chart secret contract, covers absent
`METRICS_SECRET`, and corrects ownership/rollback documentation.

LIVE DRIFT: the 5 objects (ExternalSecret metrics-scrape-token-store;
Role+RoleBinding prod-omi-pusher-metrics-scrape and
prod-omi-backend-listen-metrics-scrape) are live in prod since
2026-11-10T09:07Z and load-bearing; this PR makes git match. They are
Helm-owned by releases `prod-omi-backend-secrets` / `prod-omi-pusher` /
`prod-omi-backend-listen`, verified at 2026-11-10T16:4xZ in the operator
handoff.

David approved this access change at 2026-11-10T08:53Z (relay-cl1
e68296), as supplied in the operator handoff. This publication performs
no production reads or writes. The live-drift statement above is the
operator's recorded state, not a fresh production measurement by this
lane.

## Shard-5 cause and fix

[Main run 42786950639, shard
5](https://github.com/BasedHardware/omi/actions/runs/42786950639/job/129738063716)
failed solely on the CPU duration guard for
`tests/unit/test_pusher_storage_pcm_saturation.py::test_50_sockets_plateau_refuse_without_ack_then_retry_once`:
**1.01 s > 1.00 s**, at 2026-11-10T09:25:14Z. All **38 tests passed** in
that file; its process exited 1 because of the guard. The `gh run view
--log-failed` output on m1 omitted the job tail; the raw job log
retrieved with `gh api
repos/BasedHardware/omi/actions/jobs/129738063716/logs` independently
confirms both lines.

Recent main measurements for that same node:

| Run | Main commit | Node call CPU | Shard |
| --- | --- | --- | --- |
|
[42762710320](https://github.com/BasedHardware/omi/actions/runs/42762710320)
(2026-11-10 05:31Z) | `9c051da5be` | 0.70 s | 4/8 |
|
[42780954447](https://github.com/BasedHardware/omi/actions/runs/42780954447)
(2026-11-10 08:13Z) | `ded44ab10a` | 0.85 s | 4/8 |
|
[42796611714](https://github.com/BasedHardware/omi/actions/runs/42796611714)
(2026-11-10 10:08Z) | `8141729fcc` | 0.77 s | 4/8 |

These are historical log measurements, re-read on 2026-11-10. The test
runs 50 producers against stubbed slow GCS while sampling
allocations/RSS; process CPU includes its threads. Adding the chart test
changes the deterministic LPT shard deal, but the CPU guard is per
process. The observations support a marginal duration-budget failure,
unrelated to chart behavior.

The documented mechanism for stress tests is `@pytest.mark.slow`
([backend/tests/README.md:79–90](https://github.com/BasedHardware/omi/blob/lane/reland-24961-m1/backend/tests/README.md#L79-L90)),
so this fix removes the node and its comment from the duration allowlist
and adds that marker. Its assertions are unchanged. The PR unit lane
excludes it through `not integration and not slow`; a direct pytest run
still executes it.

The saturation backpressure behavior guardrail is now listed at file
granularity in
[`backend/tests/slow_guardrail_manifest.txt:51`](https://github.com/BasedHardware/omi/blob/lane/reland-24961-m1/backend/tests/slow_guardrail_manifest.txt#L51);
the existing [Backend unit guardrails
job](https://github.com/BasedHardware/omi/blob/lane/reland-24961-m1/.github/workflows/backend-unit-tests.yml#L379-L381)
runs it with [`slow and not
integration`](https://github.com/BasedHardware/omi/blob/lane/reland-24961-m1/backend/scripts/run-slow-guardrails-ci.sh#L43),
without a 1.0 s CPU fail limit ([unset-limit early
return](https://github.com/BasedHardware/omi/blob/lane/reland-24961-m1/backend/tests/conftest.py#L290-L293));
the runner accepts files only (`-f` at line 30), matching existing
runtime behavior guardrails such as sliding-window limits. Local
validation via `bin/omi-heavy`: exact file selection **1 passed, 37
deselected**; full guardrail runner **2051 passed, 1435 deselected**
(350.37 s), at follow-up commit `baaa02b9aa`.

Review fixes also select both chart test files for monitoring-contract
sources, including backend-secrets; render all three charts together to
compare the ExternalSecret target, PodMonitoring credential references,
and Role resourceNames; and assert that no scrape-token ExternalSecret
renders without `METRICS_SECRET`. RBAC verbs remain `get/list/watch`:
resourceNames restricts list/watch only with a metadata.name field
selector, a plain list is denied, and the live collector requires watch
(previously failed with "watch unknown").

## Review-fix validation on m1

Current head `baaa02b9aa0e292badad58d0578ed51bdd282437`: it adds only
the guardrail-manifest entry (2 lines in
`backend/tests/slow_guardrail_manifest.txt`) on top of
`89bd3dfa0f041f1ea09b12bbc1804310e6159ae6`; guardrail selection at
`baaa02b`: **2051 passed, 1435 deselected** locally and in CI. The
review-fix validation below ran at `89bd3df`. All commands use
`~/workspace/omi-workspace/bin/omi-heavy run --` in the existing m1
reland worktree, with Google credential environment variables removed.

- Direct saturation run: `cd backend && .venv/bin/python -m pytest -q
tests/unit/test_pusher_storage_pcm_saturation.py`: **38 passed**, 9
deprecation warnings, 10.57 s, including the slow-marked stress node.
- `BACKEND_UNIT_TEST_FILE_LIST=<8 chart/selector contract files> bash
backend/test.sh`: **175 passed across 8 files**, no skips or failures.
Includes both touched chart tests (**12 passed**), selector workflow
contracts (**101 passed**), selector output, duration-allowlist
selection, Firestore selector contracts, monitoring adapter selection,
and CI runner shard-selection tests. The standard 1.0 s CPU guard
passed; one unrelated workflow-contract test emitted an advisory 0.11 s
warning.
- `PYTHON=.venv/bin/python bash backend/test-preflight.sh`: **18 passed,
8 optional warnings, 0 failed**. Optional warnings concern integration
credentials and unused provider packages.

- `OMI_PR_BODY_FILE=<body> make preflight`: **44 checks passed**, 70.09
s.

- The single push passed the normal bounded pre-push gate, including
**150 tests passed** (saturation fast lane: **37 passed, 1 deselected**)
and pinned formatting.

<details>
<summary>Final CI at the current head</summary>

CI readback for `baaa02b9aa0e292badad58d0578ed51bdd282437`, measured
2026-11-10T18:34Z (re-verified independently by merge-desk): **36
passed, 22 skipped, 0 failed, 0 pending**; merge state CLEAN. Per-check
results: https://github.com/BasedHardware/omi/pull/25040/checks

The earlier head `89bd3df` had the same totals at 17:33Z (36 passed, 22
skipped, 0 failed, 0 pending).

</details>

## Prior validation at 9e80314

Repository `BasedHardware/omi`, branch `lane/reland-24961-m1`, original
head `9e8031431e5c170775c56d789356350e1eb8f1b5`, based on `origin/main`
`6fb62a6767394006108398fccf638e868058bbbf`.

- Patch applied with `git am` without conflicts. Removed only the
model-named co-author trailer from the commit message; source diff
unchanged.
- Via `bin/omi-heavy`: `BACKEND_UNIT_TEST_FILE_LIST=<two touched chart
tests> bash backend/test.sh`: **8 passed**, including dev/prod rendering
and monitoring-off behavior; Helm installed, no skips.
- Full backend unit shard: `bin/omi-heavy run -- env -u
GOOGLE_APPLICATION_CREDENTIALS -u CLOUDSDK_CONFIG -u
CLOUDSDK_CORE_ACCOUNT BACKEND_UNIT_FILE_BUDGET_SECONDS=900 bash
backend/scripts/run-unit-ci.sh --all --shard 8/5`: **passed, 345/345
files**, using the existing native Opus fixture path documented below.
- `bin/omi-heavy run -- env OMI_PR_BODY_FILE=<body> make preflight`:
**43 checks passed**, 47.48 s. The first invocation stopped for missing
draft metadata; the completed run supplied this body.
- Explicit saturation-file run through `bin/omi-heavy` and
`backend/test.sh`: **38 passed**, including the stress node before this
review fix added its slow marker.
- On m1, `OMI_TEST_OPUS_LIBRARY=/opt/homebrew/lib/libopus.dylib`
supplies the installed native codec path to the existing retained-audio
fixture. The first shard run failed only that file because native
discovery missed it; its corrected focused rerun passed **68 tests**.
The full shard rerun uses the same native path.
- `scripts/pr-preflight --metadata-only --pr-body-file <body>` through
`bin/omi-heavy`: **5 checks passed**, 14.17 s.
- Single foreground push: **passed the bounded pre-push gate**,
including the selected **38 backend test files**, full type-check
baseline, and formatting. No hooks or tests skipped. Remote head matches
`9e8031431e5c170775c56d789356350e1eb8f1b5`.

## Rollback

Rollback by revert DELETES the scrape-token ExternalSecret and collector
Roles/RoleBindings (and the owned Secret copy), which stops
pusher/listen GMP scraping. Alternatively, set
`podMonitoring.enabled=false` on pusher/listen and upgrade them; this
removes their PodMonitoring and collector RBAC while leaving the
backend-secrets token copy in place.

## Product invariants affected

none

Failure-Class: none

🤖 Generated with [Claude Code](https://claude.com/claude-code)
MichaelC001 pushed a commit to MichaelC001/omi that referenced this pull request Nov 11, 2026
…are#24961)

Re-applies BasedHardware#24961 (merged as 48eaf3e) unchanged by reverting its revert
(8141729), and fixes the shard-5 CI failure that triggered the revert.

The shard-5 red was not BasedHardware#24961's content. Backend unit shard 5/8 in run
42786950639 failed on the per-test CPU duration guard:
test_pusher_storage_pcm_saturation.py::test_50_sockets_plateau_refuse_without_ack_then_retry_once
measured 1.01s against the 1.00s fail limit while all 38 tests in that
file passed. The same node measured 0.70s / 0.77s / 0.85s on recent main
runs; the test drives 50 real producer threads against a stubbed slow
GCS with tracemalloc and RSS sampling, so its call-phase CPU is not
stable and the fail limit sits inside its own spread. BasedHardware#24961 changed
only charts and chart tests; its new test_backend_secrets_chart.py
shifted the weighted LPT shard deal, which moved this file from shard 4
to shard 5, but CPU time is per-process, so the shard move is incidental.

Fix: exempt that node in tests/fast_unit_duration_allowlist.txt, the
documented mechanism for genuine unit tests whose measured CPU exceeds
the failure threshold. The test still runs and still asserts; only the
duration guard is exempted.

The five objects are live in prod since 2026-11-10T09:07Z and
load-bearing (pusher 22/22, listen 28/29 after the gmp-system collector
restart); this commit makes git match. David approved the access change
at 2026-11-10T08:53Z (relay-cl1 e68296).

Failure-Class: none
Git-on-my-level added a commit that referenced this pull request Nov 17, 2026
…s live (#25559)

# Pusher chart: render fieldRef apiVersion so the release receipt can
match the live PodTemplate

Failure-Class: none

Since #24961/7707faa8873 (2026-11-09), the Pusher chart sets
`ROLLOUT_POD_TEMPLATE_HASH` from a `fieldRef` with no `apiVersion`.
The API server stores the default, `apiVersion: v1`.
`backend/scripts/pusher_release_receipt.py record-live` hashes the
rendered PodTemplate and the live one, and the hashes never match.
So every development Pusher qualification fails at "Record exact live
development Pusher deployment receipt" with
`live Pusher PodTemplate semantics do not match the rendered candidate`.
No prod Pusher can be promoted until that qualification passes.
Run 43994577483, at 8b5ea50, deployed dev Pusher and then failed at that
step.
A local diff of the rendered template against the live dev Deployment
differs in exactly one field:
`env[ROLLOUT_POD_TEMPLATE_HASH].valueFrom.fieldRef.apiVersion`
(rendered: absent, live: `v1`).

- The chart now renders `fieldRef: {apiVersion: v1, ...}`. Kubernetes
already stores this value, so pods don't change meaning.
- `test_runtime_percent_export.py` asserts the Pusher chart renders the
default. It fails without this change.

This unblocks the Pusher deploy that conversations v3 needs:
finalization runs on Pusher.

## Verification

- With this chart, the rendered dev template hash equals the live dev
Deployment's hash (`pusher_release_receipt` projection).
- `tests/unit/test_runtime_percent_export.py` and
`tests/unit/test_verify_pusher_promotion_evidence.py`: 94 passed.

UI-Evidence: none -- backend chart only

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/25559?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/25559?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F25559&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. -->
Git-on-my-level added a commit that referenced this pull request Nov 17, 2026
…25570)

# Pusher chart: the isolated prod canary reuses the shared collector
Role

Failure-Class: none

Every prod Pusher promotion fails at "Create isolated production Pusher
and listener canary". Run 44020356200 is one example:

```
server-side apply failed for object prod-omi-backend/prod-omi-pusher-canary-44020356200-metrics-scrape ... Kind=Role ... is forbidden: User "omi-ci-deployer-prod@..." ...
```

Since #24961, the Pusher chart renders a collector Role and RoleBinding
for every release.
The canary is a separate Helm release named
`prod-omi-pusher-canary-<run>`, so it renders a new per-run Role.
The CI deployer cannot create RBAC, so the canary fails every time.
The shared release's objects (`prod-omi-pusher-metrics-scrape`) were
applied by hand on 2026-11-10 for the same reason.

The canary does not need its own grant. It already borrows the shared
release's identity (`serviceAccount.create=false`,
`serviceAccount.name=prod-omi-pusher`).
The shared Role already lets the GMP `collector` ServiceAccount read
`metrics-scrape-token` in the same namespace.
The chart now renders the collector RBAC only for the release that
creates the ServiceAccount.
The canary keeps its PodMonitoring, so its scrape still authenticates
through the shared grant.

- `backend/charts/pusher/templates/collector-rbac.yaml`: the RBAC now
requires `podMonitoring.enabled` and `serviceAccount.create`.
- `test_serving_podmonitoring_chart.py`: a canary-shaped render keeps
the PodMonitoring and renders no Role or RoleBinding.
  The shared dev and prod renders are unchanged.

No `.github/` change. This is the last blocker for the Pusher deploy
that conversations v3 needs.

## Verification

- `helm template` with the workflow's canary flags renders 0 Roles; the
shared prod release still renders its Role and RoleBinding.
- `test_serving_podmonitoring_chart.py`,
`test_runtime_percent_export.py`,
`test_verify_pusher_promotion_evidence.py`: 98 passed.

UI-Evidence: none -- backend chart only

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/25570?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/25570?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F25570&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. -->
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