Skip to content

feat(sync): redesign manual sync page (sync_page) to match auto-sync; fix 'stuck' processing perception - #7449

Merged
mdmohsin7 merged 10 commits into
mainfrom
feat/manual-sync-redesign
May 22, 2026
Merged

mdmohsin7 merged 10 commits into
mainfrom
feat/manual-sync-redesign

Conversation

@mdmohsin7

Copy link
Copy Markdown
Member

Why

The auto-sync page was redesigned in #7404 (merged). Manual sync (sync_page.dart) — still used by Limitless — was left behind, and users reported it looking stuck: the moment uploads finished and the phase flipped to processing-on-server, the determinate progress bar froze at 100% (its value source stops updating) while nothing animated.

This brings manual sync up to the same visual language and fixes the perception.

Changes

Status card (replaces the heavy phase-icon + percentage + progress-bar card)

  • Quiet multi-line card. Download/upload: spinner + Downloading from Omi / Uploading to Omi + X of Y · 320 KB/s sub-line + Cancel pill.
  • Processing: live spinner + Processing on Omi… + "this continues in the background — you can leave this screen." No frozen bar. This is the core fix.
  • Idle with pending: N recordings ready to sync + a Sync pill (preserves the SD-card warning / Fast-Transfer suggestion / WiFi-connection-sheet flows behind _handleSyncWals).
  • Waiting-for-internet and error states reuse the restrained amber/red treatment; error card matches auto-sync's red-tint + Retry pill.

WAL rows (type-first)

  • Dropped the leading device image. Title = time · duration · source; status is a restrained colored subtitle; trailing = spinner / Retry pill / FA chevron.
  • Source (SD card / Limitless / From SD) shown as quiet grey text instead of colored pills.
  • BLE per-row download progress bar kept (it's real progress and genuinely useful for slow transfers), recolored to the purple accent.

Chrome

  • Segmented Pending/Synced filter (matches auto-sync's chip style).
  • iOS-style settings rows: right-aligned status text (Fast/BLE, On/Off) + FA chevron, no colored pills.
  • 4-color budget throughout (purple / grey / amber / red).

i18n

  • syncProcessingBackgroundHint (new) — the background-processing reassurance line.
  • syncStatusBackingUp: Backing up… → Syncing… (drops the last bit of "backup" framing; this key is shared with the auto-sync row, so that page benefits too).
  • Everything else reuses keys already added in feat(sync): sync page redesign — quiet card, filter chips, sync→conversation copy #7404 (syncCardDownloadingTitle, syncCardUploadingTitle, syncCardProgressOf, syncCardProcessing, syncCardReadyCount, syncCardWaitingInternet, syncCardAllBackedUp, syncStatusConversationCreated, …).
  • Both keys translated across all 48 non-English locales; flutter gen-l10n emits zero untranslated warnings.

Verification

  • flutter analyze on sync_page.dart and auto_sync_page.dart → no issues.
  • flutter gen-l10n → zero untranslated.
  • All manual-sync flows preserved: SD-card warning dialog, Fast-Transfer suggestion, WiFi connection sheet, cancel, retry, manage-storage sheet (deletable-pending count), per-WAL delete-while-processing guard.

Opened as draft for the standard checks before merge.

🤖 Generated with Claude Code

mdmohsin7 added 7 commits May 21, 2026 23:31
… processing perception

Limitless still uses manual sync, and users thought it was stuck because
the progress bar froze at 100% the moment uploads finished and the phase
flipped to processing-on-server (the bar was determinate, fed by a value
that stops updating).

Apply the auto-sync visual language and fix the perception:
- Quiet multi-line status card replacing the heavy progress card. During
  download/upload it shows a spinner + 'Downloading/Uploading to Omi' +
  'X of Y · speed' and a Cancel pill. During processing it shows a live
  spinner + 'Processing on Omi…' + a 'continues in the background, you can
  leave' hint — no frozen bar.
- Idle-with-pending shows 'N recordings ready to sync' + a Sync pill
  (preserves the SD-card / Fast-Transfer / WiFi-sheet flows).
- Type-first WAL rows: drop the leading device image, status as a
  restrained colored subtitle, trailing spinner / Retry pill / chevron.
  Source (SD card / Limitless) shown as quiet grey text. BLE per-row
  download progress bar kept (real progress), recolored to the purple accent.
- Segmented Pending/Synced filter; iOS-style settings rows (right-aligned
  status text + chevron, no colored pills).
- 4-color budget throughout; error card matches auto-sync's red-tint + Retry.
…ckingUp to 'Syncing…'

- syncProcessingBackgroundHint: reassures users on the manual sync card
  that cloud processing continues in the background and they can leave.
- syncStatusBackingUp: 'Backing up…' → 'Syncing…' (drops the leftover
  'backup' framing; also used by the auto-sync row).
Each syncStatusBackingUp aligns with the locale's existing syncingStatus
voice; the hint conveys 'keeps running even if you leave'.
The wearable can be an Omi or a Limitless device, so the device→phone
transfer copy must not say 'Omi'. Cloud steps keep 'Omi' (Omi's server).

- syncCardDownloadingTitle / syncStatusDownloadingFromDevice:
  'Downloading from Omi' → 'Downloading from your device'
- syncStatusOnDevice: 'Waiting on Omi' → 'On your device'
- syncFlowIntro: 'transferred from your Omi device' → 'from your device'
  ('uploaded to Omi's server' unchanged — the cloud is Omi)

Shared with the auto-sync page, so it's corrected there too.
@greptile-apps

greptile-apps Bot commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR redesigns sync_page.dart (Limitless / manual-sync flow) to match the visual language of auto_sync_page.dart and fixes the perception of sync being "stuck" by replacing the frozen determinate progress bar with a live spinner during the cloud-processing phase.

  • Status card: replaces the old phase-icon + percentage + progress-bar card with a compact multi-line card; downloading/uploading phases show a Cancel pill, processing phase shows a spinner + background-reassurance hint, idle-with-pending shows a Sync pill, and error states use the same red-tint treatment as auto-sync.
  • WAL rows: removes the leading device image, collapses storage-source colored pills into quiet grey text, and adds per-row Retry pills for failed/retrying display states.
  • i18n: adds syncProcessingBackgroundHint, debrands "Omi" → "your device" in two existing strings, and updates "Backing up…" → "Syncing…" across all 48 non-English locales. A previously reported FutureBuilder rebuild bug is also fixed by caching _wifiSupported in initState.

Confidence Score: 4/5

Safe to merge after addressing the retry-path gap on first-failure WALs.

The redesign is well-structured and the FutureBuilder regression from the previous review is fixed. One gap remains: _trailing in WalListItem does not receive hasError, so a WAL that fails on its very first attempt (retryCount == 0) shows red error text alongside a navigation chevron rather than a Retry pill. If other WALs happen to be in the uploaded/processing state at the same moment, the global error card is also suppressed, leaving the user with no accessible retry action on the list screen.

app/lib/pages/conversations/sync_page.dart — specifically the _trailing method in WalListItem and the _buildProcessCard guard condition.

Important Files Changed

Filename Overview
app/lib/pages/conversations/sync_page.dart Large redesign of sync UI: FutureBuilder rebuild bug fixed, new compact status card introduced, WAL row simplified. One logic gap in _trailing where hasError is not forwarded, leaving no retry action when a WAL fails on its first attempt while other WALs are in the uploaded/processing state.
app/lib/l10n/app_en.arb Adds syncProcessingBackgroundHint, renames existing strings to remove device-specific branding ("Omi" → "your device"), and changes "Backing up…" to "Syncing…". All strings have descriptions; no issues found.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[_buildProcessCard] -->|syncError != null AND failedWal == null| B[_buildSyncErrorCard Retry pill shown]
    A -->|isSyncing| C{SyncPhase}
    C -->|downloading| D[Title: Downloading Cancel pill]
    C -->|uploading| E[Title: Uploading Cancel pill]
    C -->|processingOnServer| F[Title: Processing Background hint]
    C -->|waitingForInternet| G[Title: Waiting Amber text]
    C -->|idle| H[Title: Uploading Cancel if SD card]
    A -->|uploaded > 0| I[Title: Processing Spinner shown]
    A -->|readyToSync > 0| J[Title: N recordings Sync pill]
    A -->|else| K[Title: All backed up Grey text]
    L[WalListItem._trailing] -->|isSyncing| M[Spinner]
    L -->|syncDisplayState == failed or retrying| N[Retry pill]
    L -->|otherwise| O[Chevron]
    P[hasError = failedWal?.id == wal.id] -->|true retryCount==0 syncDisplayState == waiting| O
    P -->|Red text shown in _rowStatus| Q[User sees red text + chevron No retry button accessible]
    style Q fill:#ff6b6b,color:#fff
Loading

Reviews (3): Last reviewed commit: "fix(sync): cache isWifiSyncSupported fut..." | Re-trigger Greptile

Comment on lines 643 to +649
case SyncPhase.idle:
phaseText = context.l10n.processingProgress(
syncProvider.processedWalsCount,
syncProvider.initialMissingWalsCount,
);
phaseIcon = Icons.sync;
phaseColor = Colors.deepPurpleAccent;
showCancel = syncProvider.isSdCardSyncing;
showSpeed = true;
title = l.syncCardProcessing;
subtitle = _progressLine(s, speedStr);
if (syncProvider.isSdCardSyncing) {
action = _statusActionPill(l.cancel, Colors.redAccent, () => _showCancelSyncDialog(context, syncProvider));
}
break;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 SyncPhase.idle branch shows misleading "Processing on Omi…" title at sync start

When syncWals() is invoked, the state transitions to SyncStatus.syncing while SyncPhase is still idle (it's reset to idle first, and toSyncing() without a phase argument preserves it). During this window the card shows "Processing on Omi…" with the background-hint subtitle instead of a neutral starting message. A more accurate title would be syncCardUploadingTitle as a fallback.

Suggested change
case SyncPhase.idle:
phaseText = context.l10n.processingProgress(
syncProvider.processedWalsCount,
syncProvider.initialMissingWalsCount,
);
phaseIcon = Icons.sync;
phaseColor = Colors.deepPurpleAccent;
showCancel = syncProvider.isSdCardSyncing;
showSpeed = true;
title = l.syncCardProcessing;
subtitle = _progressLine(s, speedStr);
if (syncProvider.isSdCardSyncing) {
action = _statusActionPill(l.cancel, Colors.redAccent, () => _showCancelSyncDialog(context, syncProvider));
}
break;
case SyncPhase.idle:
title = l.syncCardUploadingTitle;
subtitle = _progressLine(s, speedStr);
if (syncProvider.isSdCardSyncing) {
action = _statusActionPill(l.cancel, Colors.redAccent, () => _showCancelSyncDialog(context, syncProvider));
}
break;

Greptile P2: syncWals() sets SyncStatus.syncing while SyncPhase is still
idle, so the idle branch rendered 'Processing on Omi…' at kickoff, wrongly
implying cloud-side work. Use syncCardUploadingTitle as the neutral fallback.
@mdmohsin7

Copy link
Copy Markdown
Member Author

@greptile-apps re-review

…w doesn't flicker

It was created inline in the Consumer<SyncProvider> builder, so every
sync-progress notification recreated the future and reset the FutureBuilder
to waiting (showTransferMethod=false), making the row disappear/reappear on
every tick. Cache it once in initState.
@mdmohsin7

Copy link
Copy Markdown
Member Author

@greptile-apps re-review

Comment on lines 87 to 111
Widget _trailing(BuildContext context, SyncProvider syncProvider) {
if (wal.isSyncing) {
return const SizedBox(
width: 16,
height: 16,
child: CircularProgressIndicator(strokeWidth: 2, valueColor: AlwaysStoppedAnimation(Colors.deepPurpleAccent)),
);
}
final st = wal.syncDisplayState;
if (st == WalSyncDisplayState.failed || st == WalSyncDisplayState.retrying) {
return GestureDetector(
onTap: () => syncProvider.syncWal(wal),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 7),
decoration: BoxDecoration(
color: Colors.deepPurpleAccent.withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(100),
),
child: Text(context.l10n.retry,
style: const TextStyle(color: Colors.deepPurpleAccent, fontSize: 13, fontWeight: FontWeight.w500)),
),
);
}
return FaIcon(FontAwesomeIcons.chevronRight, color: Colors.grey.shade600, size: 12);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 _trailing ignores hasError, leaving no retry path on first failure

_trailing decides the trailing widget purely from wal.syncDisplayState. On a WAL's very first failure (retryCount == 0), syncDisplayState returns waiting, so _trailing renders a navigation chevron instead of a Retry pill.

At the same time _buildSyncErrorCard is suppressed because failedWal != null (line 610 condition), and when uploadedWals.length > 0 the process card renders "Processing on Omi…" (the uploaded > 0 branch, line 654) without any retry action. The user sees a red "Failed" subtitle on the WAL row paired with a chevron and no retry button anywhere on the screen — the only exit is to navigate into WalItemDetailPage.

Fix: pass hasError into _trailing (or derive it from syncProvider.failedWal?.id == wal.id directly inside the method) and return the Retry pill when it is true.

…n _trailing)

Greptile P1: _trailing decided purely from syncDisplayState, which is
'waiting' on the first failure (retryCount 0), so a failed WAL showed a red
'Failed' subtitle next to a chevron and no retry — the error card is also
suppressed while failedWal != null. Pass hasError into _trailing and render
the Retry pill when set.
@mdmohsin7
mdmohsin7 merged commit 59ac14b into main May 22, 2026
2 checks passed
@mdmohsin7
mdmohsin7 deleted the feat/manual-sync-redesign branch May 22, 2026 13:18
mdmohsin7 added a commit that referenced this pull request May 23, 2026
Resolve l10n conflicts: take main's version of all 49 ARBs (it carries
#7449's keys — syncStatusBackingUp, syncStatusOnDevice, syncCardDownloadingTitle,
syncFlowIntro), then re-add syncCardRateLimited × 49 from this branch.
Generated AppLocalizations files regenerated via flutter gen-l10n.

No code conflicts.
mdmohsin7 added a commit that referenced this pull request May 23, 2026
…fails; surface the reason, back off, and log why (#7451)

## Problem

Two distinct backend conditions both manifested as the same alarming
amber **"Couldn't process — retrying"** on every recording, with users
tapping Retry forever and amplifying the storm. The chain was the same
in both cases: the client treated transient-but-systemic backend signals
as content failures, burned each recording's retry budget, and never
told the user *or* itself what was actually happening.

**(1) Fair-use throttling (HTTP 429)** — a user draining a multi-day
offline backlog past their fair-use cap got the cap enforced (~474× 429
in 48h in Cloud Run for one user). `uploadLocalFilesV2` mapped 429 to a
generic `Exception('Rate limited or budget exhausted')` and auto-sync's
catch — which already excludes `SocketException` — *didn't* exclude 429.
So every throttle bumped `retryCount` and the app re-fired uploads every
minute with no backoff.

**(2) Backend-busy stale-guard fails** — when `backend-sync`'s
`storage`/`postprocess` pools are saturated (`storage 96/96 + 29
queued`, `postprocess 24/24 + 80 queued` observed), uploads are accepted
(202), assigned a `jobId`, and sit in `queued` server-side. After 10 min
the server's stale guard in `database/sync_jobs.py:get_sync_job`
rewrites the status to `failed` with the misleading message `"Job timed
out (background worker likely died)"` — but no worker died, none was
*available*. The reconciler reads `failed`, reverts the WAL, bumps
retry. User taps Retry → new job → also queued → same fate → retry
budget exhausted → red "Failed". Reproduced and confirmed end-to-end via
reporter's `reconcile_poll` / `reconcile_revert` log breadcrumbs (added
in this PR). Separate backend issue opened: #7469.

## Fix

### Surface the real reason, back off instead of hammering

- `uploadLocalFilesV2` throws a **typed `SyncRateLimitedException`** on
429, parsing `Retry-After`.
- `SyncRateLimiter` (new, persisted, app-global) holds a cooldown
timestamp **+ a `RateLimitReason`** (`rateLimit` | `backendBusy`).
`extends ChangeNotifier` so `SyncProvider` rebuilds the UI the moment
the gate flips.
- Every upload entry point checks the cooldown and skips while active:
auto-sync `_syncSingleWal`, batch `syncAll` (gates entry, **breaks the
loop** on 429 mid-batch), single `syncWal`. `syncWals`/`syncWal` at the
provider level **early-return** when limited — no more "Cancel pill
flashes then resets". Any successful upload clears the cooldown.
- **429 no longer bumps `retryCount`** — treated like `SocketException`
(transient throttle, not content failure). Side-effect: rows that would
have flipped to amber "Couldn't process — retrying" stay calm grey
**"Waiting to sync"** automatically — no new per-row state needed.

### Backend-busy detection (new in this PR)

- Reconciler's `failed`/`partial_failure` branch detects the specific
`"background worker likely died"` error from the server's stale guard
and treats it as backend capacity, **not** a content failure:
  - WAL reverts to `miss` **without bumping `retryCount`**.
- Triggers a 10-min cooldown via `SyncRateLimiter` with `reason:
backendBusy`.
- Status cards (auto-sync + manual) read `SyncProvider.rateLimitReason`
and pick distinct, calm copy:
- `backendBusy` → **"Omi servers are busy — your recordings will sync
once capacity returns"**.
- `rateLimit` → **"Fair-use limit reached — syncing will resume
automatically"**.
- Spinner is hidden in the rate-limited state on both cards so the card
reads unambiguously as paused (per-row "Uploaded · processing on Omi"
still shows the in-flight server work on the WALs that uploaded before
the limit hit).

### Observability (the gap that prevented diagnosis before)

The reconciler used to silently break on `transient` / non-terminal and
silently revert on `failed`/`notFound` — the server's `status`, `error`,
`failedSegments` were *received* but discarded. With "Log to file" on in
Settings → Developer, you now get the actual cause in a shareable log:

- `fetchSyncJobStatus` logs the HTTP status code when non-200 (so
429-on-the-GET, 5xx, etc. are visible — answers "why is the WAL stuck on
'Processing on Omi'?").
- `reconcileUploadedWals` emits `reconcile_poll` for every per-job
outcome (transient / non-terminal-queued / non-terminal-processing /
completed) and `reconcile_revert` on the notFound and
failed/partial_failure branches with the server's `status`, `error`,
`failedSegments`/`totalSegments`, the post-bump `retryCount`, and
`backendBusy` / `retryCountBumped` flags.

This is how the reporter's stuck-recordings case was actually diagnosed
— the breadcrumbs lined up with the server's `"background worker likely
died"` error at the 10-minute mark, leading to the backend-busy fix
above.

## Files

| Area | File | Change |
|---|---|---|
| Gate (new) | `app/lib/services/wals/sync_rate_limiter.dart` | New
`SyncRateLimiter`, persisted, ChangeNotifier, with `RateLimitReason` |
| HTTP | `app/lib/backend/http/api/conversations.dart` | Typed
`SyncRateLimitedException`, `Retry-After` parser, HTTP-status log on
non-200 GET |
| Barrels | `app/lib/services/wals.dart`,
`app/lib/services/wals/wal_interfaces.dart` | Export the limiter + the
exception |
| Engine | `app/lib/services/wals/local_wal_sync.dart` | Gate `syncAll`,
typed 429 catch in batch + single paths, backend-busy detection in
reconciler, per-job poll / revert logging |
| Provider | `app/lib/providers/sync_provider.dart` | Listens to
limiter; `syncWals`/`syncWal` early-return when limited; expose
`isRateLimited` / `rateLimitedUntil` / `rateLimitReason` |
| Auto-sync | `app/lib/providers/capture_provider.dart` | Gate
`_syncSingleWal`, typed 429 catch (no `retryCount` bump), clear on
success |
| UI | `app/lib/pages/conversations/auto_sync_page.dart`,
`app/lib/pages/conversations/sync_page.dart` | "Fair-use limit reached"
/ "Omi servers are busy" branches selected by reason; spinner hidden
while paused; pill hidden so taps don't no-op |
| l10n | `app/lib/l10n/app_en.arb` + 48 locales + codegen | Two new keys
(`syncCardRateLimited`, `syncCardBackendBusy`) |

## Out of scope (explicit follow-ups)

- **Backend fix** for the stale guard mis-flagging healthy queued jobs
and for capacity: tracked in **#7469** (cc @beastoin). The client
mitigation here is pattern-matching a server error string; the right fix
is server-side. Lays out: distinguish `queued` vs `processing` in the
stale guard, fix the misleading error string, scale the saturated pools,
and add observability (log stale-guard rewrites, include UID in POST 202
accept logs).
- **Reconciler staleness bound** for the *different* "stuck on
Processing on Omi" case where the status GET is unreachable (429'd,
5xx'd) so WALs sit `uploaded` indefinitely. Sketched earlier; not in
this PR.
- **Manual sync_page's full integration** with #7449 already merged —
this PR's branch carries the merge.

## Verification

- `flutter analyze` clean on every touched file (the warnings shown for
other files are pre-existing).
- `flutter gen-l10n` → zero untranslated.
- Reporter ran the simulate path and the dev log shows the full
reconcile-poll/revert breadcrumbs matching the expected flow; the WALs
stop showing as "Couldn't process — retrying" when the server returns
the stale-guard error.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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