diff --git a/@packages/imessage/Sources/IMessageSync/SyncManager.swift b/@packages/imessage/Sources/IMessageSync/SyncManager.swift index 8809415..4db7313 100644 --- a/@packages/imessage/Sources/IMessageSync/SyncManager.swift +++ b/@packages/imessage/Sources/IMessageSync/SyncManager.swift @@ -195,8 +195,13 @@ final class SyncManager: BaseSyncManager { // Initial-load path: server has nothing, stream a metadata-only batch // import (attachments without blob bytes). Subsequent cycles use the // standard incremental path with full attachment data. - if isInitialLoad && stats.messageCount == 0 { - log.info("Initial load detected - using batch sync") + // Re-enter performInitialSync whenever the server is empty. The previous + // gate flipped `isInitialLoad = false` after the first run regardless of + // success — a partial-failure run would then route to the incremental + // path on the next cycle even though the server still had zero messages, + // making the missing data unrecoverable without a manual restart. + if stats.messageCount == 0 { + log.info("Server empty — entering initial-batch sync path") activityLog.info("First sync detected - using optimized batch endpoint") await performInitialSync() isInitialLoad = false