Problem
AbstractConnector.sync() updates last_sync_at only on successful completion. If a large sync crashes mid-way (OOM, timeout, worker restart), the next run restarts from the beginning. For connectors with thousands of sources (large file servers, deep web crawls), this wastes significant time and network I/O.
Current state:
sync starts → process N sources → … crash → next run restarts from last_sync_at (hours ago)
Proposed Solution
Write a checkpoint to Redis after each successfully processed source during sync:
connector:{id}:checkpoint → {
"started_at": ISO,
"processed_source_ids": [...],
"last_checkpointed_at": ISO
}
At sync start, check for an in-progress checkpoint. If found and started within a configurable window (e.g., 2h), resume by skipping already-processed source IDs. Clear the checkpoint on successful completion or explicit full-refresh.
Changes to AbstractConnector:
_write_checkpoint(source_id) — called after each successful _process_change()
_read_checkpoint() → set of already-processed source IDs or empty set
_clear_checkpoint() — called on clean completion
sync() — skip sources in checkpoint set, write checkpoint after each
Files
autobot-backend/knowledge/connectors/base.py — add checkpoint methods; update sync() loop
autobot-backend/knowledge/connectors/models.py — add resumed_from_checkpoint: bool to SyncResult
autobot-backend/api/knowledge_connectors.py — expose checkpoint status in history entries
Acceptance Criteria
Problem
AbstractConnector.sync()updateslast_sync_atonly on successful completion. If a large sync crashes mid-way (OOM, timeout, worker restart), the next run restarts from the beginning. For connectors with thousands of sources (large file servers, deep web crawls), this wastes significant time and network I/O.Current state:
Proposed Solution
Write a checkpoint to Redis after each successfully processed source during sync:
At sync start, check for an in-progress checkpoint. If found and started within a configurable window (e.g., 2h), resume by skipping already-processed source IDs. Clear the checkpoint on successful completion or explicit full-refresh.
Changes to
AbstractConnector:_write_checkpoint(source_id)— called after each successful_process_change()_read_checkpoint()→ set of already-processed source IDs or empty set_clear_checkpoint()— called on clean completionsync()— skip sources in checkpoint set, write checkpoint after eachFiles
autobot-backend/knowledge/connectors/base.py— add checkpoint methods; updatesync()loopautobot-backend/knowledge/connectors/models.py— addresumed_from_checkpoint: booltoSyncResultautobot-backend/api/knowledge_connectors.py— expose checkpoint status in history entriesAcceptance Criteria
sync()writes a checkpoint to Redis after each successfully processed sourceSyncResultincludesresumed_from_checkpoint: boolincremental=False) always ignores and clears any checkpoint