Skip to content

Commit b24b223

Browse files
committed
fix(knowledge): flag incomplete listings at engine level when pagination is truncated
1 parent 3823396 commit b24b223

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

apps/sim/lib/knowledge/connectors/sync-engine.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,21 @@ export async function executeSync(
415415
hasMore = page.hasMore
416416
}
417417

418+
if (hasMore) {
419+
/**
420+
* Pagination stopped before the source was exhausted — either the
421+
* MAX_PAGES guard tripped or the connector reported hasMore without a
422+
* cursor. The listing is incomplete, so flag it to suppress deletion
423+
* reconciliation; otherwise documents beyond the truncation point would
424+
* be removed even though they still exist in the source.
425+
*/
426+
syncContext.listingCapped = true
427+
logger.warn('Pagination ended before source exhaustion; skipping deletion reconciliation', {
428+
connectorId,
429+
docsSoFar: externalDocs.length,
430+
})
431+
}
432+
418433
logger.info(`Fetched ${externalDocs.length} documents from ${connectorConfig.name}`, {
419434
connectorId,
420435
})

0 commit comments

Comments
 (0)