Skip to content

fix(metrics): re-land GMP scrape token and collector RBAC (#24961) - #25040

Merged
Git-on-my-level merged 3 commits into
mainfrom
lane/reland-24961-m1
Nov 10, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
lane/reland-24961-m1

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Re-land #24961, reverted by 8141729f. 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 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 (2026-11-10 05:31Z) 9c051da5be 0.70 s 4/8
42780954447 (2026-11-10 08:13Z) ded44ab10a 0.85 s 4/8
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), 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; the existing Backend unit guardrails job runs it with slow and not integration, without a 1.0 s CPU fail limit (unset-limit early return); 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.

Final CI at the current head

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).

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

Git-on-my-level and others added 3 commits November 10, 2026 10:19
Re-applies #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 #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. #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
Mark the 50-socket saturation stress test slow instead of duration-allowlisting it. Select both scrape-auth chart tests for monitoring changes, compare secret names across all three charts, and cover missing METRICS_SECRET.

Document Helm ownership and destructive rollback, and explain the field-selector restriction and collector watch requirement without changing RBAC verbs.

Failure-Class: none
List the saturation file in the existing slow-guardrail manifest so the slow-marked plateau/refuse-without-ACK/retry behavior runs in the recurring guardrail job. The manifest supports file granularity; its marker filter selects only this slow test.

Failure-Class: none
@Git-on-my-level
Git-on-my-level merged commit 7e38366 into main Nov 10, 2026
66 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/reland-24961-m1 branch November 10, 2026 19:39
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