Skip to content

fix(stt): initialize stream-close alert counters at startup - #21327

Merged
Git-on-my-level merged 1 commit into
mainfrom
fix/stt-close-zero-init
Oct 12, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
fix/stt-close-zero-init

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

Pre-create all 55 bounded provider/reason children of omi_stt_stream_close_total at process import/startup. A scraped zero makes the first Soniox budget-exhaustion close visible to increase() instead of creating its first sample at one. Initialization is idempotent and covers streaming plus direct Soniox users.

Add a startup-exposition contract for every Prometheus expression in backend/charts/monitoring/alerts/*.json, scoped to metric definitions in backend/utils/metrics.py and backend/llm_gateway/gateway/metrics.py. Existing sparse counters/histograms have individual reasons in DECLARED_SPARSE; the test rejects new debt and stale declarations. This reuses the existing backend unit-test runner and registry exposition, rather than adding a separate checker. It guards the supplied 2026-09-28 Soniox 402 outage class and 2026-10-12 zero-series evidence.

Validation

  • BACKEND_UNIT_TEST_FILE_LIST="$PWD/.agent-test-files.txt" BACKEND_PYTEST_WORKERS=2 bash backend/test.sh: 125 passed across six files (6 new contract/regression tests, 15 provider-health, 35 Soniox typed-rejection, 49 alert-rule contract, 20 alert-behavior tests).
  • BACKEND_UNIT_TEST_FILE_LIST="$PWD/.agent-focused-test-files.txt" BACKEND_PYTEST_WORKERS=2 bash backend/test.sh: 6 passed on the final new-test revision.
  • Verify all bounded children at zero, first Soniox budget close 0 → 1, repeated initialization preserves counts, and every committed close selector matches initialized samples.
  • scripts/pr-preflight --lane local --pr-body-file .agent-pr-body.md: 31 checks passed, including the hermetic Firestore guard (733 tests across seven files).
  • scripts/pr-preflight --pr-body-file .agent-pr-body.md --metadata-only: 4 checks passed against committed head f6e5dd58f1498d437efa0cc2a414b0885a2fed57.
  • Confirmed the changed-file selector includes both new test_monitoring_stt_*zero_init.py files for an edit to alerts/live-stt.json.
  • No production API or deployment verification performed. Prometheus must scrape zero before the first close; initialization cannot recover an event before the first scrape. The monotonic scrape fixture checks the positive input delta; it does not execute PromQL or emulate resets/extrapolation.

Product invariants affected

none

Failure class

Line-Count-Exception: backend/utils/stt/streaming.py | 2367 -> 2369 | two lines wiring the stream-close zero-init beside the existing connect zero-init at the same startup point

Failure-Class: FC-alert-never-provably-fired

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

Failure-Class: FC-alert-never-provably-fired

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 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-12T16:39:17.804637Z ae3b8ec 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
Git-on-my-level merged commit 543e520 into main Oct 12, 2026
62 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/stt-close-zero-init branch October 12, 2026 16:49
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