Skip to content

fix(app): centralize recording sync recovery - #9763

Merged
Git-on-my-level merged 7 commits into
mainfrom
codex/issue-9752-recording-recovery-coordinator
Jul 15, 2026
Merged

Git-on-my-level merged 7 commits into
mainfrom
codex/issue-9752-recording-recovery-coordinator

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 14, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Adds RecordingTransferCoordinator as the single foreground owner for recording recovery wakes.
  • Routes startup, connectivity restoration, foreground, device connection, cooldown, and user retry through the coordinator.
  • Reconciles uploaded WALs before discovery/drain, preserves the auto-sync preference for automatic wakes, and retries normal-return local upload failures with bounded foreground cooldowns.

Root cause and durable guard

Recovery ownership was split: CaptureController retried only orphan WALs when startup had been skipped, SyncReconciler only polled uploaded jobs, and SyncProvider separately auto-drained phone files. Consequently, restoring connectivity after a successful startup pass did not drain retryable WALs until an incidental device reconnect.

This PR makes the coordinator the authoritative wake owner and adds a hermetic production-coordinator harness covering connectivity recovery, post-startup recovery, singleflight coalescing, retryable failures, restart backlog recovery, preference gating/user retry, uploaded-job ordering, and background cooldown cancellation.

The coordinator's post-configuration wake is the sole startup emitter. CaptureController no longer schedules recovery from proxy-provider external-action updates; a fake-async regression test proves repeated updates add no delayed startup timers. Startup waits for the persisted phone-WAL readiness barrier before the coordinator attaches, and background lifecycle state prevents connectivity/device recovery wakes from starting discovery or a drain until foregrounded.

Recurrence evidence: #7373, #9471, and the stranded-backlog aspect of #7240.

Verification

  • cd app && flutter test test/services/wals/recording_transfer_coordinator_test.dart
  • cd app && flutter test test/providers/sync_provider_startup_reconciliation_test.dart test/services/wals/recording_transfer_coordinator_test.dart test/providers/capture_provider_test.dart
  • cd app && bash test.sh (813 tests passed)
  • cd app && flutter test test/widgets/transcript_test.dart
  • cd app && ./scripts/analyze_ratchet.sh
  • make preflight

I could not perform the required physical-device airplane-mode flow: this Mac has no connected Omi device and no iOS/Android emulator. The PR does not claim that hardware verification occurred.

Scope

Closes #9752.

Does not close #9471, #7240, or #7221. No backend, protocol, persistence-schema, or OS background-execution changes.

CI and others added 7 commits July 14, 2026 18:09
Remove CaptureController's delayed startup recovery wake because proxy-provider updates can repeat it after the coordinator has completed a pass. Add a fake-async regression test that repeated external-action updates do not schedule recovery timers.

Verification:
- cd app && flutter test test/providers/capture_provider_test.dart test/services/wals/recording_transfer_coordinator_test.dart
- cd app && bash test.sh
- cd app && ./scripts/analyze_ratchet.sh
- make preflight
- scripts/pr-preflight --pr-body-file /tmp/omi-9752-pr-body.md
Delay startup recovery until persisted phone WALs are loaded and prevent background lifecycle events from beginning a recovery pass. Regression tests hold readiness behind a completer and prove background connectivity waits for foreground.

Verification:
- cd app && flutter test test/providers/sync_provider_startup_reconciliation_test.dart test/services/wals/recording_transfer_coordinator_test.dart test/providers/capture_provider_test.dart
- cd app && bash test.sh
- cd app && ./scripts/analyze_ratchet.sh
- make preflight
- scripts/pr-preflight --pr-body-file /tmp/omi-9752-pr-body.md
Capture the Flutter JSON reporter and complete console output when the test step fails, then summarize failed test names in the GitHub Actions job summary.

Verification: cd app && bash test.sh --reporter expanded --file-reporter json:/tmp/omi-flutter-test-results.json (813 passed); bash -n app/test.sh; Ruby YAML parse; make preflight.
UI syncWal bypassed the coordinator after 202 uploads, so uploaded WALs
never reconciled until an incidental wake. Also process conversation
results before surfacing partial upload failures, reconcile before retry
on failed drains, and treat contended drains as retryable instead of
success.

Co-authored-by: Cursor <[email protected]>
Prevent UI single-WAL sync from racing an in-flight coordinator drain, and await LocalWalSync stop in walReady teardown so concurrent Flutter CI no longer flakes.

Co-authored-by: Cursor <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit e180476 into main Jul 15, 2026
20 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/issue-9752-recording-recovery-coordinator branch July 15, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant