Repository navigation
feat(desktop): outcome-based, build-attributable macOS release-health telemetry (#10425) - #10443
Conversation
Make macOS desktop health telemetry outcome-based and queryable so intermediate lifecycle events and expected noise cannot be read as customer-visible regressions. - PTT funnel: emit ptt_audio_capture_lifecycle remotely for every terminal disposition (including committed success) so a release-health query has a success denominator; short tap / quiet discard / cancel are distinct failure_class values, not unexplained no-transcript failures. telemetry_schema_version -> 2. The ambiguous floating_bar_ptt_ended had_transcript event is deprecated as a denominator. - Realtime mint: bucket phase to a closed set (warm vs barge_in_replacement); add optional outcome + mint_attempt_id so a mint failure joins its recovered/degraded/ exhausted fate on the correlated realtime_hub fallback event. - Realtime provider close: add bounded expected/lifecycle_class so expected idle teardown and planned session rotation are excluded from error rollups (they remain separately inspectable, never Sentry-reported). - Fallback: add named owners (screen_capture, memory_scope, desktop_update, tts_fallback, task_workflow, auth_storage) so known paths stop collapsing into area=other; #10425's area=other/capability_mismatch cohort is the benign ProactiveAssistants screen-capture flap, now its own area. - Privacy: content-bearing keys (transcript/audio/prompt/response/message/...) are stripped at the single record() emit chokepoint; bounded cousins like transcript_length survive. INV-VOICE-1: changes to RealtimeHubController.swift / FloatingBarVoicePlaybackService.swift add telemetry correlation keys + a fallback area label only; no new lifecycle state machine, current-turn variable, or completion timer. Verification: swift build clean; DesktopDiagnosticsManagerTests 27/27, PTTAttemptLifecycleRecorderTests 18/18, RealtimeHubSessionHandoffPolicyTests 20/20.
…0425) Native Sentry crash/app-hang/watchdog events were unfilterable by version/build and beta+stable were indistinguishable (both report environment="production"); PostHog registered no global identity so most events (incl. floating_bar_ptt_ended) carried no release cohort. - Sentry: set options.releaseName = AppBuild.releaseTag (v{ver}+{build}-macos, the Codemagic tag) and options.dist = AppBuild.currentUpdateChannel at SentrySDK.start, and tag every event (including native) with update_channel + bundle_id via a global scope. - PostHog: register app_version/app_build/update_channel as super-properties so every captured event is release-attributable; mirror app_build/update_channel onto the identify() person properties. No user content is added: only bounded version/build/channel strings.
Add desktop/macos/docs/release-health-metrics.md: the authoritative query contract defining, per signal (PTT, realtime mint, realtime session, fallback, crash, updater, recording, memory), the exact numerator, denominator, time window, minimum cohort, unknown/missing-data behavior, and release-comparison rule. Aligns to desktop_release_doctor_report.METRIC_CONTRACTS and documents the uniform Sentry/PostHog release-identity keys.
Add contract tests proving the #10425 semantics: - PTT committed success is recorded in the funnel (schema v2 denominator). - Realtime mint phase buckets to the closed set and carries outcome/mint_attempt_id. - Realtime provider close marks expected vs error lifecycle_class. - Named fallback areas (screen_capture/memory_scope/...) are not collapsed to other. - Content-bearing keys (transcript/audio/prompt/response/message) are stripped at the emit chokepoint while the bounded transcript_length cousin survives.
…view (#10425) Address three findings from the post-implementation adversarial critic: - Realtime mint join (warm path): pass mint_attempt_id to the warm-mint failoverToAlternateProvider calls so the recovered/degraded/exhausted outcome is joinable on the majority (background pre-warm) path, not only barge-in. - Restore CredentialHealthManager.shared.record in the barge-in CredentialHealthError catch (an off-by-2 edit had dropped it); credential-health observability for that path is preserved. - Privacy: extend the content-bearing key blocklist to include detail_reason/detail/ error_description/localized_description/description so free-form error text piped through detail_reason (e.g. WALService upload String(describing:)) cannot reach PostHog; bounded failure_class/area/reason are retained. Add a regression test. Verification: swift build clean; DesktopDiagnosticsManagerTests 28/28, PTTAttemptLifecycleRecorderTests 18/18, RealtimeHubSessionHandoffPolicyTests 20/20.
…table (#10425) Sentry `dist` carries the release channel (stable/beta), not the app build; the build is carried only by the `release` tag. Drop the misleading `/ dist` from the App-build row so a release-health query does not slice by channel instead of build.
- Raise the product file line-count ratchet baselines for the three telemetry-touched files (RealtimeHubController.swift, RealtimeHubController+SessionLifecycle.swift, OmiApp.swift) with one-line justifications; the growth is bounded telemetry wiring. - Add an unreleased desktop changelog fragment for the release-health diagnostics change.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f51130ef61
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if self.failoverBargeInReplacement(from: provider, reason: "other") { | ||
| phase: "barge_in_replacement", | ||
| mintAttemptId: String(mintGeneration)) | ||
| if self.failoverBargeInReplacement(from: provider, reason: "other", mintAttemptId: String(mintGeneration)) { |
There was a problem hiding this comment.
Emit exhausted fallback when barge-in mint cannot fail over
When a barge-in replacement mint fails after the hub is already on the alternate provider (so fallbackProvider != nil) or otherwise cannot start an alternate, failoverBargeInReplacement returns false and the code immediately calls failBargeInReplacement without emitting a correlated fallback_triggered outcome. The new realtime_token_mint_failed event has a mint_attempt_id, but release-health queries then have nothing to join it to for the terminal exhausted fate, undercounting active-turn realtime mint failures; record the exhausted realtime_hub fallback before failing the replacement.
AGENTS.md reference: desktop/macos/AGENTS.md:L48-L49
Useful? React with 👍 / 👎.
|
@cursor address merge conflict and review comment |
|
Addressed both items from the review thread. Merge conflictMerged
Codex review (P2): exhausted fallback when barge-in mint can’t fail overMirrored the existing
This lets TestAdded Verification
Pushed to |
…10425) Merge origin/main and resolve the floatingcontrolbar line-count ratchet conflict (keep RealtimeHubController baseline; SessionLifecycle is below threshold after main's extraction). Address Codex review: when failoverBargeInReplacement cannot start an alternate (already on fallback provider or signed out after degraded), record an exhausted realtime_hub fallback with mint_attempt_id so realtime_token_mint_failed joins its terminal outcome. Verification: make preflight (post-commit); testBargeInFailoverExhaustedWhenAlternateProviderAlreadyActive (macOS CI). Co-authored-by: David Zhang <[email protected]>
Co-authored-by: David Zhang <[email protected]>
…mainactor (#10425) Merge origin/main for CI freshness. Mark testBargeInFailoverExhaustedWhenAlternateProviderAlreadyActive @mainactor to match RealtimeHubController isolation. Prior Desktop Swift CI failure was a 60m job timeout during parallel swift-test-suites after test bundle link (TEST_RESULT=cancelled), not a compile or assertion failure. Co-authored-by: David Zhang <[email protected]>
|
@cursor address failing CI and fix any other issues you find |
|
Here’s what I found and what I changed. CI root causeDesktop Swift Build & Tests did not fail on a compile or XCTest assertion. The Desktop Swift Test Suites job hit the 60-minute workflow limit and was cancelled while On the earlier run, launcher harness tests logged a 4s build-lock timeout in a negative-control fixture but still reported A re-run after our push was cancelled when PR #10443 merged ( Fixes applied (pushed to
|
… telemetry (BasedHardware#10425) (BasedHardware#10443) # macOS release-health telemetry: outcome-based, build-attributable, privacy-safe Closes BasedHardware#10425 Makes macOS desktop release-health telemetry **outcome-based, build-attributable, and safe to use for release decisions**. Observability-contract only — no product behavior, provider, PTT UX, release-promotion, or backend change. ## Product invariants affected Path globs are touched by telemetry-only edits (labels, correlation keys, init) — no lifecycle state machine, auth-session, or chat-continuity behavior change: - INV-AUTH-1 — `AuthService.swift` (fallback area label), `OmiApp.swift` (Sentry init). - INV-CHAT-1 — `AgentRuntimeProcess.swift`, `FloatingBarVoicePlaybackService.swift`, `PTTAttemptLifecycleRecorder.swift`, `RealtimeHubController*.swift` (telemetry keys/labels). - INV-VOICE-1 — `RealtimeHubController.swift`, `FloatingBarVoicePlaybackService.swift` (optional `mint_attempt_id` correlation + a fallback area label; no new lifecycle owner). ## Root cause Several high-volume desktop signals were intermediate lifecycle events or ambiguous terminal states, so a healthy path could resemble a user-visible regression: - `floating_bar_ptt_ended` collapsed four causally distinct PTT outcomes (accidental tap, deliberate quiet discard, dead-mic capture failure, empty-after-commit) into one `had_transcript` boolean; the classified `ptt_audio_capture_lifecycle` funnel suppressed success remotely, so there was no queryable success denominator. - `realtime_token_mint_failed` had no terminal outcome and no correlation key, so a mint failure that **recovered** could not be told apart from one that **exhausted** to the cascade; `phase` was an open string. - `fallback_triggered` reported `area=other, reason=capability_mismatch` for 32/255 users — the benign ProactiveAssistants screen-capture flap mixed with genuinely degraded paths under one `other` bucket. - Expected realtime idle teardown / session rotation were separate events but had no single field excluding them from error rollups. - Sentry never set `options.release`/`options.dist`; native crash/hang/watchdog events were unfilterable by version/build, and beta+stable were indistinguishable (`environment=production`). PostHog registered no global identity, so most events (incl. `floating_bar_ptt_ended`) carried no release cohort. - No versioned release-health metric spec existed. ## What changed (one authoritative owner, bounded schemas, no second state machine) - **PTT funnel** (`ptt_audio_capture_lifecycle`, schema v2): emit every terminal disposition remotely — including committed success — so the success denominator is queryable. `failure_class` separates `capture_never_operational` (real failure) from `released_before_usable_audio`/`too_short_audible` (short tap), `cancelled`, and `zero_or_near_zero_samples`+`silent_rejected` (quiet discard). `floating_bar_ptt_ended` is deprecated as a denominator (retained for backward compatibility). - **Realtime mint**: bucket `phase` to a closed set (`warm` vs `barge_in_replacement`); add optional `outcome` + `mint_attempt_id` so a mint failure joins its recovered/degraded/exhausted fate on the correlated `realtime_hub` fallback event (wired on all 3 warm + 3 barge-in mint paths). - **Realtime provider close**: add bounded `expected` + `lifecycle_class` so expected idle teardown / planned session rotation are excluded from error rollups but stay inspectable (they remain non-Sentry). - **Fallback**: add named owners (`screen_capture`, `memory_scope`, `desktop_update`, `tts_fallback`, `task_workflow`, `auth_storage`) and update callers so known paths stop collapsing into `area=other`. `recovered` stays distinct from `degraded`/`exhausted`. - **Release attribution**: Sentry `options.releaseName = AppBuild.releaseTag` (`v{ver}+{build}-macos`), `options.dist = currentUpdateChannel`, plus global `update_channel`/`bundle_id` scope tags; PostHog registers `app_version`/`app_build`/`update_channel` super-properties (and mirrors them onto `identify()`), so every event is release-attributable. - **Privacy guard**: a content-bearing-key blocklist at the single `record()` emit chokepoint strips `transcript`/`audio`/`prompt`/`response`/`message`/`detail_reason`/ error-text keys; bounded cousins (`transcript_length`, `failure_class`) survive. - **Spec**: `desktop/macos/docs/release-health-metrics.md` — versioned query contract (numerator, denominator, window, minimum cohort, missing-data, comparison) for PTT, realtime, fallback, crash, updater, recording, memory, aligned to `desktop_release_doctor_report.METRIC_CONTRACTS`. ## Recurrence / similar-case audit A parallel Phase-A discovery swarm (4 read-only scouts) mapped every producer/consumer of PTT, realtime, fallback, and Sentry/PostHog telemetry, then a refutation pass discarded disproven/duplicate/out-of-scope candidates. The auditor confirmed the only remaining `area=other`+`capability_mismatch` path is the benign screen-capture flap (now its own area), and that `realtime_hub` capability-mismatch paths already stay in-area. ## Durable guard The `record()` content-key blocklist is the single chokepoint every health snapshot (local ring buffer + remote PostHog) flows through, so a future caller that threads a content-bearing key through `extra` is stripped by construction — defended by `testHealthEventsStripContentBearingKeysButKeepBoundedCousins` and `testWalUploadFailureStripsFreeFormDetailReason` (the latter targets the real `String(describing: error)` provenance). ## Source ownership `DesktopDiagnosticsManager` remains the one health-event owner; no second enum, state machine, or analytics path is introduced. INV-VOICE-1: the only changes to `RealtimeHubController.swift` / `FloatingBarVoicePlaybackService.swift` add telemetry correlation keys (`mint_attempt_id`) and a fallback-area label — no lifecycle state, current-turn variable, or timer. ## Privacy boundary Only bounded dimensions/strings are emitted. No transcript, audio, prompt, device identifier, or free-form local error text reaches PostHog properties or Sentry tags/contexts (content-key blocklist + the existing `allowedIncidentExtraKeys` allowlist for Sentry incidents). Tests prove it. ## Tests New contract tests in `DesktopDiagnosticsManagerTests`: PTT committed success denominator (schema v2), realtime phase bucketing + outcome/mint_attempt_id, expected lifecycle flag, named fallback areas, content-key stripping (+ bounded cousin survival), and WAL free-form `detail_reason` stripping. ## Verification evidence - `swift build` clean (executable + test target, strict concurrency / warnings-as-errors). - `DesktopDiagnosticsManagerTests` 28/28, `PTTAttemptLifecycleRecorderTests` 18/18, `RealtimeHubSessionHandoffPolicyTests` 20/20. - `make preflight`: 9/9 checks pass (incl. product-invariants, failure-class-protocol, deferred-work-markers). - **Real user-facing path:** the changed telemetry is `isDevBuild`-gated (remote PostHog/Sentry and native handlers are disabled for dev bundles), and triggering a real mint failure / fallback / native crash needs a non-dev build plus live realtime providers and physical PTT — an interactive real path is genuinely impractical to observe here. Per the issue's allowance, behavioral production-seam tests exercising the real `DesktopDiagnosticsManager.record*` paths are retained instead. `AppBuild.releaseTag` format matches the Codemagic `v{ver}+{build}-macos` tag, and Sentry dSYM upload is UUID-based, so `options.releaseName` cannot break symbolication. ## Review / critic outcomes - **Adversarial critic** (REQUEST-CHANGES → fixed): (A) privacy blocklist missed `detail_reason` (free-form WAL error text) — extended + test; (B) warm-mint failovers omitted `mint_attempt_id`, breaking the majority-path join — wired; (C) an off-by-2 edit had dropped a `CredentialHealthManager.record` call in the barge-in catch — restored. Re-verified green. - **Independent code reviewer**: APPROVE (correctness: correct). One P3 doc nit (Sentry `dist` mislabeled as build carrier) — fixed. ## Deliberate deferrals (not in scope) - Rust `fallback::record_fallback` is referenced by `docs/agents/fallback-telemetry.md` but unimplemented in `sdks/rust/` — backend/SDK contract-doc gap, not macOS. - PostHog/Sentry dashboard provisioning, Sentry-server config, backend release-evidence doctor wiring (`BasedHardware#9523`), beta auth/release-channel taxonomy (`BasedHardware#9160`), and the concrete `.113` Sentry/memory/hang/Gemini fixes (`BasedHardware#10420`) are owned by their own issues; this PR supplies only the client-side outcome/attribution contract they consume. - Cross-namespace join (PTT lifecycle int `attempt_id` ↔ realtime `voice_turn_terminal` UUID) is documented as follow-up — not required by the acceptance criteria. Failure-Class: none <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/10443?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="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->


macOS release-health telemetry: outcome-based, build-attributable, privacy-safe
Closes #10425
Makes macOS desktop release-health telemetry outcome-based, build-attributable, and
safe to use for release decisions. Observability-contract only — no product behavior,
provider, PTT UX, release-promotion, or backend change.
Product invariants affected
Path globs are touched by telemetry-only edits (labels, correlation keys, init) — no
lifecycle state machine, auth-session, or chat-continuity behavior change:
AuthService.swift(fallback area label),OmiApp.swift(Sentry init).AgentRuntimeProcess.swift,FloatingBarVoicePlaybackService.swift,PTTAttemptLifecycleRecorder.swift,RealtimeHubController*.swift(telemetry keys/labels).RealtimeHubController.swift,FloatingBarVoicePlaybackService.swift(optional
mint_attempt_idcorrelation + a fallback area label; no new lifecycle owner).Root cause
Several high-volume desktop signals were intermediate lifecycle events or ambiguous
terminal states, so a healthy path could resemble a user-visible regression:
floating_bar_ptt_endedcollapsed four causally distinct PTT outcomes (accidentaltap, deliberate quiet discard, dead-mic capture failure, empty-after-commit) into one
had_transcriptboolean; the classifiedptt_audio_capture_lifecyclefunnelsuppressed success remotely, so there was no queryable success denominator.
realtime_token_mint_failedhad no terminal outcome and no correlation key, so amint failure that recovered could not be told apart from one that exhausted to
the cascade;
phasewas an open string.fallback_triggeredreportedarea=other, reason=capability_mismatchfor 32/255users — the benign ProactiveAssistants screen-capture flap mixed with genuinely
degraded paths under one
otherbucket.single field excluding them from error rollups.
options.release/options.dist; native crash/hang/watchdog eventswere unfilterable by version/build, and beta+stable were indistinguishable
(
environment=production). PostHog registered no global identity, so most events(incl.
floating_bar_ptt_ended) carried no release cohort.What changed (one authoritative owner, bounded schemas, no second state machine)
ptt_audio_capture_lifecycle, schema v2): emit every terminaldisposition remotely — including committed success — so the success denominator is
queryable.
failure_classseparatescapture_never_operational(real failure) fromreleased_before_usable_audio/too_short_audible(short tap),cancelled, andzero_or_near_zero_samples+silent_rejected(quiet discard).floating_bar_ptt_endedis deprecated as a denominator (retained for backward compatibility).
phaseto a closed set (warmvsbarge_in_replacement);add optional
outcome+mint_attempt_idso a mint failure joins itsrecovered/degraded/exhausted fate on the correlated
realtime_hubfallback event(wired on all 3 warm + 3 barge-in mint paths).
expected+lifecycle_classso expectedidle teardown / planned session rotation are excluded from error rollups but stay
inspectable (they remain non-Sentry).
screen_capture,memory_scope,desktop_update,tts_fallback,task_workflow,auth_storage) and update callers so known pathsstop collapsing into
area=other.recoveredstays distinct fromdegraded/exhausted.options.releaseName = AppBuild.releaseTag(
v{ver}+{build}-macos),options.dist = currentUpdateChannel, plus globalupdate_channel/bundle_idscope tags; PostHog registersapp_version/app_build/update_channelsuper-properties (and mirrors them ontoidentify()), so every event is release-attributable.record()emitchokepoint strips
transcript/audio/prompt/response/message/detail_reason/error-text keys; bounded cousins (
transcript_length,failure_class) survive.desktop/macos/docs/release-health-metrics.md— versioned query contract(numerator, denominator, window, minimum cohort, missing-data, comparison) for PTT,
realtime, fallback, crash, updater, recording, memory, aligned to
desktop_release_doctor_report.METRIC_CONTRACTS.Recurrence / similar-case audit
A parallel Phase-A discovery swarm (4 read-only scouts) mapped every producer/consumer
of PTT, realtime, fallback, and Sentry/PostHog telemetry, then a refutation pass
discarded disproven/duplicate/out-of-scope candidates. The auditor confirmed the only
remaining
area=other+capability_mismatchpath is the benign screen-capture flap (nowits own area), and that
realtime_hubcapability-mismatch paths already stay in-area.Durable guard
The
record()content-key blocklist is the single chokepoint every health snapshot(local ring buffer + remote PostHog) flows through, so a future caller that threads a
content-bearing key through
extrais stripped by construction — defended bytestHealthEventsStripContentBearingKeysButKeepBoundedCousinsandtestWalUploadFailureStripsFreeFormDetailReason(the latter targets the realString(describing: error)provenance).Source ownership
DesktopDiagnosticsManagerremains the one health-event owner; no second enum, statemachine, or analytics path is introduced. INV-VOICE-1: the only changes to
RealtimeHubController.swift/FloatingBarVoicePlaybackService.swiftadd telemetrycorrelation keys (
mint_attempt_id) and a fallback-area label — no lifecycle state,current-turn variable, or timer.
Privacy boundary
Only bounded dimensions/strings are emitted. No transcript, audio, prompt, device
identifier, or free-form local error text reaches PostHog properties or Sentry
tags/contexts (content-key blocklist + the existing
allowedIncidentExtraKeysallowlist for Sentry incidents). Tests prove it.
Tests
New contract tests in
DesktopDiagnosticsManagerTests: PTT committed successdenominator (schema v2), realtime phase bucketing + outcome/mint_attempt_id, expected
lifecycle flag, named fallback areas, content-key stripping (+ bounded cousin
survival), and WAL free-form
detail_reasonstripping.Verification evidence
swift buildclean (executable + test target, strict concurrency / warnings-as-errors).DesktopDiagnosticsManagerTests28/28,PTTAttemptLifecycleRecorderTests18/18,RealtimeHubSessionHandoffPolicyTests20/20.make preflight: 9/9 checks pass (incl. product-invariants, failure-class-protocol,deferred-work-markers).
isDevBuild-gated (remotePostHog/Sentry and native handlers are disabled for dev bundles), and triggering a
real mint failure / fallback / native crash needs a non-dev build plus live realtime
providers and physical PTT — an interactive real path is genuinely impractical to
observe here. Per the issue's allowance, behavioral production-seam tests exercising
the real
DesktopDiagnosticsManager.record*paths are retained instead.AppBuild.releaseTagformat matches the Codemagic
v{ver}+{build}-macostag, and Sentry dSYM upload isUUID-based, so
options.releaseNamecannot break symbolication.Review / critic outcomes
detail_reason(free-form WAL error text) — extended + test; (B) warm-mint failoversomitted
mint_attempt_id, breaking the majority-path join — wired; (C) an off-by-2edit had dropped a
CredentialHealthManager.recordcall in the barge-in catch —restored. Re-verified green.
distmislabeled as build carrier) — fixed.Deliberate deferrals (not in scope)
fallback::record_fallbackis referenced bydocs/agents/fallback-telemetry.mdbut unimplemented in
sdks/rust/— backend/SDK contract-doc gap, not macOS.doctor wiring (
#9523), beta auth/release-channel taxonomy (#9160), and the concrete.113Sentry/memory/hang/Gemini fixes (#10420) are owned by their own issues; thisPR supplies only the client-side outcome/attribution contract they consume.
attempt_id↔ realtimevoice_turn_terminalUUID) is documented as follow-up — not required by the acceptance criteria.
Failure-Class: none