Skip to content

fix: continue syncing remaining WAL batches when one fails - #4869

Merged
mdmohsin7 merged 2 commits into
mainfrom
fix/wal-sync-continue-on-batch-failure
Feb 19, 2026
Merged

mdmohsin7 merged 2 commits into
mainfrom
fix/wal-sync-continue-on-batch-failure

Conversation

@mdmohsin7

@mdmohsin7 mdmohsin7 commented Feb 18, 2026 •

Copy link
Copy Markdown
Member

Summary

  • When uploading WAL files to the backend, files are sent in batches of 3. If any batch fails (e.g. a file has a future timestamp causing a 400 error from the server), the entire sync was aborted due to a rethrow in the catch block.
  • This meant valid files with past timestamps that hadn't been sent yet would also fail to sync, even though they would succeed individually.
  • Changed rethrow to continue so a failed batch is skipped and the remaining batches still get processed. Failed WALs remain as miss on disk and will be retried on the next sync cycle.

Test plan

  • Verify that if one batch of WAL files fails to upload (e.g. server returns 400), the remaining batches still sync successfully
  • Verify that failed WALs remain with miss status and are retried on the next sync
  • Verify normal sync flow (all batches succeed) is unaffected

🤖 Generated with Claude Code

Previously, if any batch of files failed to upload (e.g. due to a
future timestamp causing a 400 error), the exception would propagate
up and abort the entire sync. Files with valid timestamps that hadn't
been sent yet would also fail to sync. Now the failed batch is skipped
and the loop continues with remaining batches. Failed WALs stay as
'miss' on disk and will be retried on the next sync.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request correctly addresses an issue where a single failed WAL sync batch would abort the entire process. By changing rethrow to allow the loop to continue, it improves the robustness of the sync mechanism. However, I've identified a potential issue with state management in the failure case. My review includes a suggestion to ensure the UI and persisted state are correctly updated when a batch fails, preventing a stale 'syncing' status.

Remove `continue` so that _saveWalsToFile() and onWalUpdated() run
after a failed batch, ensuring isSyncing=false is persisted to disk
and the UI is updated.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@mdmohsin7
mdmohsin7 merged commit 083cd1a into main Feb 19, 2026
1 check passed
@mdmohsin7
mdmohsin7 deleted the fix/wal-sync-continue-on-batch-failure branch February 19, 2026 09:11
@beastoin

Copy link
Copy Markdown
Collaborator

Hey 👋 — thanks for putting this together! Before we can review, could you share a quick live demo (screenshot, screen recording, or terminal output) showing this working on your local or dev environment?

In the AI era, writing code is the easy part — what really makes a PR stand out is proof that it works end-to-end. A short video or even a screenshot goes a long way in helping reviewers feel confident about merging.

Feel free to update this PR whenever you have something to show. Thanks! 🙏

ellaaicare pushed a commit to ellaaicare/omi that referenced this pull request Apr 12, 2026
…ware#4869)

## Summary
- When uploading WAL files to the backend, files are sent in batches of
3. If any batch fails (e.g. a file has a future timestamp causing a 400
error from the server), the entire sync was aborted due to a `rethrow`
in the catch block.
- This meant valid files with past timestamps that hadn't been sent yet
would also fail to sync, even though they would succeed individually.
- Changed `rethrow` to `continue` so a failed batch is skipped and the
remaining batches still get processed. Failed WALs remain as `miss` on
disk and will be retried on the next sync cycle.

## Test plan
- [x] Verify that if one batch of WAL files fails to upload (e.g. server
returns 400), the remaining batches still sync successfully
- [x] Verify that failed WALs remain with `miss` status and are retried
on the next sync
- [x] Verify normal sync flow (all batches succeed) is unaffected

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
…ware#4869)

## Summary
- When uploading WAL files to the backend, files are sent in batches of
3. If any batch fails (e.g. a file has a future timestamp causing a 400
error from the server), the entire sync was aborted due to a `rethrow`
in the catch block.
- This meant valid files with past timestamps that hadn't been sent yet
would also fail to sync, even though they would succeed individually.
- Changed `rethrow` to `continue` so a failed batch is skipped and the
remaining batches still get processed. Failed WALs remain as `miss` on
disk and will be retried on the next sync cycle.

## Test plan
- [x] Verify that if one batch of WAL files fails to upload (e.g. server
returns 400), the remaining batches still sync successfully
- [x] Verify that failed WALs remain with `miss` status and are retried
on the next sync
- [x] Verify normal sync flow (all batches succeed) is unaffected

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

2 participants