fix(sync): fold initial empty-page cursor before entering retry loop

When the first small response is empty with hasMore=false and carries
sync.nextSince, the file was deleted before that cursor value was saved.
If retry pages also omit nextSince, nextPullSince stays at the old
lastPullAt and the next poll re-fetches the same completed tail window.

Fold sync0.nextSince into nextPullSince immediately after cleanupTempFile,
before the retry loop, matching the existing pattern for retry pages.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
diguaandClaude Sonnet 4.6 committed 2026-06-23 14:18:32 +08:00
1 parent f69f419192
commit f8079d9031
1 file changed
+1
+1
View File
@@ -255,6 +255,7 @@ export class PullEngine {
if (stat.size < 1024) {
if (!fileContainsMessages(tempFile) && sync0?.hasMore === false) {
cleanupTempFile(tempFile)
if (sync0?.nextSince !== undefined) nextPullSince = Math.max(nextPullSince, sync0.nextSince)
const retryDelays = [2000, 3000, 5000]
let retrySuccess = false
let retryHasMore = false