Skip to content

feat(monitoring): page on recording transcript/summary outcome and blocked projection heads - #25617

Closed
Git-on-my-level wants to merge 6 commits into
mainfrom
lane/outcome-alert-transcript-summary
Closed

Git-on-my-level wants to merge 6 commits into
mainfrom
lane/outcome-alert-transcript-summary

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What this does

Adds a page on Omi's core promise: a recording gets a transcript and a summary within minutes. It also adds cause-level pages that would have caught the 2026-11-16 projection stall within about 15 minutes.

From 2026-11-16 18:50Z, summaries for finished batch-live recordings fell from about 60% to about 10% for 21 hours, and nothing paged. (#25479 / #25597; the record is in the meta repo under data/run-2026-11-17-discussion-notes-rootcause/.)

This PR is measurement and alerting only. It changes no admission, merge, projection, notes or release behaviour.

Why the existing alerts stayed silent (evidence, read 2026-11-17 16:00–16:40Z)

Checked against live Grafana provisioning (read token), GMP and in-cluster Prometheus (ro-prod), and Cloud Logging:

Signal Why it was silent
omi-batch-delivered-share-language and the "Delivered within 5 min" tile Not provisioned. The last production alert import was 11-14 08:07Z, and the rule merged 11-13. 43 committed rules are not live, including all 29 census rules and the 3 pipeline-ledger rules. Even if provisioned, both the rule and the tile read datasource prometheus (in-cluster). The omi_batch_pipeline_delivered_share_* family exists only in GMP (25 series from backend-integration), so the rule would read NoData, which is configured as OK. The live tile shows "no traffic". The rule was also agent tier, muted by omi-tier-silent. The share is also unsuitable as an outcome signal: its denominator is jobs admitted 20 to 5 minutes ago (sealed units only), it has no lane, and it read 10–40% both before and during the incident with no cliff at 18:50Z.
omi_batch_projection_obligation_oldest_age_seconds Rose linearly from about 2.52M to 2.62M s (about 29–30 days) through the incident. Held quarantine_held receipts pin it.
omi-pipeline-projection-drain-stall, -firestore-contention, -upload-503-storm The logging.googleapis.com/user/omi_pipeline_* log-based metrics were never created in production (gcloud logging metrics list: none of the four exist). The rules read NoData, treated as OK, and the stall rule was paused as well.
omi-batch-unit-unpublished-2h Paused.
omi-census-age-p-pending, omi-census-age-pl-* (page) Not provisioned. The census state gauges also do not exist anywhere: omi_batch_pipeline_census_snapshot_timestamp_seconds reads 0.
omi-pipeline-ledger-* Not provisioned. omi_pipeline_ledger_refreshed_at_seconds is 0 (the census never ran), and omi_pipeline_ledger_rows{stage} is an in-process up/down gauge that reads negative.
omi_closed_to_summary_seconds / omi_accept_to_summary_seconds Latency histograms that observe only completed work. They carry no batch-live lane, and closed_to_summary is dropped by the sync GMP keep list.
Journey SLOs, timeliness Cover live STT, chat and pusher, not post-recording delivery. The timeliness scan-blind rule was firing but is agent tier and muted.

Root causes, in order:

  1. Rules merged but never imported to production.
  2. Rules on a datasource that does not carry the family.
  3. NoData configured as OK.
  4. Agent-tier routing that is always muted.
  5. No signal with an independent denominator.

This PR fixes 2–5 for this promise. Item 1 is a provisioning step for the operator; see Activation.

What's added

  • Outcome SLI: omi_batch_pipeline_recording_outcome_{finished,transcribed,summarized}_window_total (plus _sample_age_seconds and _sample_timestamp_seconds).
    • Of completed batch_live_v1 conversations finished 45 to 15 minutes ago: how many in total, how many with record_projection_revision > 0 (transcript landed), and how many with summary_output_present == true.
    • Three Firestore count aggregations once a minute on the backend-integration serving maintenance leader. This uses the same lease, timer and executor as the fresh-delivery guard (utils/batch_pipeline/recording_outcome.py, database/batch_pipeline_recording_outcome.py).
    • The denominator is every finished recording, so a stall in any stage lowers the share.
    • Indexes: the denominator uses the existing record_seal_repair_oldest_completed. Two new collection-group composites are declared: recording_outcome_summarized and recording_outcome_transcribed (the latter has two range fields, ordered lexicographically).
    • Read budget: max(1, ceil(entries/1000)) per count, so normally 3 reads per minute (about 4,300/day). The planning envelope is 5,000 recordings per cohort, or 21,600/day.
    • A failed triple withdraws the counts; counts expire at 180 s. Kill switch BATCH_PIPELINE_RECORDING_OUTCOME_ENABLED is default on and registered.
    • The sync lane is not covered. A sync row's finished_at is the device clock and uploads arrive hours late, so a "finished 15–45 min ago" cohort has no honest meaning there.
  • Blocked-head counter: omi_batch_projection_walk_stops_total{stop,progress}, one increment per owner-drain turn.
    • Labels use the closed projection_walk_stop.STOP_CLASSES. The open blocked_<slug> family folds to blocked or blocked_privacy; the existing turn log line keeps the full token.
    • The alerted children are zero-initialised. The counter is added to the Cloud Run GMP keep list (deploy/cloud_run_gmp_sync.yaml); the gauges already match batch_pipeline_.*.
  • Five page-tier rules, Telegram receiver, no mute, on gmp-cloud-run. See the table below.
  • Core Features dashboard:
    • "Transcript within 15 min" and "Summary within 15 min" with trends, on the first screen after the existing eight tiles.
    • "Blocked projection" and "Fresh unprojected" in Is anything stuck?.
    • All four read gmp-cloud-run.
  • Docs: runbook backend/docs/runbooks/recording-outcome.md (what to check first: deployed build per service including the GKE worker image, stop tokens, BATCH_SOURCE_REUSE_ENABLED); batch CONTRACT entry; pipeline change note; monitoring README.

Alerts

Rule Expression (selector: project_id=based-hardware, cluster=__run__, job=omi-cloud-run-application-metrics, namespace=backend-integration) Fires when Severity / routing NoData
omi-recording-outcome-fast max(transcribed / (finished >= 50)) < bool 0.6 labelled outcome=transcript, or max(summarized / (finished >= 50)) < bool 0.1 labelled outcome=summary, or 0 * max(finished) 10m pending, keep firing 30m critical, page, Telegram Alerting (sampler blind)
omi-recording-outcome-slow sum(sum_over_time(num[6h])) / sum(sum_over_time(finished[6h])); transcript < 0.70 or summary < 0.25; average cohort >= 50 30m warning, page OK (fast owns blindness)
omi-batch-fresh-unprojected-share (max(fresh_unprojected_ratio) > bool 0.1) * (max(fresh_committed_window_total) >= bool 500) 10m critical, page OK
omi-batch-projection-heads-blocked sum(increase(omi_batch_projection_walk_stops_total{stop="blocked",progress="none"}[10m])) >= 50 5m critical, page OK
omi-batch-result-marker-skew sum(increase(omi_fallback_total{component="sync_dispatch",from_mode="row_source_marker",to_mode="job_source_marker"}[30m])) > 0 5m warning, page (repeat 24h) OK

Threshold sources.

  • Outcome rules. I replayed the gauge every 60 s from 192,484 batch-live rows (ro-prod Firestore; finished 11-09 18Z to 11-17 16Z; presence and clock fields only). The only healthy stretch was 11-15 10Z to 11-16 13Z (1,620 samples):
    • Transcript share: never below 0.67 (median 0.79).
    • Summary share: never below 0.17 (median 0.42).
    • The 30-minute cohort never held fewer than 171 recordings, so the 50 floor does not bind in the overnight trough.
  • Fresh ratio. The 15-minute sustained ratio stayed under 0.095 outside 11-14 06Z.
  • Blocked turns. Zero non-privacy zero-progress blocked turns in Cloud Logging from 11-09 18Z until 18:56Z.

Backtest (read-only production data)

Rule Data Would have fired on 11-16 7 days before
omi-recording-outcome-fast Firestore replay of the new gauge (not a live series) 15:21Z on the summary leg (finish-to-summary median had grown from 18 to 123 min since 13Z, a separate degradation that was also never paged); 20:07Z on the transcript leg 7 episodes, firing 129 of 168 h, all inside measured degradation: 47–87% of batch-live summaries landed more than 3 h after finish on 11-09..11-14, versus 4–11% from 11-15. 0 in the healthy stretch.
omi-recording-outcome-slow same replay 16:27Z (summary), 21:58Z (transcript) firing through the same degradation (11-10 01Z to 11-15 15Z); 0 in the healthy stretch
omi-batch-fresh-unprojected-share GMP history of the existing gauge (first sample 11-14 03:57Z) 19:33Z 2 episodes of under 20 min at 11-14 06Z, inside the 11-14 transcript backlog; 0 otherwise
omi-batch-projection-heads-blocked Proxy: the counter is new. Cloud Logging owner_drain outcome=turn ... advanced=0 ... stop=blocked_* (non-privacy) lines: 11, 31, 24, 68 and 189 per minute from 18:57Z about 19:04Z 0
omi-batch-result-marker-skew Proxy: the counter was not serving during the incident. It uses the same refused rows (blocked_immutable_result_binding_mismatch), first seen at 18:57Z about 19:05Z 0

The fresh and skew rules are verifiable live today:

Notes on the replay:

  • Landing clocks are summary_first_pending_at (transcript) and summary_completed_at (summary).
  • The transcript clock is never after the summary clock and is not co-stamped (checked per day).
  • 2,525 projected rows without a transcript clock are counted as landed at finish, which is optimistic.
  • A re-summary that restamps summary_completed_at would overstate lateness for old rows. I could not rule that out from the fields alone.

The "by about 19:30Z" target is met by the cause pages (blocked heads at about 19:04Z, fresh unprojected at 19:33Z). The transcript leg alone needs until 20:07Z because owners blocked one by one: the cohort share went 0.83 → 0.73 at 19:30 → 0.61 at 19:55. A 0.65 threshold would fire at about 19:50Z, but it sits within 2 points of the healthy floor.

Activation (what needs a deploy)

Step Owner Effect
1. Create indexes recording_outcome_summarized and recording_outcome_transcribed (gcp_firestore_indexes.yml) index workflow the numerator counts succeed
2. Deploy backend-integration with this change release train gauges and walk-stop counter appear in GMP
3. Confirm count(omi_batch_pipeline_recording_outcome_finished_window_total{namespace="backend-integration"}) == 1 and sample age < 120 s operator —
4. Provision alerts and dashboard (grafana_dashboard_provisioning.yml, environment=prod) operator pages live
  • omi-batch-fresh-unprojected-share and omi-batch-result-marker-skew read families that are already in production. They work as soon as they are provisioned.
  • If omi-recording-outcome-fast is provisioned before step 3, it pages as blind. That is intended.
  • Nothing was provisioned, deployed or written by this PR.

Not established

  • I could not backtest the walk-stop counter or the outcome gauges as live series; both are new. The backtests above are a replay and a log proxy, labelled as such.
  • Whether owner_drain INFO lines are sampled by the app-stdout-info-sample90 exclusion. Its keep-list mentions batch_projection, and the threshold holds either way.
  • The prior-week degradation is measured from row clocks, not from an independent pipeline metric of that period.

Tests

  • New tests/unit/test_recording_outcome_monitoring.py (28 tests): exact production count shapes against a fake count client, bounds, index declarations, collector expiry and failure withdrawal, kill switch, stop-class closure and zero-init, GMP keep list, split/combined equality and lint, page routing, NoData semantics, PromQL thresholds, dashboard placement and datasource.
  • New owner-drain test: a zero-progress blocked_immutable_result_binding_mismatch turn increments stop="blocked",progress="none".
  • Updated contracts: first-screen panel set, the alert-metric source scan (resolves collector PREFIX + METRICS), the drain test's log-metric subset, fresh-guard metric doubles, and the flag budget.
  • Runs (all via bin/omi-heavy, cloud credentials unset):
    • Firestore guard set: 607 passed.
    • 96 monitoring/flag/telemetry test files.
    • The touched contract files: all pass.
  • python3 backend/scripts/provision_monitoring_alerts.py --lint: 274 definitions validated.
  • python3 backend/scripts/alert_backtest.py --lint: no failures.
  • All five expressions executed against GMP (read-only) without error.

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

Git-on-my-level and others added 4 commits November 17, 2026 23:36
…ocked projection heads

From 2026-11-16 18:50Z summaries for finished batch-live recordings fell from
~60% to ~10% for 21 hours with nothing paged. This adds an outcome SLI with an
independent denominator (recordings finished 45-15 min ago, three Firestore
count aggregations on the serving maintenance leader), a closed walk-stop
counter for refused projection heads, five page-tier rules on gmp-cloud-run,
first-screen Core Features tiles, and a runbook with backtests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ily declarations

Panel review review-20261117t170424-bec9 F1, F3, F4: the tiles and runbook now
say the share is presence in the 15-45 minute cohort and that a transcript is
the first projected unit; every non-log gmp-cloud-run declaration must be read
by a rule; the sampler documents why it keeps the last triple during a count.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Nov 17, 2026
Cloud Run intake and the separately deployed GKE ordered merger must not
depend on copying a required marker in lockstep. A stale copier
previously committed protocol-2 source results without the marker and
blocked the owner's projection chain (#25479 / 2026-11-16).

This change makes source-marker recovery from the immutable job a
permanent counted contract, adds one registry used by
intake/alias/fallback producers, both merge paths and projection, and
stamps `required_result_markers` on new jobs. A current merger refuses
unknown protocol/marker requirements before writing a result or
consuming an owner log sequence, leaving work ready for a capable
merger. The refusal counter is exported by each GKE worker child's
private metrics registry as well as Cloud Run.
`BATCH_RESULT_PROTOCOL_GUARD_ENABLED` defaults on; false restores legacy
copying. Explicit conflicting versions remain refused; null copies are
treated as missing only under a supported explicit job map. A witnessed
legacy projector alias-to-own-audio transition may retain its unknown
envelope; only that exact known marker transition is interpreted,
without modifying the job or accepting unknown requirements. A full
provider/usage replay covers it.

The registry covers job-authoritative source metadata, not compute
capabilities. No capability heartbeat is added: one upgraded replica
cannot prove the absence of old workers. New semantic readers still
deploy first. A pre-guard worker may omit copies; the reader recovers
registered markers from the job. No production access, deploy, merge,
requeue, account change, or flag change. #25617's alerting and
projection-drain files are unchanged.

Validation: 627 tests across 10 focused unit files pass in separate
pytest processes via omi-heavy; new regressions cover real admission
plus historical merger-copy behavior and successful alias
projection/owner watermark advancement, canonical intake through
scheduler/merge, wrong-copy refusal, unknown protocols/markers without
log mutation, accepted-alias fallback refusal, kill switch, registry
completeness, and actual GPU worker /metrics export. The lifecycle
writer inventory also passes all 1899 cases through backend/test.sh
after updating the reviewed field sites for centralized stamping. See
the run record for final preflight/CI results. These are local synthetic
transaction/state-machine checks, not runtime acceptance.

Pre-push also exposed an existing stale failure-class migration test: it
copied a seed that now has a family while asserting the family was
absent. Its temporary fixture now explicitly removes that field; the
assertion and CLI behavior stay unchanged.

Scope panel: scope-20261117t172601-0ddf, launched before implementation.
Review panel review-20261117t181832-92dc completed with all six findings
triaged: five accepted and addressed (legacy stamping, positional/global
completeness checks, operator response and null copies), one rejected
because incapable workers must not reinterpret unknown protocols using
old slot assumptions. The final source head is being validated after
those fixes. No merge/deploy approval is implied.

Failure-Class: FC-mirrored-model-omits-new-member
Batch-State-Exit: Unsupported result protocol requirements remain
result_ready with merge_pending=true and existing audio/result custody;
a capable merger commits the same job without repair/requeue. Refusal
attempts are counted; no terminal state, new queue, or timer is
introduced.


Final CI follow-up: a pre-existing concurrency test passed every
assertion but repeatedly billed a cold lazy lifecycle-module import to
its 1-second call-phase CPU budget. A module-scoped test fixture now
loads that same real lifecycle owner during setup, matching the duration
guard's documented exclusion of per-process import work. Actual
transaction/reconcile code, assertions, production V3 behavior, rollout
flags and CPU limits are unchanged. All 26 tests pass canonically; the
previously slow call measured 0.14 CPU seconds locally.
Git-on-my-level added a commit that referenced this pull request Nov 17, 2026
Completed batch-live captures retain a finalization job ID after
raw-capture handoff. Projection debt admission therefore refused them as
`generation_owned`, even when the bound finalizer job was already
completed successfully. A pending timestamp from enrichment acceptance
also incorrectly prevented a missing due time from being armed. The
placeholder-title admission in #25611 did not remove either guard.

The projection transaction now verifies the finalizer's
owner/conversation/revision, terminal success, completed fanout and
immutable non-BYOK custody, then commits generation-bound summary
custody with the transcript and armed debt. Active, mismatched, failed
and BYOK generations remain fenced, including a completed requires_byok
job after the account switch turns off. Pending-only rows retain valid
non-future original clocks; malformed/future clocks fall back to
acceptance and expired clocks remain unarmed. A malformed finalizer ID
refuses debt without aborting transcript projection. Legitimate unbound
orphan records keep the existing debt policy without a custody
exception. The existing default-on `SUMMARY_PROJECTION_DEBT_ENABLED`
switch disables enrollment and the custody exception. Projection and
repair continue sharing the conversation-keyed enrichment outbox and its
active leases; no new task producer is added.

The new unit suite runs Projector -> ProjectionSession -> assignment ->
replacement -> real codec -> stored conversation. The original code
committed a transcript with no due time. The regression now covers
blank/placeholder titles, pending clocks, generation/BYOK fences,
kill-switch rollback, SDK deletion semantics, receipt-only acceptance
and repair over an active enrichment lease. Literal metadata writes are
registered in the lifecycle AST inventory; refusal logs contain only
bounded static reasons, no customer/job identifiers.

The CI follow-up removes duplicate module parsing and skips
expression-only subtrees in the assignment-constant inventory; five
cases preserve constants through control flow and nested scopes. All 26
transaction tests remain in the fast lane. A module fixture prepares the
real lazy lifecycle/speaker-evidence dependencies before the
concurrent-reconcile call, following the existing summary-delivery
fixture convention. Import failures still fail the suite; the unchanged
whole-file wall limit includes their cost. The replay and every
concurrency assertion stay real. No threshold, allowlist, marker,
workflow or product/rollout change.

Rollback behavior: setting `SUMMARY_PROJECTION_DEBT_ENABLED=false`
pauses both new enrollment and repair admission through existing
batch-live finalization proofs. It retains their pending/due markers;
ordinary already-enqueued enrichment continues independently.
Re-enabling restores proof-based admission while the generation,
privacy, BYOK, summary and age guards still pass. A pause extending past
the repair age window requires a fresh residue count and separate
approval before any enrollment/backfill. The flag does not delete
receipt metadata or cancel existing enrichment.

Validation: guard-enabled authoritative test.sh through omi-heavy passes
36 arming cases, all 26 transaction cases, 259 lifecycle invariants (86
existing xfails) and 1,901 writer-inventory cases. Complete local shards
1/8 (133 files) and 2/8 (156 files) pass with the normal guard enabled
and four workers. GitHub checks are authoritative for current-head CI;
the owning report links exact-head panel and triage receipts. Full
runtime source closure covers all 19 registered images. The selected
failure-class gate also exposed a stale missing-family fixture: its
temporary definition now explicitly removes the migrated seed family,
retaining the original assertions.

Historical investigation used ro-prod metadata aggregates only. Server
document update_time proves some due markers already existed before
November 16; retained finalizer IDs still prevented repair admission
under the old predicate. This is a latent projection-admission gap, not
a universal absence of due fields or a reconstructed historical arming
rate. Owning evidence and full five-question report:
`data/run-2026-11-17-discussion-notes-rootcause/lane-f/REPORT.md` on
m5-mbp. Follow-up CI/review receipts are in its `ci-followup/`
directory. No titles/transcripts/user IDs were emitted by the historical
probes. The required dated pipeline note and canonical summary-custody
section document the conditional read, custody boundary and rollback.

Already-drained enrollment remains proposal-only. The report specifies
the exhaustive read-only count and five-field transactional patch, with
fresh privacy, generation, age, summary and manual-edit guards. Neither
that residue count nor backfill was run. Production writes require
David's separate approval. No merge, deploy, flag change, requeue, index
creation, record sealing, in_progress backlog or v3 rollout/behavior
change. No overlap with #25617 alerting files.

Failure-Class: FC-content-write-omits-implied-obligation
Line-Count-Exception: backend/database/conversation_finalization_jobs.py
| 3639 -> 3640 | Extract the existing collection constant into an
import-safe schema module; no finalizer behavior changes.
Use the native safe YAML loader when checking the full feature registry. Keep the flag lifecycle, fail-open policy, and default-on assertions.

Failure-Class: none
@Git-on-my-level

Copy link
Copy Markdown
Member Author

When this PR returns to the merge queue, please update its branch against current main and let backend CI run on the refreshed PR. Link the fresh test_pipeline_env_surface_holds_its_budget pass and the tested head or merge SHA in the merge handoff. The November 30 budget audit found overdue entries in this PR’s older GitHub merge ref, so the previous CI run does not establish coverage for the refreshed base.

Quality tracking and merge-ref audit

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Closing under the approved stale PR disposition. This conflicting alerting branch has no confirmed current paging gap or alert owner. Reopen if the monitoring owner confirms a gap and accepts ownership of the alerts.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @Git-on-my-level 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

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