Skip to content

fix(sync): allow recovery export and bulk clear for backlog outside recovery window (#21217) - #21320

Closed
Dragonire9 wants to merge 6 commits into
BasedHardware:mainfrom
Dragonire9:fix/offline-backlog-recovery-bulk-export-21217
Closed

Dragonire9 wants to merge 6 commits into
BasedHardware:mainfrom
Dragonire9:fix/offline-backlog-recovery-bulk-export-21217

Conversation

@Dragonire9

@Dragonire9 Dragonire9 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #21217

Problem

When an offline backlog (e.g. from a Limitless pendant) accumulates during a prolonged sync issue exceeding the 30-day lookback window (outsideRecoveryWindow), recordings are marked as permanently refused. Previously:

  1. WalListItem._trailing replaced the chevron navigation affordance with only a destructive Delete button, giving the impression that trapped recordings could only be discarded, preventing users from realizing they can tap the row into WalItemDetailPage to inspect, play back, and export/share their audio via shareWalAsWav.
  2. In OfflineSyncStorageSheet, there was no category for unsyncable recordings. As a result, users with expired recordings could not bulk clear them separately from their pending queue, and total counts mismatched category counts.

Solution

  1. Preserve Navigation Affordance for Unsyncable Rows: In WalListItem._trailing, render the chevron navigation icon alongside the Delete action so users can easily tap into WalItemDetailPage to play audio and export recordings via the share sheet.
  2. Expose deleteAllCorruptedWals on SyncProvider: Allow bulk deletion of terminal unsyncable files (corrupted, outsideRecoveryWindow, unsupportedAudio, uploadRejected) without blowing away pending recordings awaiting sync.
  3. Add Unsyncable Category to OfflineSyncStorageSheet: When unsyncable recordings exist (unsyncableCount > 0), display a dedicated storage row with clear capability, correctly reflecting total storage breakdown.
  4. Hermetic Regression Tests: Added tests in sync_row_recovery_window_test.dart and offline_sync_storage_contrast_test.dart asserting chevron presence on terminal rows and unsyncable storage category rendering/clearing.

View guided diff

@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks for this — solid diagnosis and a clean, well-scoped fix for #21217. I went through the diff file by file:

app/lib/pages/conversations/sync_page.dart — Wrapping the existing Delete button in a Row with the chevronRight icon is the right fix: the row's onTap already navigated to WalItemDetailPage, so the old UI was hiding a real affordance. The new onClearUnsyncable handler correctly pops the sheet, confirms with the same destructive showOmiConfirm pattern used by Clear All, and guards context.mounted before both the delete and the feedback toast.

app/lib/pages/conversations/widgets/offline_sync_storage_sheet.dart — The new unsyncable _StorageRow only renders when unsyncableCount > 0, and keeping onClearUnsyncable nullable with unsyncableCount defaulting to 0 preserves backward compatibility for existing callers. Good catch that the storage breakdown previously didn't account for these files even though clearableWalsCount includes them.

app/lib/providers/sync_provider.dart — deleteAllCorruptedWals() mirrors deleteAllSyncedWals() exactly (generation guard + refresh), and delegates to the service method that already exists, so no new deletion logic is introduced.

app/test/widgets/offline_sync_storage_contrast_test.dart and sync_row_recovery_window_test.dart — Both new tests are hermetic and assert real behavior (chevron presence on terminal rows; Failed category rendering, count, and clear callback firing). Nice to see the affordance locked down by a test.

Two minor, non-blocking notes:

  • The chevron now also appears on corrupted/unsupportedAudio rows, where the detail page may not have playable audio (canPlayOrShare gates on file availability). Probably still fine for inspection, just flagging the UX edge.
  • The repo convention is a changelog fragment under app/changelog/unreleased/ for app changes — worth adding one so this ships in the release notes.

Since this adds a user-facing bulk deletion action, I'll leave the merge call to a human maintainer, but the implementation looks correct and well-tested.


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 positive-signal Automation verified a genuine fix/quality contribution flutter flutter work labels Oct 12, 2026
@Dragonire9

Copy link
Copy Markdown
Contributor Author

@Git-on-my-level Thank you for the detailed review and validating the fix across the sync flow!

  • Added the changelog fragment in commit 1257f68 under app/changelog/unreleased/20261012-unsyncable-wals-bulk-clear-export.json.
  • Regarding the corrupted audio rows: navigation remains guarded by WalItemDetailPage's file availability checks, allowing inspection while preventing invalid playback attempts.

Ready for maintainer merge sign-off!

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for this — it's a well-scoped fix for #21217, and I verified the core wiring is sound. Two CI blockers need fixing before this can move forward.

What looks good (verified against the diff and current main):

  • app/lib/pages/conversations/sync_page.dart — restoring the chevron on terminal rows (corrupted / outsideRecoveryWindow / unsupportedAudio / uploadRejected) next to the Delete button lets users reach the detail page to inspect, play back, and export before deleting. Sensible change; the new comment documents the intent well.
  • app/lib/providers/sync_provider.dart — deleteAllCorruptedWals() follows the same session-generation pattern as its siblings and delegates to the existing WalSyncs/LocalWalSync.deleteAllCorruptedWals() (wal_syncs.dart:222, local_wal_sync.dart:1762), which filters exactly the same four terminal statuses as the corruptedWals getter. So the count shown in the sheet matches what gets deleted — no new deletion logic, no drift between UI bucket and service filter. Good.
  • app/lib/pages/conversations/widgets/offline_sync_storage_sheet.dart — the new unsyncableCount/onClearUnsyncable params are optional with safe defaults, so existing call sites are unaffected, and the Failed row only renders when the count is non-zero.
  • Both widget tests are hermetic and cover the new behaviors (chevron presence; row render + clear callback), and the changelog fragment matches the actual behavior.

Blocking (both are CI failures on this head):

  1. Formatting — dart format changes app/test/widgets/sync_row_recovery_window_test.dart ("Formatted 5 files (1 changed)"). Please run dart format on the app package and push.
  2. Hygiene / ui-evidence — modified files under app/lib/ are UI source, so the ui-evidence gate requires at least one tracked screenshot referenced from the PR body (.agent-artifacts/ui-evidence/... pinned to a commit), or an exact UI-Evidence: none -- <reason> escape line if it genuinely doesn't apply. Since this is a visible UI change, screenshots of the Failed storage row and the Delete + chevron row would be ideal.

Minor, non-blocking:

  • The Failed row subtitle reuses l10n.syncStatusTooOld ("Too old to sync — Omi can't accept it"), but the bucket also contains corrupted / unsupported-audio / upload-rejected recordings. A more neutral subtitle would avoid confusion when the bucket is mixed.
  • Restoring the chevron reverses an earlier deliberate choice (the old comment said the detail page had "nothing actionable on it"). Your export-first rationale is convincing, but flagging so a maintainer can confirm the detail page does offer playback/export for these terminal states.

No security concerns: both destructive flows reuse the existing confirm dialog and service-layer deletion path.

Once formatting and the ui-evidence gate are green, this should be ready for maintainer merge — human review is still needed for the merge call itself and the UX judgment on the restored chevron.


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

Copy link
Copy Markdown
Member

Thanks for this contribution! Our review requested some changes (see above) and we haven't heard back in a while. If you're still working on it, just push a commit or leave a comment within the next 7 days. To keep the queue healthy we'll close this PR in 14 days if it stays inactive — and it can always be reopened once updates land. Happy to re-review!

@Git-on-my-level Git-on-my-level added the stale-candidate Candidate for kind stale follow-up label Oct 21, 2026
aryanorastar added a commit that referenced this pull request Oct 23, 2026
Offline Sync can mark every member of a refused multi-file request as
permanently failed, and HTTP 403 was classified as an audio refusal. The
resulting saved files show Failed with only Delete, despite the
single-file uploader supporting an explicit retry. Refused 400/413
batches now isolate members through the existing upload gate before
assigning a per-file verdict; authentication failures retain the file,
persist a pause and stop that drain. The card, recording/file rows and
error-card Retry re-arm historical request refusals through the existing
owner. No audio is deleted or retimed; local-only custody and confirmed
missing/audio/window verdicts stay excluded.

Refs #23049. The original spent-budget card no-op (#21828) is already
merged and released in iOS 1.0.566 ([App Store release
notes](https://apps.apple.com/us/app/omi-smart-meeting-notes/id6502156163)).
#21320 remains separate: navigation/bulk cleanup does not solve
request-level attribution or an authentication refusal.

Validation:
- Eight failures reproduced against unchanged main before the fix. All
84 focused state/provider/UI regressions pass, including persisted
refusals, mixed terminal files, local-only custody, coalesced retries,
authentication persistence, account changes during isolation and
manifest completeness. The final broad app rerun passed: 7,016 tests,
nine skips, zero failures, plus 138 spine tests. The final normal
pre-push gate and all 25 selected preflight checks pass. Its
history-dependent failure-class ratchet explicitly skips this shallow
clone; no history-dependent coverage is claimed locally.
- All six hermetic mobile journeys pass (23 assertions); `make
mobile-verify ARGS="fast --all"`.
- Changed Dart files analyze cleanly; the full analyzer ratchet passes
with the original baseline unchanged.
- Native iPhone 16 Pro / iOS 26.5 simulator build and agent-flutter
interaction passed with real SyncProvider, LocalWalSyncImpl and
AutoSyncPage and a synthetic uploader: requests [3, 1, 1, 1], two files
synced, one uploadRejected, all three original files retained. The
existing Share Recording control produced a valid 60-second, mono 16 kHz
WAV. No customer audio, production account or live STT was used. Initial
local-Firebase SDK settings requests logged test-configuration errors;
they were not successful Omi uploads. Captures and source hashes are in
.agent-artifacts/ui-evidence/fix-23049-upload-refusal/verification.json.
- Regression commands: `flutter test
test/unit/wal_upload_resilience_test.dart
test/unit/wal_sync_display_state_test.dart
test/providers/sync_provider_needs_attention_retry_test.dart
test/providers/sync_provider_sync_wal_wake_test.dart
test/pages/conversations/offline_sync_recording_blocks_test.dart
test/widgets/sync_row_recovery_window_test.dart`; `bash app/test.sh`;
`bash app/scripts/analyze_ratchet.sh`; `make preflight`.

Expected-value changes have external/owning contracts: [RFC 9110
§15.5.4](https://www.rfc-editor.org/rfc/rfc9110.html#section-15.5.4)
permits retry with different credentials;
[§15.5.14](https://www.rfc-editor.org/rfc/rfc9110.html#section-15.5.14)
refuses the request's size, not each member's audio.
`backend/utils/sync/files.py:validate_input_files` rejects a whole
request when one filename/timestamp is invalid. An isolated single-file
400/413 still stops automatic uploads. Existing `Wal.markUploadRejected`
already preserves bytes for deliberate resubmission. The regression
executes that owner, not source-string assertions. It extends the
existing FC-batch-fault-domain-head-of-line-poison guard surface rather
than adding a separate retry authority.

Release and customer verification:
- Needs merge, CI/review and an iOS/Android app release. No backend
deployment, firmware update, bulk migration or account-data mutation is
introduced by this PR.
- The supplied log excerpt confirms stale phone-local backlog but
includes no upload response, terminal refusal reason, app version or
decode result. These are demonstrated app defects, not a confirmed
diagnosis or recovery of that customer's nine files. Retained-record
counts are not recovered-record counts.
- Physical phone verification remains: update to the released build,
retry one affected recording, verify the resulting conversation stays
after refresh/reopen, and verify a saved export plays. Do not delete
Pending/All, log out, reset or reinstall to troubleshoot while local
audio may remain.
- Invalid historical recording timestamps and genuinely
undecodable/missing audio are not repaired by retry; no original time is
invented and no server age/timestamp guard is bypassed. Keep #23049 open
until the customer's outcome is verified.
- Architecture and implementation checklist:
app/docs/offline-sync-stall-recovery.md.

## Product invariants affected

INV-CAP-1: refuse neither custody nor capture. No uplink pause, frame
deletion or firmware assumption is added; failed requests retain phone
files, original times and ownership. Existing live-capture fences and
manifest-completeness checks stay in force.

INV-UI-1 / INV-UI-3: reuse existing neutral Omi retry controls and
localized copy; keep playback/export navigation.
INV-PERF-1: bounded upload isolation in the existing async owner; no
UI-isolate audio work is added.

Failure-Class: FC-batch-fault-domain-head-of-line-poison

Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 2764
-> 2804 | Keep refusal isolation and verdict persistence at the existing
upload owner; use the existing bounded batch selector, gate and
account-generation fence.

## UI evidence

![Retained refusal
retry](https://raw.githubusercontent.com/BasedHardware/omi/9af587055aeadd77e51fc6c5cda31112b3cddcca/.agent-artifacts/ui-evidence/fix-23049-upload-refusal/001-mobile-ios-refused-recordings.png)

![Valid siblings
recovered](https://raw.githubusercontent.com/BasedHardware/omi/9af587055aeadd77e51fc6c5cda31112b3cddcca/.agent-artifacts/ui-evidence/fix-23049-upload-refusal/003-mobile-ios-recovered-siblings.png)

![Retained audio
export](https://raw.githubusercontent.com/BasedHardware/omi/9af587055aeadd77e51fc6c5cda31112b3cddcca/.agent-artifacts/ui-evidence/fix-23049-upload-refusal/005-mobile-ios-retained-audio-export.png)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/23056?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="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/23056?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23056&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-off-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-off-auto-fix-light.svg"><img
alt="Turn off auto-fix"
src="https://www.cubic.dev/buttons/turn-off-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->



## 2026-10-23 maintainer review and merge readiness

Resolved current-main integration by keeping the extracted
wal_policy.dart owner and holdForUser automatic-upload exclusion, while
retaining 400/413 refusal isolation and treating 401/403 as
authentication pauses; reviewed head
fc58d4d. The 84 focused
state/provider/UI tests, analyzer ratchet and 25 selected preflight
checks pass. In a dedicated iPhone 16 Pro / iOS 26.5 simulator, the
production SyncProvider, LocalWalSyncImpl and AutoSyncPage exercised Try
Again against a synthetic uploader: request batch sizes were [3, 1, 1,
1], two WALs became synced, the persistently rejected WAL stayed
uploadRejected, original timestamps stayed unchanged, and all three
1,944,000-byte source files remained. The Synced tab displayed the two
successes. This is fixture-backed processing, not actual Omi STT or
recovered customer conversations; placeholder Firebase warnings are not
successful account authentication.

Aryan approved risk-proportionate verification on 2026-10-23 and
authorized proceeding with this merge candidate. This PR changes
client-side refusal attribution and deliberate retry, not the native
recorder, background lease, codec or backend processing contract. The
production-owner simulator interaction, focused failure/account/custody
regressions and current-head CI satisfy its pre-merge scope; live STT
and the customer's actual recordings are not required to validate that
bounded change. Fresh GitHub checks report no failed or pending checks,
the required Mobile Release Eligibility check passes, existing approval
is present, and the branch is cleanly mergeable. No source was changed
by this readiness reassessment.

Actual server conversation recovery, playback/export on the customer's
released phone build and customer acceptance remain post-release
incident follow-up, not claims of completed verification. The separate
physical QA host has not produced a passing phone result. Keep #23049
open. This merge is not a backend deployment or confirmation of an
app/store release, and no production/customer data was used.
@aryanorastar aryanorastar removed the stale-candidate Candidate for kind stale follow-up label Oct 25, 2026
@Dragonire9

Copy link
Copy Markdown
Contributor Author

Withdrawing this pull request and closing it. For the record: I committed and engineered these fixes under the expectation of the repository's paid bug bounty program, not as unpaid open-source charity. All unmerged contributions are permanently withdrawn.

@Dragonire9 Dragonire9 closed this Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hey @Dragonire9 👋

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

flutter flutter work positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Offline backlog older than 30 days is permanently refused with no bulk export or recovery path

3 participants