Skip to content

Prevent large-vault full-scan RPCs from timing out with outcome_unknown - #201

Merged
callumalpass merged 1 commit into
mainfrom
fix/large-vault-timeout
Nov 26, 2026
Merged

callumalpass merged 1 commit into
mainfrom
fix/large-vault-timeout

Conversation

@callumalpass

Copy link
Copy Markdown
Member

Fixes large vaults (~17,000 files) failing with Sync needs attention — Sync stopped. Something went wrong (outcome_unknown). Your files here are untouched. during full-vault scans.

Root cause

  • NativeSync.call() enforced a fixed 180-second wall-clock timeout across the entire RPC, even while all, filesAll, resourcesAll, and at were actively streaming pages back from the SDK replica, and reported every timeout (including read-only scans) as outcome_unknown.
  • On query_budget_exceeded, all() previously restarted the entire full-vault scan from page 1 with a halved page size for every page instead of shrinking only the oversized page.
  • resolveDefinition() called remoteAll() (scanning every record and file in the vault) before pushing a single definition update.

Changes

  • src/sync/native/page.ts, src/sync/native/protocol.ts: Emit per-page progress heartbeats from all, filesAll, resourcesAll, and at; shrink only the oversized page on query_budget_exceeded (falling back to a smaller initial limit only if the runtime refuses a smaller limit on an existing cursor, and failing cleanly if even a single-record page exceeds the budget).
  • src/sync/native/plugin.ts: Reset the per-call inactivity timer on progress messages; classify timed-out read-only RPCs as timeout (friendly message, never outcome_unknown) while keeping outcome_unknown for write RPCs.
  • src/sync/native/pass.ts: Read resources directly in resolveDefinition() before updating, without scanning all records and files first.
  • test/native/mobile.test.mjs, test/native/sync.test.mjs: Add tests covering per-page progress heartbeats, local page shrinking and single-record budget refusal, read vs write timeout classification, and resolveDefinition() avoiding full scans.

@callumalpass
callumalpass marked this pull request as ready for review November 26, 2026 21:56
@callumalpass
callumalpass enabled auto-merge (squash) November 26, 2026 21:56
@callumalpass
callumalpass merged commit 65a3503 into main Nov 26, 2026
2 checks passed
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