Skip to content

fix(app): make the Offline Sync needs-attention button act on what it counts - #21828

Merged
kodjima33 merged 3 commits into
BasedHardware:mainfrom
aryanorastar:fix/app-needs-attention-retry
Oct 16, 2026
Merged

kodjima33 merged 3 commits into
BasedHardware:mainfrom
aryanorastar:fix/app-needs-attention-retry

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

What changed and why

The Offline Sync card counts "N recordings need attention" and offered a Sync button that did nothing for them. A user on Android 1.0.558 reported it directly: "It also shows 11 recordings need attention. There's a non functioning sync button there. I haven't been able to find a way to attend to those 11 clips."

The count (SyncProvider.needsAttentionWalsCount) covers two kinds of recording:

  • failed — status == miss with retryCount >= walMaxAutoRetries: the automatic retry budget is spent, but the file can still upload;
  • terminal — corrupted, outside the recovery window, unsupported audio, upload rejected: nothing can upload these.

The button called syncWals(), i.e. the automatic drain, which only takes miss disk files with retryCount < walMaxAutoRetries. It skipped every recording the card counted, so pressing it was a no-op by construction. This is still the behavior on main.

Now the button grants a spent-budget recording the same fresh budget a per-recording retry already gives (syncWal resets retryCount), then drains — SyncProvider.retryNeedsAttentionWals. It is labelled Try Again and shown only when at least one counted recording can still upload; terminal recordings keep their existing per-row Delete. The pill carries a Key for tests and agent-flutter.

Product invariants affected

none (scripts/pr-preflight --suggest)

How it was verified

  • test/providers/sync_provider_needs_attention_retry_test.dart drives the real SyncProvider and LocalWalSyncImpl with a recording uploader: a plain syncWals() uploads nothing for a spent-budget recording (the old button's behavior); retryNeedsAttentionWals() uploads it and leaves it uploaded; a terminal recording is never offered or retried.
  • test/pages/conversations/offline_sync_recording_blocks_test.dart: with only terminal recordings the card shows no button; with a spent-budget recording it shows Try Again, and tapping it calls the retry. Against main's card both tests fail — a "Sync" pill is shown in both cases.
  • 304 tests across the 22 sync and Offline Sync test files pass; dart format and flutter analyze clean.

Not verified

Not exercised on a device.

Tests

The provider test is the regression for the no-op itself; the two card tests pin when the button appears and what it calls.

Failure class (fixes)

Failure-Class: none

An ordinary instance fix: a control wired to an action whose own admission rule excludes everything the control counts. No registered class covers it; the tests above guard it.

UI evidence

UI-Evidence: none -- the card's existing pill keeps its style; only its label (Sync to Try Again), its action, and whether it is shown change, all covered by the widget tests

🤖 Generated with Claude Code

View guided diff

… counts

The card counts recordings that need attention — a failed upload whose
automatic retry budget is spent, or a terminal state (corrupted, outside the
recovery window, unsupported audio, upload rejected) — and offered a Sync
button that ran the automatic drain. That drain only takes pending files with
retryCount < walMaxAutoRetries, so it skipped every recording the card
counted: pressing Sync did nothing. A user reported exactly that: "11
recordings need attention" with a non-functioning Sync button and no way to
attend to them.

The button now grants a spent-budget recording the fresh budget a
per-recording Retry already gives, then drains (SyncProvider
.retryNeedsAttentionWals). It is labelled Try Again and shown only when at
least one counted recording can still upload; terminal recordings keep their
per-row Delete.

Verification:
- New provider test drives the real SyncProvider and LocalWalSyncImpl with a
  recording uploader: a plain syncWals() uploads nothing for a spent-budget
  recording; retryNeedsAttentionWals() uploads it; a terminal recording is
  never retried.
- New card tests: terminal-only shows no button; a spent-budget recording
  shows Try Again, and tapping it calls the retry. Against main's card both
  fail (a "Sync" pill is shown).
- 304 tests across 22 sync and Offline Sync test files pass; dart format and
  flutter analyze clean.
- Not exercised on a device.

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

The Offline Sync card now reads SyncProvider.retryableAttentionWals inside its
needs-attention branch. The shared visual-audit InertSyncProvider falls back
to noSuchMethod, so the two scenarios whose history holds too-old recordings
(conversations-offline-sync-history and -recording-files) threw
NoSuchMethodError in CI. Derive the getter from allWals, as the real provider
does, and make the retry a no-op.

Verification: flutter test test/visual_audit/visual_audit_smoke_test.dart —
147 passed locally, including both scenarios; flutter analyze clean.

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

Copy link
Copy Markdown
Collaborator Author

Pushed a fix for the red Dart job (and the Mobile Release Eligibility aggregate that follows it).

The card now reads retryableAttentionWals in its needs-attention branch, and the shared visual-audit InertSyncProvider (app/integration_test/visual_audit/fakes.dart) falls back to noSuchMethod. The two scenarios whose history includes too-old recordings — conversations-offline-sync-history and conversations-offline-sync-recording-files — therefore threw NoSuchMethodError. The fake now derives the getter from allWals, as the real provider does, and its retry is a no-op.

flutter test test/visual_audit/visual_audit_smoke_test.dart: 147 passed locally, including both scenarios; flutter analyze clean. My earlier local runs covered the sync and Offline Sync test files but not the visual-audit suite, which is where this showed up.

@Git-on-my-level

Copy link
Copy Markdown
Member

Reviewing this against the current sync semantics — the fix is correct and well-tested. Per file:

  • app/lib/providers/sync_provider.dart: retryableAttentionWals selecting WalSyncDisplayState.failed matches exactly the population the card counts that can still upload (miss with the auto-retry budget spent, per the syncDisplayState mapping in wal.dart), and resetting retryCount re-arms the drain the same way the per-recording retry already does. Terminal states (corrupted / outside recovery window / unsupported audio / upload rejected) are correctly never offered.
  • app/lib/pages/conversations/auto_sync_page.dart: good call hiding the button entirely when only terminal recordings need attention — a dead button was the original complaint. The offline_sync_card_retry_attention key and reusing the existing Try Again string keep this testable with no new l10n surface.
  • app/test/providers/sync_provider_needs_attention_retry_test.dart: driving the real SyncProvider + LocalWalSyncImpl through a fake uploader is exactly the right level — it demonstrates both the old no-op and the new upload path.
  • app/test/pages/conversations/offline_sync_recording_blocks_test.dart: both branches (button hidden for terminal-only, tap retries a spent-budget recording) are covered.
  • app/integration_test/visual_audit/fakes.dart and the changelog fragment: consistent with the interface addition and the shipped behavior.

One non-blocking note: retryNeedsAttentionWals resets retryCount but not lastRetryAt, while resetExhaustedAutoRetries (local_wal_sync.dart) resets both. Since the upload-eligibility gate only reads retryCount — and the per-recording syncWal retry also resets only retryCount — this matches existing retry semantics; flagging it purely as a consistency question if you want the two paths aligned.

Thanks for digging into the root cause rather than papering over it.

This is AI-generated maintainer feedback on behalf of the Omi maintainers. Formal approval is left to a human maintainer; leaving for human maintainer review.


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 16, 2026
Match resetExhaustedAutoRetries, which clears both retry fields when it
re-arms an exhausted recording. Nothing gates on lastRetryAt today, so
this only keeps the two re-arm paths consistent.

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

Copy link
Copy Markdown
Collaborator Author

Pushed 55de141. On the lastRetryAt note: nothing reads it for gating today, so the old behaviour was harmless, but aligning it was one line. retryNeedsAttentionWals now clears both retryCount and lastRetryAt, the same re-arm resetExhaustedAutoRetries does. The provider test seeds a non-zero lastRetryAt and asserts it's 0 after the retry; it fails if the reset line is removed. Retry and card tests pass (7/7) and analyze is clean.

@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.

Trusted contributor (aryanorastar) bug fix, root cause stated, scoped diff, CI green, regression tests added. Confirmed main lacks the fix - 5/5 confidence, merges.

@kodjima33
kodjima33 merged commit 271d2fc into BasedHardware:main Oct 16, 2026
27 checks passed
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.
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.

3 participants