Skip to content

fix(watch): make Stop visible and release the microphone on cleanup - #23280

Merged
aryanorastar merged 7 commits into
mainfrom
fix/watch-session-controls
Oct 23, 2026
Merged

aryanorastar merged 7 commits into
mainfrom
fix/watch-session-controls

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Final merge acceptance — 2026-10-23

Reviewed/tested head 821c326f07846966173b6a66b70c3187094da442. Fresh native suites pass 24 tests / 84 assertions. The production recorder/view/store probe passes 7 lifecycle cases on the 40 mm Watch SE 3 simulator / watchOS 27.0: canceled/late permission, ABA permission, failed activation, Stop, repeated Stop, denial and missing owner. Permission/audio-session I/O is injected; physicalAudio=false. Native screenshots confirm visible Stop and separate Retry with pending transfers, idle Record/Retry, and visible Stop at accessibility3 with a long recovery error. This is not real microphone, radio transfer or paired-Watch evidence.

Aryan explicitly accepts simulator-led Omi verification and authorized merging this PR if ready. This final acceptance supersedes the earlier physical-device-only merge gates below; physical Watch connectivity/audio and customer release outcomes remain explicitly unverified follow-up, not claims of recovery. Required current-head CI and an existing approval passed before merge. No deployment or store release is authorized/performed in this task. Fixes was changed to Refs so #23275 stays open for release/outcome follow-up rather than closing on code merge alone.


The active Watch screen hides Stop behind the Omi logo, and recorder teardown leaves AVAudioSession active. This adds a visible Stop recording button, keeps Retry transfer separate, and shares microphone cleanup across Stop, cancelled permission and failed startup. A delayed permission answer cannot reactivate a cancelled recording.

Refs #23275. Follow-up to #22059.

Current main already addresses minute-by-minute Home backup clutter through #23288: the shared custody ledger owns Watch copies, Offline Sync exposes automatic work, and Home lists explicit user-held recordings. This branch now integrates that pipeline and removes its superseded Home grouping proposal. No additional Dart projection, retention rule, backend, firmware or API change is introduced here. Public store release of #23288 has not been verified.

Verification

  • Native Watch simulator probe runs the actual production recorder/view/store with synthetic permission and audio-session I/O: 7 lifecycle cases passed, including late/ABA permission, activation failure, Stop, repeated Stop, denial and missing owner. It opens no microphone.

  • Existing custody, relay and presentation suites: 24 tests, 84 assertions passed after main integration.

  • Separate Personal Team-signed QA host on physical iPhone 16 Pro / iOS 27.0.1, compiling unchanged production recorder/view/store: the final approximately 70-second capture saved 60.00 + 10.09 seconds of validated, non-zero PCM, stopped, successfully deactivated AVAudioSession with zero errors, and left file sizes unchanged for two seconds. Final result UTC: 2026-10-23T04:22:27Z. A direct-phone spoken test also produced non-zero audio. Aryan manually verified Stop: the timer stopped and orange microphone indicator disappeared. Earlier runs with the Mac device view open contained only zero PCM and are not counted as audible capture evidence; a later start was blocked while the phone was locked. The final run used the unlocked phone directly with the device view closed. Retained parts include earlier QA runs, so totals are attributed by session metadata. The battery adapter is a no-op; this does not exercise physical watchOS, paired delivery or the production Omi app/account.

  • Native 40 mm Watch simulator renders active Stop + Retry, stopped Record + Retry, and accessibility3/error state. The stopped-state Retry clipping and accessibility title wrapping found during inspection are corrected.

  • Current-main analyzer ratchet, local preflight (20 selected checks; the history-dependent guard explicitly skips on this shallow clone) and push hooks passed. Full app suite: 7,120 passed, four skipped, plus 138 protected contracts passed. All hermetic mobile journeys passed (23 executions, zero failures/skips). Code Review confirms iOS Compile Check, Dart Analyze & Tests, Hygiene and Desktop Swift Static & Test Contracts passed on 821c326f07846966173b6a66b70c3187094da442, with no failed or running source checks at verification. Scope-skipped lanes are not claimed as executed.

Reproduce native checks from the repository root:

ruby app/ios/test/watch_recording_recovery_test.rb
ruby app/ios/test/watch_audio_chunk_relay_test.rb
ruby app/ios/test/watch_recording_presentation_test.rb
ruby app/ios/test/watch_recording_controls_probe.rb --device <booted-watch-simulator-uuid> --output <temporary-directory>
TZ=UTC bash app/test.sh
make mobile-verify ARGS='fast --all'
make preflight

The SDK probe needs the CocoaPods Ruby environment (xcodeproj). Private physical-run build/source hashes and result JSON are retained locally; no microphone audio, device identifier, customer account or signing credential is published.

Merge gates and release

Ready for review; do not merge until paired-Watch acceptance passes: press Stop and check microphone indicator with phone reachable/unavailable, pending transfers and screen-off/resume; capture across a minute boundary; restart/retry real WatchConnectivity transfers; verify receipt-owned originals, playback and processing on iPhone; confirm Home has no automatic minute-copy rows and originals remain accessible through Offline Sync. The iPhone-host result does not satisfy these Watch gates. Simulator file delivery is unsupported by Apple's WatchConnectivity documentation. Longer recovery qualification remains tracked in app/docs/apple-watch-recovery.md.

Source checks have passed on the exact pushed head. Complete paired-hardware acceptance and compare against David's concurrent work before readiness; refresh affected checks if changes follow that review. No review of unpublished changes is claimed. After acceptance, this needs merge and a signed iPhone release containing the updated Watch companion. This follow-up adds no backend deployment; #22059's existing processing-backend rollout dependency remains separately tracked. No deployment, app-store release or older-audio recovery is claimed.

Product invariants

INV-CAP-1: preserve original recovery files, session fencing, durable receipts and account ownership; microphone teardown does not change custody.
INV-UI-1 / INV-UI-3: reuse native controls and existing localized Stop labels, preserve explicit controls with pending/error state and large text.
INV-PERF-1: no new per-frame UI work, scan, timer or uploader; main's canonical custody pipeline remains authoritative.

Failure class

Failure-Class: new

Root cause: recorder cleanup stopped the engine without releasing AVAudioSession; permission checking also activated audio before validating the original start generation. Trigger: #23275; these lifecycle defects predate #22059, while that PR introduced the minute-copy clutter now handled by #23288.

Prevention uses a shared releaseCaptureResources primitive for Stop and failed startup, plus generation validation before session activation. The durable guard is app/ios/test/watch_recording_controls_probe.rb with app/ios/test/fixtures/watch_recording_controls_app.swift, executing the production model with synthetic OS I/O. It is an explicit SDK/simulator lane, not a default hermetic CI or physical Watch qualification.

UI evidence

UI-Evidence: .agent-artifacts/ui-evidence/watch-session-controls/evidence.json

Actual native views with synthetic state; no physical microphone or transfer claim.

40 mm Watch Stop and Retry
Stopped Watch with Retry visible
Accessibility text and error state

2026-10-23 maintainer review and merge gates

Reviewed the current production Stop/cleanup/generation changes and reran the native recovery, relay and presentation suites: 24 tests / 84 assertions pass. No new blocking source finding in this bounded review. Existing iPhone-host microphone evidence is not a paired-Watch test. Ready for code review at Aryan's request; merge stays blocked until real Watch Stop/microphone release, minute-boundary capture, reachable/unreachable phone transfer retry, screen-off/resume, retained originals/playback/processing and Home/Offline Sync behavior are verified. No physical device was accessed in this review and no deployment/release was performed.

@Git-on-my-level

Copy link
Copy Markdown
Member

Verdict: the production change here is correct and nicely scoped — no blocking issues; the remaining open items are the ones your own draft checklist already tracks.

What I verified on the current head:

  • ContentView.swift: the old design overloaded the Omi logo as the only recording toggle; the new explicit Button(action: viewModel.stopRecording) with a stop.fill label, full-width Text fallback at accessibility text sizes, and watch_recording_stop identifier is the right shape. The watch.accessibility.stopRecording key exists in omiWatchApp/Localizable.xcstrings, so no raw-key rendering.
  • WatchAudioRecorderViewModel.swift: this is the real fix underneath — stopRecording used to tear down the engine but never deactivate AVAudioSession, so the mic session outlived capture. Now every exit path (cancelled permission request, failed activation, failed engine setup, Stop, repeated Stop) funnels through releaseCaptureResources(), and the async permission callback validates recordingGeneration == attempt so a late answer cannot resurrect a stopped capture or adopt a newer start. The injected permission/audio-session seams keep the real AVFoundation calls as production defaults.
  • local_recording_group.dart: grouping keys strictly on the validated 32-hex session ID parsed from filenames — exactly the format WatchRecordingStore.swift mints (UUID minus dashes, lowercased), so watch and phone agree. Deterministic ordering (timerStart, then fileName), unmodifiable parts, and grouping happens before date bucketing so a session crossing midnight keeps one Home row. Phone recordings and unrecognized names stay singleton groups.
  • conversations_page.dart / conversations_group_widget.dart / local_recordings_provider.dart: clean mechanical migration from LocalRecording to LocalRecordingGroup; the provider caches the grouped projection and re-derives it only when the underlying list changes, so no per-frame regrouping on Home.
  • recording_group_list_item.dart: one row per Watch session with a failed > uploading > processing status rollup; the pushed WatchRecordingSessionPage reuses the existing RecordingListItem for each original part, so playback, Process Now, share and confirmed-delete semantics are untouched, and a vanished group falls back to the empty state rather than crashing.
  • Tests: grouping unit tests (666 parts, out-of-order delivery, midnight, unrelated files never joining), real-provider widget tests at 200% text in light and dark including account-clear-without-deleting-audio, and the simulator lifecycle probe for the seven recorder cases.

Two non-blocking nits: a group's displayed start time uses the earliest currently-known part, so it can shift if an earlier part arrives later (identity stays stable — already covered by your identity test); and "Listening" / "Tap to Record" remain hardcoded English while the new Stop control localizes — pre-existing, worth a follow-up.

Blast radius: watchOS recorder + iPhone Home presentation; receipt-owned files, transfers and processing policy are unchanged, and the singleton-group path keeps phone batch recordings pixel-identical.

USER IMPACT: Apple Watch shows a clear red Stop button and fully releases the microphone when recording ends; iPhone Home shows one entry per Watch recording session instead of one row per saved minute, with every original part still one tap away.

Still want before this leaves draft: the physical paired-device acceptance and the clean full-suite run your checklist already names — nothing else is blocking from my side.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added the positive-signal Automation verified a genuine fix/quality contribution label Oct 22, 2026
@aryanorastar aryanorastar changed the title fix(watch): expose Stop and group saved recovery parts on Home fix(watch): make Stop visible and release the microphone on cleanup Oct 23, 2026
@Git-on-my-level

Copy link
Copy Markdown
Member

Verdict: the production change is correct and well scoped - this fixes two real bugs (Stop was invisible behind the Omi logo, and the recorder never released AVAudioSession on any path), and I found no blocking issues.

Findings by file:

  • app/ios/omiWatchApp/WatchAudioRecorderViewModel.swift - the substance. Old main had zero setActive(false) calls; every exit now routes through releaseCaptureResources() (~line 169), which removes the tap (guarded by the new hasInputTap flag), stops the engine, then deactivates the session in the right order. Permission checking is now side-effect free and the callback validates isStarting + recordingGeneration before activating (~line 81), so a late/cancelled permission answer cannot resurrect microphone ownership or adopt a newer start; failed starts deactivate via the defer. I hand-traced the ABA case (stop during a pending permission answer, then a new start, then the stale answer arriving) against the fixture's expected activation/deactivation counts and they match.
  • app/ios/omiWatchApp/ContentView.swift - replaces logo-tap-to-stop with an explicit red Stop button (accessibilityIdentifier watch_recording_stop), keeps Retry transfer a separate action, text-only title at accessibility type sizes inside a ScrollView, and shrinks Record to 44 pt when recovery status is present. The watch.accessibility.stopRecording key exists in Localizable.xcstrings.
  • app/ios/test/fixtures/watch_recording_controls_app.swift + app/ios/test/watch_recording_controls_probe.rb - good probe design: the production recorder/view compile unchanged and I/O is injected through the new init seams (whose production defaults keep the real AVFoundation calls). The 7 lifecycle cases assert exactly the failure modes the new failure-class file describes. Note the probe needs a booted Watch simulator and the CocoaPods Ruby env, so it is a manual lane, not CI-wired - fine, just worth remembering it will not catch regressions automatically.
  • .github/failure-classes/FC-stopped-capture-retains-audio-session.json - schema matches sibling FC files; the violated_contract text is accurate against the old code.
  • app/docs/apple-watch-recovery.md - the rewritten status/checklist honestly separates merged (fix(watch): preserve recording recovery copies until iPhone receipt #22059, fix(app): one ledger, one uploader for phone audio custody #23288) from unverified (physical Watch qualification, store release); the CUSTODY.md link target exists and the superseded Home-grouping proposal was correctly removed rather than left conflicting with main's custody pipeline.
  • app/changelog/unreleased/20261022-watch-session-controls.json - format matches siblings.
  • .agent-artifacts/ui-evidence/* - I inspected 001-mobile-ios-watch-stop.png: it genuinely shows the red Stop button with Retry separate, and evidence.json descriptions do not overclaim (explicitly no physical microphone/transfer claim).

Security/privacy: materially positive - every stop/cancel/failure path now releases the microphone session instead of retaining it. Blast radius: Watch recorder only; no phone-side, backend, or retention-policy change.

USER IMPACT: On Apple Watch, recording now shows a clear red Stop button, and stopping (or a cancelled/failed start) actually releases the microphone instead of keeping it active.

Still want before merge - matching your own open checklist items: physical paired-Watch qualification (Stop removes the microphone indicator with the phone both reachable and unreachable, during pending transfers) and the post-main-integration full check rerun.

Nothing on the review side blocks this; leaving final merge sign-off to maintainers once the physical paired-device checklist passes.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@aryanorastar
aryanorastar marked this pull request as ready for review October 23, 2026 14:11
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T14:15:23.106968Z 821c326 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good fix (fixes #23275), CI clean. Not merging: author's own PR body explicitly states merge stays blocked pending paired-Watch hardware acceptance that hasn't happened yet.

@aryanorastar
aryanorastar merged commit c4ab28a into main Oct 23, 2026
74 checks passed
@aryanorastar
aryanorastar deleted the fix/watch-session-controls branch October 23, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ios positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants