fix(knowledge): make connector syncs resilient to removed credentials, partial outcomes and slow completion counts - #8126
Conversation
…duled instead of walking the failure ladder to disabled
… of failing the run
…ocks and index the live set
…tead of re-summing the billing period per run
…al removal to content-engine modes, and keep both sync holds visible
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
There was a problem hiding this comment.
1 issue found across 28 files
Confidence score: 3/5
- In
apps/sim/lib/knowledge/connectors/sync-engine.ts, a stale sync task can race with reconnection, mark the newly connected row unscheduled, and clear its next run, potentially preventing future synchronization. Recheck the credential-less state in the update predicate before applying the stale-task update.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/sim/lib/knowledge/connectors/sync-engine.ts">
<violation number="1" location="apps/sim/lib/knowledge/connectors/sync-engine.ts:852">
P2: If a connector is reconnected after the initial read but before this update, the stale sync task marks the newly connected row unscheduled and clears its next run. Recheck the credential-less state in the update predicate or re-read before applying the terminal write.</violation>
</file>
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Fix all with cubic | Re-trigger cubic
…schedule only connectors left without an auth source, and give fixture connectors a credential
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 42 files
Requires human review: Auto-approval blocked because this review re-detected 2 unresolved issues already reported by Cubic.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
… the unscheduled state only over the row the run observed
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 43 files
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Fix all with cubic | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 44 files
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Fix all with cubic | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 44 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 44 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
Summary
errorwith a reconnect message instead of being re-dispatched every interval and walking the consecutive-failure ladder todisabled. The sync engine short-circuits with acredential_missingskip before taking the lock, and credential deletion writes the same state up front forworkspace/adminconnectors that are left with no API key either; a members-mode connector only drops its optional dedicated content credential. The connector settings page offers Reconnect for that statebuildSyncUnscheduledUpdatebuilder owns the terminal "unscheduled with error, lock released" write used by credential removal, both deleted-knowledge-base skips, the deleted-connector lock release and the capacity rejectionpartialsync with source or dispatch failures is returned from the Trigger task as a normal result (with a warn log) instead ofAbortTaskRunError, so a connector that fails a few documents stops paging as a failed run; the engine already persists the partial outcome on the sync log and the connector rowcompleteSuccessfulSynccounts the connector's live documents before taking the completion locks; a database failure of the count keeps the previous document count and corpus size instead of failing a sync whose documents already landed, and a partialdoc_connector_live_idx(connector_idwhere not excluded, archived or deleted) makes the count an index-only scan (migration0375, concurrent, expand-only)lastSyncError, one per line, instead of the first masking the restusage-gate-cache(cached admissions, refusals re-read) instead of re-summing the payer's whole billing period on every call; the public v1 knowledge search uses the search entry point like the internal search already doesType of Change
Testing
bun run type-check,bun run lint,bun run check:audits,bun run check:api-validation,bun run check:migrations origin/stagingall passChecklist