Skip to content

fix(app): verify pendant capture from arriving audio and recover a silent link - #20378

Merged
Git-on-my-level merged 7 commits into
mainfrom
lane/pendant-silent-capture-review
Oct 3, 2026
Merged

Git-on-my-level merged 7 commits into
mainfrom
lane/pendant-silent-capture-review

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What this fixes

On 2026-10-02 an Omi pendant stayed Bluetooth-connected to an iPhone for about 16 hours while no audio notifications reached the app. Every launch restored the old link from CoreBluetooth's cache, the app showed "Connected" and "Pendant Listening", nothing detected the stall, nothing recovered from it, and about 15.5 hours of audio were lost. Toggling Bluetooth fixed it at once.

Nothing malfunctioned: the app inferred "capturing" from connection state, and each component allowed the state the others assumed was impossible. This change makes the capture claim depend on audio actually arriving, and adds one bounded automatic recovery.

What changes

iOS and shared Dart

  • A restored or replayed link starts unverified. Only a confirmed audio subscription plus audio on the current connection verifies capture; the evidence expires after 30 seconds without audio.
  • Subscription requests now have a result. A missing characteristic, a failed notification-state change, or no answer within 20 seconds reaches Dart as a failure.
  • When capture is authorised and audio evidence is absent or has stopped, native code runs one bounded recovery: repair the subscription once, then one real disconnect and reconnect that waits for the native disconnect, rediscovers and resubscribes. It is not recorded as a user disconnect.
  • The recovery budget is persisted before each radio action, so relaunches and replayed readiness cannot refill it. It re-arms only after 60 seconds of sustained audio and six hours since the attempt.
  • Recovery defers while offline-sync notifications have arrived within the last 30 seconds, and respects pause, calls and device switches.
  • Silence after a fresh, confirmed connection is not treated as a fault, because released firmware sleeps its microphone in a quiet room while staying connected.

What the user sees

  • The capture card, transcript and Pause control stay visible. While capture is unverified the card is labelled "Pendant" with no "Listening" claim and no advancing timer.
  • Nothing new is shown while healthy or while recovery is running. The existing recovery banner appears only when recovery has failed and the user can act.

Telemetry

  • Recording Started now waits for audio. A new Recording Requested event keeps the attempt denominator; the scorecard query, consumer and metric definitions are updated together.
  • Diagnostics and telemetry record the unverified interval, confirmed subscription state, and each recovery stage and outcome.

Android and other devices

  • Android reports the real CCCD result to Dart; its queueing and GATT lifetime are otherwise unchanged.
  • Devices without native ingress ownership (OpenGlass, Bee, Fieldy, Friend, Limitless, and everything on Android) keep the existing bounded Dart resubscribe.

Policy choices to confirm

Each is a single constant or switch:

  • Unverified capture hides "Listening" and its timer but keeps the card (hideUnverifiedListening).
  • After recovery is exhausted the link is kept; the pendant is not deliberately disconnected to force offline storage (Policy.exhaustion = .keepLink).
  • A quiet room costs at most one subscription repair and one reconnect per six hours.

Product invariants affected

  • INV-UI-1: neutral colours retained.
  • INV-UI-3: reuses LiveCaptureCard, ConversationStateAppBar, CaptureRecoveryBanner and existing localized strings; no new UI primitives or strings.

Failure-Class: FC-bridge-liveness-without-data-path-proof

Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 3799 -> 3877 | Bind current ingress proof, subscription failures and explicit Resume connection into the existing controller. Radio recovery and transfer policy remain isolated in small owners.

Verification

  • Flutter: targeted suites for capture, transports, device service, lifecycle telemetry and both presentation surfaces pass locally (336 in the last run). The full app wrapper passed 3,926 with 5 skipped two revisions ago, with one unrelated teardown failure in local_recordings_owner_test.dart; it was not repeated after the last two revisions.
  • Native policy tests (Ruby harness over the production Swift health, session and transaction classes): 61 tests, 876 assertions pass, including the incident sequence (cached services, working reads, zero notifications, repeated launches) and late disconnect, late failure and late success after a timeout.
  • Scorecard: 35 tests pass, including the checked-in query and reversed row order.
  • Reviewed in four passes by an independent reviewer; the last pass found no blocking findings.

Not verified

  • No full iOS or Android build was run locally.
  • No physical iPhone and pendant run. The app-initiated reconnect is assumed, not shown, to recover a link the way the Settings Bluetooth toggle did.
  • Energy cost is unmeasured.

Known limitations and follow-ups

  • This proves audio is arriving, not that it is durably stored. While iOS has the app suspended or killed, no recovery can run, and released firmware still drops audio on a connected, unsubscribed link.
  • The offline-sync deferral counts any notification on the storage characteristic, including control responses.
  • Android callback serialisation and GATT lifetime fencing are a separate follow-up.
  • Not addressed here: the native capture journal, pendant-side retention until acknowledged, firmware changes, the duplicate cold-start recording start, and restored connected_at / cached RSSI provenance.

🤖 Generated with Claude Code

Review in cubic

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 50 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread app/lib/services/devices.dart Resolved
Comment thread app/lib/services/devices.dart Resolved
Git-on-my-level and others added 2 commits October 3, 2026 05:13
…lent link

A pendant could stay Bluetooth-connected for hours while no audio reached
the app: a restored link was treated as capturing, nothing detected zero
ingress, and nothing forced a fresh connection.

Capture health on iOS now starts unverified on a restored or replayed link
and is established only by a confirmed audio subscription plus audio on the
current connection. When evidence is absent or stops, native code runs one
persisted-budget recovery: repair the subscription, then a real disconnect
and reconnect. The Listening claim and timer follow that evidence; the card,
transcript and controls stay. Subscription results are reported to Dart on
both platforms, and Recording Requested keeps the telemetry denominator now
that Recording Started waits for audio.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-flagged tests

Register the capture health and recovery transaction harnesses in the checks
manifest so CI runs them, and let the BLE policy test run on its own. Make
four tests assert what their names claim, keep the subscription-failure
event in the scorecard export, and word the changelog as an attempt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level force-pushed the lane/pendant-silent-capture-review branch from 57239d6 to 2148b3f Compare October 2, 2026 22:39
…path

Address the remaining review findings on the pendant capture link:

- Bound the accepted CCCD write with a 15s native timeout mirroring iOS
  OmiCaptureHealth.Policy.operationTimeout, so a missing
  onDescriptorWrite fails the pending completion and releases the GATT
  queue instead of blocking Dart's retry behind it forever. The pending
  map entry is the ownership token: a late ack after timeout or cleanup
  settles nothing and cannot double-release a later command's slot.
- unsubscribeCharacteristic gets the same sentinel, timeout, and
  try/catch treatment (same unbounded-wait defect class).
- cleanupPeripheral now fails and removes pending CCCD completions and
  their timeout callbacks for the torn-down peripheral.
- subscribeCharacteristic never throws synchronously (pre-check and
  queued body wrapped); the generated Pigeon handler cannot strand Dart
  without a reply. BleHostApiImpl adds the same guard.
- Recovery resume goes through existing.connect() instead of the bare
  transport: transport failures surface as DeviceConnectionException
  like the cold-connect path, and the pendant time sync runs after the
  link returns. The service state callback is re-passed so subscribers
  keep receiving state changes.
- Recheck native ingress ownership after the feature-gate await so a
  legacy episode cannot land invisibly and block later declarations.
- _resolveIfActive on ingress-failed episodes releases the telemetry
  slot while retaining the native-owned ingress failure.
- The verified ingress start survives a lease expiry (only withdrawn
  proof clears it) so the capture timer continues instead of restarting
  at zero when audio returns.
@Git-on-my-level
Git-on-my-level force-pushed the lane/pendant-silent-capture-review branch from 2148b3f to 9f62d1d Compare October 2, 2026 22:56
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Addressed the remaining review threads in 9f62d1d (rebased onto current main):

  • CCCD ack timeout (Android): accepted descriptor writes are now bounded by a 15s native timeout mirroring iOS OmiCaptureHealth.Policy.operationTimeout (under Dart's 20s wait). The pending-subscription entry owns the queue slot, so a late onDescriptorWrite after timeout/cleanup settles nothing and cannot double-release a later command. unsubscribeCharacteristic gets the same sentinel/timeout/guard treatment, and cleanupPeripheral fails pending CCCD completions for the torn-down peripheral.
  • Sync-throw in the Pigeon handler: subscribeCharacteristic never throws synchronously — every failure path (including malformed UUID lookups) replies through the completion; BleHostApiImpl adds the same guard. The generated handler is stock Pigeon output, so the fix lives in the hand-written implementation it calls.
  • Recovery resume (devices.dart): now goes through existing.connect(...) instead of the bare transport — failures surface as DeviceConnectionException (handled → null) and the pendant time sync runs after the link returns, while preserving the cached transport, source, and listeners.
  • Wedge monitor: native ingress ownership is rechecked after the feature-gate await (no invisible blocking episodes); a transcript during an ingress alert releases the telemetry slot while retaining the native-owned failure.
  • Capture timer: the verified ingress start survives a lease expiry (only withdrawn proof resets it), so the timer continues instead of restarting at zero when audio returns; unverified remains hidden.

Verification: focused dart analyze + the touched suites green locally (devices/wedge/socket-generation connections tests, 79 tests incl. 7 new regressions); repo pre-push gate passed (line-count exception held at the declared 3877); CI green on 9f62d1dab3 — Android JVM Unit Tests, Android Compile Smoke, Dart Analyze & Tests, iOS Compile Check, Generated Files, Formatting, Hygiene (30 pass / 15 skipped / 0 failed).

Serialize descriptor settlement and queue callbacks on the main handler. Arm each write token before issuing its CCCD operation, and release only the current command owner. Retire a GATT with a missing ACK, fail its queued subscription replies, and hand reconnection to the existing managed service so late ENABLE or DISABLE callbacks cannot settle a newer write.

Add JVM regressions for late ACKs, stale timers, ENABLE/DISABLE ownership, retired connections, queue-owner changes, rejected writes, and cleanup.
apoorvdarshan added a commit to apoorvdarshan/omi that referenced this pull request Oct 3, 2026
Rebase against author lane 5f9e465. Use a single owner-scoped command queue; replace the redundant CCCD-only coordinator and port its additional immediate-ACK, rejection and queued-DISABLE cases. Original capture/CCCD work remains credited to David Zhang in BasedHardware#20378. Validation: 33 targeted JVM tests passed and native production sources compiled on this exact tree. Failure-Class: FC-native-command-callback-outlives-owner.
Distinguish missing CCCD acknowledgements from ordinary GATT disconnects. Persist a per-device budget for two reconnects with backoff, and reset it only after a current successful descriptor ACK. Stop companion and sticky restoration from bypassing exhaustion.

Project the exhausted result through existing capture health without a competing Dart retry. Preserve capture intent, replay stored failures when capture binds, and keep healthy Android recording telemetry unchanged. Cover the policy, ACK ownership, and recovery presentation with production-seam tests.
@Git-on-my-level
Git-on-my-level merged commit ce4a461 into main Oct 3, 2026
45 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/pendant-silent-capture-review branch October 3, 2026 08:33
Itaxh1 added a commit that referenced this pull request Oct 5, 2026
…and (#18887)

## TL;DR

Recording now shows up outside the app on iPhone. While Omi records, a
Live Activity on the Lock Screen and in the Dynamic Island shows the
recording state, a live timer and Omi's breathing waveform, with Stop /
Start and End controls, so a recording can be checked and controlled
without opening the app.

iPhone only: Android is unchanged and keeps its existing "Recording in
progress" notification.

**Lock Screen**

![Lock Screen recording
card](https://github.com/Itaxh1/omi/blob/pr-assets/pr-18887-lock-screen.gif?raw=true)

**Dynamic Island** (Stop, then Start)

![Dynamic Island recording
card](https://github.com/Itaxh1/omi/blob/pr-assets/pr-18887-dynamic-island.gif?raw=true)

Recorded on an iPhone 15 Pro Max (iOS 26), before Stop flattened the
wave into a line. Full-quality clips: [Lock
Screen](https://github.com/Itaxh1/omi/blob/pr-assets/pr-18887-lock-screen.mp4?raw=true)
· [Dynamic
Island](https://github.com/Itaxh1/omi/blob/pr-assets/pr-18887-dynamic-island.mp4?raw=true)

## What changed and why

Adds an iOS Live Activity for recording: the Lock Screen card plus the
compact, minimal and expanded Dynamic Island, with Stop / Start and End
on iOS 17+. It shows capture state the app already has, so the backend
is unchanged. Layout follows the `omi-ios-v2` design package
(`LockScreen` / `Island` / `HomeScreen` geometry and `tokens.json`).
Text and controls stay the same size on every iPhone. Only the pendant
scales, using `layout.KH`.

- **Presentation:** `CaptureSystemSurface` projects `CaptureController`
state. iOS draws the timer, and Start appears only after a user stop.
Card actions are tied to the recording id and conversation revision, so
a tap on an old card cannot act on a newer recording.
- **Actions go through the capture coordinator:** the card's Stop, Start
and End call the same `pauseCapture` / `resumeCapture` / `finishCapture`
as the live page, Home card and quick actions. The coordinator decides
what each does for whichever source owns capture (SCA-561 single
ownership). Each tap carries its recording and conversation, and the
coordinator rejects it if they changed by the time it is applied, so a
tap that waited behind a stop or handoff never acts on the recording
that replaced it. Phone vs. pendant and batch state come from the
committed read model.
- **Waveform:** the strip plays the design's breathing wave
(`omi-liquid-dock2`: bars breathe to 45% over 1.6 s with a 13-bar
ripple) for as long as recording runs. iOS draws it on the system clock
through WidgetKit's clock-hand rotation effect, so the app sends no
animation updates. When capture stops, pauses or finishes, or the card
goes stale, the bars lie flat in a line, and Start brings the moving
wave back. The effect is not in the public SDK, so it is looked up at
run time, and the card shows the still wave wherever it is unavailable.
It plays on iOS 18 and later.
- **Start for a stopped phone mic:** Stop turns the phone mic off, so
Start from the Lock Screen has to start a recording while Omi is in the
background. iOS refuses that to a plain Live Activity intent, the mic
start failed, and the capture failed closed, ending the recording that
Start was meant to resume. On iOS 18 and later, Start for a stopped
phone mic is an `AudioRecordingIntent`, which iOS lets start recording
in the background. iOS 17 has no such intent, so there a stopped phone
mic shows no Start, and tapping the card opens Omi. Pendant Start is
unchanged. A stopped card no longer goes stale, because iOS may suspend
Omi while the mic is off and Start has to stay on the card.
- **Closing Omi closes the card:** when the app terminates, for example
swiped away while it records, the Live Activity and the Dynamic Island
end at once. A card left behind by a crash or a system kill closes as
soon as Omi launches again; recording ids are never reused, so nothing
could continue it.
- **Build boundary:** the card's Stop / Start / End App Intent compiles
only with Xcode 27, like the Siri intents, because the required Xcode
26.6 iOS compile check fails on any App Intents metadata
(`contracts/siri/README.md`). That CI build draws the card without
buttons; releases are built with Xcode 27.
- **Unverified pendant audio:** while the app cannot yet confirm that a
pendant's audio is arriving, it shows no "Listening" and no timer
(#20378). The card does the same: it names the pendant, shows no time,
keeps the wave flat and does not count the wait as recording time. Stop
and End stay available.
- **Settings:** new Show on Lock Screen toggle in Notifications
settings.
- **Localization:** every native Live Activity string (card and island
text, recovery titles, App Intent titles) covers all 49 app locales.

## Product invariants affected

none

## How it was verified

- **iPhone 15 Pro Max (iOS 26.6.2, prod data, signed Profile-prod
build):** pendant recording shows the Lock Screen card, both locked and
unlocked, and the Dynamic Island. The wave loops at the design's speed
while recording, Stop stops it, Start resumes it, and End finishes the
conversation (clips above).
- **Waveform on simulators (iOS 18.0 and 27.0):** a throwaway harness
ran the real widget file. Screen recordings measured per bar show about
21 frames a second, a 1.6 s period, bars breathing to 0.46 of full
height (design: 0.45), and heights within 0.5 pt of the CSS formula. The
card's archive stays inside the Live Activity size limit (1.41 MB at
most).
- **Layout on simulators, one at a time:** iPhone SE (375 pt), 16 (393),
16 Pro (402) and 16 Pro Max (440). Nothing is truncated or clipped, and
the expanded island fits the ~160 pt cap.
- Full `TZ=UTC bash app/test.sh` at this head: the spine suite (138) and
the whole app suite (3,872) passed.
- After merging current `main`: `flutter test test/services/capture
test/services/bridges
test/providers/force_processing_placeholder_test.dart
test/widgets/settings/live_activity_settings_test.dart`: 216 passed.
`flutter test test/services test/providers test/widgets/settings
test/widgets/home`: 995 passed. `TZ=UTC flutter test test/spine`: 129
passed. `flutter analyze` on every changed Dart file: no issues.
- A small Swift check decodes the exact snapshot Dart sends into
`ContentState`, and also a payload from an older build that still
carries the removed voice, batch and wave-time fields. Both decode.
- `python3 app/scripts/l10n.py check`: ok (49 locales).
- **Stop and close on the iOS 27 simulator (harness running the real
widget file):** with Stop at 30 s and Start at 40 s, the bars lie flat
while stopped and move again after Start. Swiping the app away with the
termination handler removed the card and the island; the same run
without it left both showing a recording.
- **Phone-mic Start before this fix (iPhone SE, iOS 26.7.1):** the
device log shows Stop stopping the audio engine and Omi suspended about
4 s later. On Start, `AVAudioEngine` failed `kAUStartIO` with error
2003329396, and `audiomxd` logged `Client 'Runner(…)' is in the
background and isn't allowed to start recording …
hasEntitlementToStartRecordingInTheBackground=NO`. The coordinator then
failed closed, which ended the recording and closed the card.
- **After the fix:** the signed Profile-prod build installed on the
iPhone 15 Pro Max and the SE. The widget binary and the app's App
Intents metadata both contain `OmiCaptureRecordingIntent`.
- **Xcode 26.6 path:** only Xcode 27 is installed here, so the widget
files were also typechecked with the `compiler(>=6.4)` gate forced off.
Both paths compile, and nothing outside the gated code references the
intent.
- **CI at this head (`ci:full`):** iOS Compile Check passed on the
pinned Xcode 26.6, including "Prove stable iOS compiler emits no Siri
metadata". Dart Analyze & Tests, Generated Files, Seeded Journeys
(hermetic), Formatting, Hygiene, the Desktop Swift contracts and the
Siri Xcode 27 advisory also passed.
- **`project.pbxproj`:** the 48 added lines pass `plutil -lint`; each of
the 18 new object IDs is defined once and referenced. Runner and
RunnerRayBanDat build the manager, attributes and intent, BatteryWidget
builds the attributes, intent and card, and the watch app builds none of
them. `pod install` leaves the file unchanged.
- Action timeout: a throwaway Swift harness around `CaptureIntentReply`
(not committed) covers reply before timeout, missing reply, error reply,
and a late reply after the timeout; each resumes exactly once.
- **After merging `main` at 8c45d9f (2026-10-04):** full `bash
app/test.sh`: 4,654 passed, 14 skipped, 0 failed. Analyzer ratchet
passed, CI's Dart and ARB format checks pass on every changed file, and
`scripts/l10n.py check` is ok. Merging `main` needed two follow-ups.
`openHomeDeepLink` now returns whether a destination opened, so the
capture link returns false for a recording that has ended. The Process
Now test double keeps both `main`'s injectable phone sync and this
branch's one gate per drain.
- Not verified: Start resuming a phone-mic recording from the Lock
Screen with this fix on a device, an 8-hour session hitting Apple's Live
Activity limit, and iOS 16.1–17 on a device.

## Tests

- `app/test/services/capture/capture_system_surface_test.dart`: card
actions (Stop/Start keeps elapsed time, stale actions rejected), phone
and batch End, stall recovery vs. user stop, no activity updates for the
wave during silence or speech, an update at each full hour so the timer
runs past it, an Omi call shown as an interruption without Stop or
Start, a Stop that queued behind a pendant-to-phone handoff rejected
instead of pausing the new phone recording, a failed action kept on the
card through health refreshes until the recording changes, and a tap
still queued at shutdown reported as failed.
- `app/test/services/bridges/live_activity_bridge_test.dart`: owner
handoff, so an old controller cannot detach a newer one, and close
completes without a native channel (iOS before 16.1) or after a native
detach error.
- `app/test/services/capture/capture_coordinator_test.dart`: a card's
pause, resume and finish apply only while its recording and conversation
are current; a stale one runs nothing.
- `app/test/widgets/settings/live_activity_settings_test.dart`: the Show
on Lock Screen switch is hidden while iOS has Live Activities off for
Omi and returns after Settings, and a failed native update restores the
switch and the saved preference. Both fail on the previous widget. A
rejected preference write also keeps the old choice, which the next card
update sends; this fails without the restore.
- `app/test/services/capture/capture_socket_generation_test.dart`: with
a real provider and a pendant whose audio is unverified, the card claims
neither Listening nor a time, and keeps Pause. Once audio is verified,
the claim returns. A lapse in verification hides it again and stops the
clock until audio returns. This fails without the change.
- `app/test/widgets/home/home_navigation_test.dart`: a card link for a
recording that has ended shows Home, opens nothing, and reports that
nothing opened.
- `app/test/providers/force_processing_placeholder_test.dart`: if the
conversation changes during the WAL drain, the processing skeleton is
removed and the next conversation is not reset. A drain that goes stale
keeps the skeleton a newer request is still showing; this fails without
the ownership check.

## Failure class (fixes)

Failure-Class: none

## Scoped cleanups (optional)

None.

Line-Count-Exception: app/lib/services/capture/capture_controller.dart |
3799 -> 3858 | The Live Activity's recording identity, read-model
getters and action entry point (which delegates to
pauseCapture/resumeCapture/finishCapture) belong to the capture owner
Line-Count-Exception: app/lib/services/capture/capture_coordinator.dart
| 2828 -> 2869 | A Live Activity tap is checked when pause, resume or
finish is applied, so its target type, event fields, environment fields
and the stale-tap check live with the reducer
Git-on-my-level added a commit that referenced this pull request Oct 26, 2026
…ilure, guard Reconnect

Review fixes for #23703 round 1:

- Honesty rule (#20378): a confirmed-subscription quiet verifies only when
  its generation already delivered audio. Native's snapshot has carried
  last_audio_at_ms all along (reset on every generation change and on a
  failed subscription), so verifiedAt now requires it for quiet: a
  fresh_subscription_quiet or budget_spent_quiet with no audio this
  generation stays unverified - the island grace, then the unheard notice
  with Reconnect - instead of Listening with a running clock forever. The
  same predicate gates the native_ingress capture-started telemetry, so a
  zero-audio link marks no recording started.
- The Home live row's failure state never says Listening: the title is
  "No audio from pendant" with the plain-words line under it.
- A reader's Reconnect coalesces concurrent taps into one managed
  reconnect (pendantReconnectInFlight; Home and Device Settings disable
  their action while it runs), is a no-op when the reader paused capture
  or disconnected the pendant themselves (the manual-disconnect choice is
  never cleared), and a tap with no pendant reports to the surface
  instead of an uncaught StateError.
- The replayed zero-notification incident trace now asserts nothing ever
  verifies; the regenerated evidence shots carry the corrected copy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Oct 26, 2026
…on real pendant audio failures (#23703)

Failure-Class: new

Line-Count-Exception: app/lib/services/capture/capture_controller.dart |
4566 -> 4644 | the controller gains the seams the failure surfaces call
(pendantCaptureActionRequired projection, reconnectRecordingPendant
through the injected loader, and the reconnect's in-flight coalescing
guard); splitting the 4.5k-line controller is its own change

## Product invariants affected

INV-CAP-1 — this change is presentation on top of the capture-health
machine, never custody: it reclassifies how a native phase maps to a
Listening claim or a warning, not whether captured audio survives. No
subscription, recovery-budget, retention or radio policy changed (the
pendant keeps its confirmed subscription through quiet, and the native
machine is untouched), and the one new user action is the same managed
reconnect the wedge monitor's retry already uses.

## What

A pendant that goes silent in a quiet room after delivering audio kept
capture healthy but presented as failing: the Dynamic Island showed "No
audio from pendant" (slashed waveform), the Home live row froze at
"Listening now · Capturing · 0s", and Device Settings kept "Listening" —
three contradictory signals, all wrong. Every silent stretch longer than
the 2-minute island grace was a false alarm.

## Root cause

The pendant only sends audio packets while there is sound (the filed
evidence shows ~8 minutes of packets in a 90-minute wear, zero packet
loss). Native `OmiCaptureHealth` already treats a confirmed subscription
over silence as healthy — its `quiet` phase (`fresh_subscription_quiet`
/ `budget_spent_quiet`) is a settled, non-failing state
(`silenceAfterFreshSubscriptionIsFailure = false`, and it costs no
recovery budget). But Dart's `CaptureIngressHealth.verifiedAt`
recognized only a flowing audio lease, so `quiet` projected to
`unverified`: the clock froze, the Listening claim withdrew, and the
island warned after its grace. Review fix (round 1): the first cut let
any confirmed-subscription quiet verify, which broke the #20378 honesty
rule the other way — a `fresh_subscription_quiet` that never delivered a
packet in its generation (a CCCD confirmed but never notifying) would
have claimed Listening forever.

Separately, `ClientTelemetrySchema.ingressPhases` never learned the
native phases (`inactive`, `unverified`, `repairing`, `reconnecting`,
`quiet`), so `capture_ingress_unmapped_phase {phase: unmapped}` logged
instead of the real phase.

## Change

- **A quiet that already delivered audio this generation verifies**
(`capture_ingress_health.dart`): `verifiedAt` now accepts a current
audio lease *or* a confirmed-subscription quiet whose generation has
audio of its own — native's snapshot already carries `last_audio_at_ms`,
which resets to 0 on every generation change and a failed subscription,
so it is exactly "this link has delivered". The clock keeps running and
every surface keeps saying Listening through silence after sound. The
honesty rule from #20378 holds in both directions: unconfirmed
subscriptions, repairs, reconnects and exhausted recoveries claim
nothing, and **a confirmed subscription alone still proves nothing** — a
`fresh_subscription_quiet` (or `budget_spent_quiet` on a fresh
generation) with no audio this generation stays unverified, keeps the
wait grace, and reaches the unheard notice with Reconnect. A zero-byte
wedge episode still resolves only on a **flowing** lease
(`audioLeaseValid`). The same predicate gates the `native_ingress`
capture-started telemetry, so a zero-audio link marks no recording
started.
- **A real failure is named, once, with an action.** `actionRequired`
(native recovery exhausted, or an unconfirmed subscription past the
island grace) becomes the one warning state:
- **Island**: `noAudio` shows the unheard notice immediately (no grace),
with the plain-words line "Pendant connected, but no audio is reaching
your phone" and a **Reconnect** button (new `reconnect` Live Activity
action → `CaptureController.reconnectRecordingPendant()`, one
disconnect-and-reconnect through the same managed `recoverConnection`
the wedge monitor's retry uses; it never loops and never spends the
native recovery budget). Review fix (round 1): the reconnect now
coalesces concurrent taps into one attempt (`pendantReconnectInFlight`;
Home and Device Settings disable their action while it runs, the Live
Activity already serialized its intents), is a no-op when the reader
paused capture or disconnected the pendant themselves — the
manual-disconnect choice is never cleared — and a tap with no pendant to
reconnect reports failure to the surface (snackbar on Home, the card's
failure mark) instead of an uncaught error.
- **Home live row**: amber **"No audio from pendant"** as the title with
the plain-words line under it — never "Listening now" — and a compact
**Reconnect** action instead of the chevron; a wait shows "Connecting…"
and claims neither Listening nor a time.
- **Device Settings "Right now"**: warning row ("No audio from pendant"
/ the plain-words line); tapping it reconnects. A wait shows
"Connecting…" without a running length.
- **Telemetry**: the schema now carries the native phases (legacy names
stay accepted); `capture_ingress_unmapped_phase` logs the actual phase
name. The backend's mirror set accepts the same phases so they are not
bucketed to `unknown`.
- **Live Activity policy** extracted to
`OmiCapturePresentationPolicy.swift` (Foundation-only) so the decision
is host-testable; `noAudio` warns immediately, `connecting`/`unverified`
keep the 2-minute grace, healthy quiet never warns. The notice strings
are localized in the widget catalog (49 locales) alongside a new
`Reconnect` key.

### State → presentation after this change

| Native health | Island | Home live row | Device Settings badge |
|---|---|---|---|
| flowing (lease valid) | nothing (healthy) | Listening · running time |
Listening now · live length |
| **quiet + confirmed subscription, audio heard this generation**
(silent room) | **nothing — no more false warning** | **Listening ·
running time (clock no longer freezes)** | **Listening now · live
length** |
| quiet + confirmed subscription but **no audio this generation**
(fresh-subscription wedge), or any wait / repair / reconnect within
grace | no card for 2 min | Connecting… (no time, dot still) |
Connecting… (no length) |
| unverified past the 2-minute grace (subscription never confirmed, or
the confirmed-but-never-delivering quiet above) | unheard notice +
Reconnect | Connecting… — and "No audio from pendant · Reconnect" once
native recovery exhausts to actionRequired (an unconfirmed subscription
walks the repair/reconnect ladder; a confirmed-but-silent quiet stays
Connecting…) | Connecting… — warning row once actionRequired |
| actionRequired (recovery exhausted) | unheard notice immediately +
Reconnect | No audio from pendant · plain-words line · Reconnect |
Warning row (No audio from pendant / plain-words line), tap reconnects |

## Why a new failure class

`Failure-Class: new` — `FC-healthy-silence-projected-as-failure`: a
producer state with a specified healthy meaning was consumed through a
stale narrower predicate and projected as failure. Its guard surface is
the state-mapping tests on both sides of the boundary
(`capture_quiet_health_test.dart` — quiet verifies only with audio this
generation, a fresh quiet does not, a new generation resets the proof;
the quiet/noAudio cases in `capture_socket_generation_test.dart`,
including the fresh-quiet-claims-nothing and zero-audio-marks-no-start
cases; the replayed incident trace in
`native_ble_transport_resync_test.dart` whose zero-notification quiet
now never verifies; and the host-run
`omi_capture_presentation_test.rb`).

## New check

`ios-capture-presentation` (manifest, local+ci lanes) runs the new
policy test. It pins the island side of the mapping this bug crossed
(`noAudio` warns immediately, the grace applies only to waits, healthy
statuses never warn) and the presence of every notice string in every
widget locale. It is not a shared primitive because nothing
host-compiles the ActivityKit-gated presentation sources; the policy
extraction into a Foundation-only file is what makes the real decision
runnable on CI hardware.

## Tests

- `app bash test.sh` (full hermetic suite): **7517 passed**, 0 failed —
includes `capture_quiet_health_test.dart` (a quiet verifies only with
this generation's audio, a fresh quiet without audio does not, a new
generation resets the proof, unconfirmed quiet does not, telemetry phase
mapping), quiet/noAudio provider + Live Activity surface cases in
`capture_socket_generation_test.dart` (clock runs through
quiet-after-audio; a fresh quiet claims nothing, marks no capture start
and reports unverified to the island; noAudio publishes and its card
action reconnects once; reader Reconnect coalesces concurrent taps and
is a no-op after a pause or a manual disconnect), the Home-row and
Device-badge widget cases (the failure row never says Listening), the
revised intent tests (`capture_ingress_health_test`, the
`native_ble_transport_resync_test` incident replay whose
zero-notification quiet now never verifies, wedge monitor resolution
stays lease-based), and the visual-audit suite.
- `app/ios/test/omi_capture_presentation_test.rb`: 303 assertions —
policy decisions for every status, iOS-SDK typecheck of the Live
Activity sources, and locale completeness of the notice strings.
`app/ios/test/omi_capture_health_test.rb` also passes unchanged (native
health is untouched this round; it already pins the `lastAudioAt`
per-generation reset the Dart proof reads).
- Backend: `backend .venv/bin/python -m pytest
tests/unit/test_client_telemetry.py` — 21 passed (new: native phases
pass through unbucketed).
- `scripts/l10n.py check`: 49 locales, 4270 keys, placeholders/freshness
ok.

## UI-Evidence

Rendered with the repo's widget-test pipeline (same renderer as
`visual_audit.sh`; its font rasterizer draws placeholder glyphs, so text
reads as bars — the exact strings are pinned by the widget tests).
Light/dark, quiet vs real failure. The failure shots carry the corrected
copy: the row titles "No audio from pendant" with the plain-words line
under it, never "Listening now":

![Home row quiet
dark](.agent-artifacts/ui-evidence/lane-capture-quiet/001-mobile-ios-home-row-quiet-dark.png)
![Home row failure
dark](.agent-artifacts/ui-evidence/lane-capture-quiet/002-mobile-ios-home-row-no-audio-dark.png)
![Home row quiet
light](.agent-artifacts/ui-evidence/lane-capture-quiet/003-mobile-ios-home-row-quiet-light.png)
![Home row failure
light](.agent-artifacts/ui-evidence/lane-capture-quiet/004-mobile-ios-home-row-no-audio-light.png)
![Device badge quiet
dark](.agent-artifacts/ui-evidence/lane-capture-quiet/005-mobile-ios-device-badge-quiet-dark.png)
![Device badge failure
dark](.agent-artifacts/ui-evidence/lane-capture-quiet/006-mobile-ios-device-badge-no-audio-dark.png)
![Device badge quiet
light](.agent-artifacts/ui-evidence/lane-capture-quiet/007-mobile-ios-device-badge-quiet-light.png)
![Device badge failure
light](.agent-artifacts/ui-evidence/lane-capture-quiet/008-mobile-ios-device-badge-no-audio-light.png)

Live Activity views have no snapshot tooling in this repo; the island's
behavior is pinned by `ios-capture-presentation` instead.

Changelog:
`app/changelog/unreleased/20261026-capture-quiet-not-failure.json`.

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

🤖 Generated with [Claude Code](https://claude.com/claude-code)
aryanorastar pushed a commit to Dragonire9/omi that referenced this pull request Oct 26, 2026
…on real pendant audio failures

The pendant sends audio only while there is sound, so native
OmiCaptureHealth settles a silent-but-healthy link into its quiet
phase with the subscription confirmed. Dart's verifiedAt recognized
only a flowing audio lease, so quiet projected to unverified: the
capture clock froze, Listening withdrew, and after the island's
2-minute grace every quiet room read as "No audio from pendant".

A confirmed-subscription quiet now verifies (a current flowing lease
still does); the clock keeps running and Home, Device Settings and
the island keep saying Listening through silence. The BasedHardware#20378 honesty
rule holds the other way: waits, repairs, reconnects and exhausted
recoveries claim nothing, and a zero-byte wedge still resolves only
on a flowing lease, because a confirmed subscription alone does not
prove delivery. actionRequired becomes the one warning state: the
island's unheard notice appears immediately with the plain-words
sentence and a Reconnect action wired to one managed
disconnect-and-reconnect; the Home live row and the Device Settings
Right-now badge show the same warning with a Reconnect of their own,
and a wait reads Connecting… with no time.

The telemetry schema learns the native phases (legacy names stay
accepted; the backend mirror too) so capture_ingress_unmapped_phase
reports the real phase instead of unmapped. The Live Activity notice
policy moves to a Foundation-only OmiCapturePresentationPolicy.swift
that the new ios-capture-presentation manifest check runs on the
host, alongside locale-completeness of the notice strings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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