fix(knowledge): make indexing and connector recovery durable - #7670
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR makes knowledge ingestion and connector recovery durable across worker interruption, provider throttling, and source changes.
Confidence Score: 5/5The PR appears safe to merge; no actionable new defects remain, and both previous findings are resolved in the current code. The latest changes safely improve recovery diagnostics, introduce a compatible typed deadline error, and correct the listing-checkpoint documentation. The current implementation preserves durable storage attachment, processing generation fencing, provider deferral, and authoritative-listing safeguards without an identified blocking failure.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/knowledge/application/add-workspace-files.ts | Imports workspace files into immutable knowledge-owned storage with renewed authorization, provenance checks, and transactional attachment. |
| apps/sim/lib/knowledge/documents/processing-recovery.ts | Implements bounded recovery of abandoned stored documents using fresh processing generations and durable outbox delivery. |
| apps/sim/lib/knowledge/connectors/listing-checkpoint.ts | Persists replay positions before page processing and advances checkpoints only after durable page work. |
| apps/sim/connectors/github/github.ts | Pins paginated listings and hydration to immutable GitHub tree and blob revisions while safely restarting expired snapshots. |
| apps/sim/lib/knowledge/connectors/sync-deferral.ts | Converts positively identified provider-capacity waits into durable connector scheduling deferrals. |
| packages/db/migrations/0336_knowledge_processing_recovery.sql | Adds processing recovery admission state and an additive concurrent partial index for bounded scans. |
| apps/sim/app/api/webhooks/outbox/process/route.ts | Runs stored-document recovery within the outbox cron budget and emits bounded structured diagnostics. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Workspace import or connector listing] --> B[Persist immutable KB-owned artifact]
B --> C[Create pending document]
C --> D[Atomically enqueue processing outbox event]
D --> E[Processing worker claims generation]
E --> F{Processing completes?}
F -->|Yes| G[Publish completed document index]
F -->|Provider capacity unavailable| H[Persist durable deferral]
F -->|Worker abandoned or dispatch lost| I[Recovery scan]
H --> D
I --> J[Install new processing generation and outbox delivery]
J --> E
A --> K[Persist listing checkpoint]
K --> L{Listing complete and authoritative?}
L -->|Yes| M[Reconcile source removals]
L -->|No| N[Resume without deleting unseen documents]
Reviews (2): Last reviewed commit: "fix(knowledge): expose safe recovery dia..." | Re-trigger Greptile
|
@cubic-dev-ai review this PR |
@icecrasher321 I have started the AI code review. It will take a few minutes to complete. |
Summary
Type of Change
Testing
Checklist