fix(connectors): stop hydration after rate limits - #7255
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThe PR stops deferred connector hydration after a structured provider rate limit while preserving the provider error for backoff scheduling.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/knowledge/connectors/sync-engine.ts | Detects structured throttling after an active hydration batch and propagates the typed error to the existing sync backoff path. |
| apps/sim/lib/knowledge/documents/utils.ts | Adds cause-chain-aware rate-limit detection based on normalized provider signals and structured HTTP evidence. |
| apps/sim/connectors/google-drive/google-drive-errors.ts | Classifies all normalized Google Drive reasons while retaining a bounded diagnostic reason list. |
| apps/sim/connectors/github/github.ts | Fetches object metadata and streams raw blobs through the shared byte limit, explicitly handling missing, forbidden, binary, and oversized files. |
| apps/sim/lib/knowledge/connectors/sync-engine.test.ts | Verifies that throttling stops later hydration batches and preserves the provider retry delay. |
| apps/sim/connectors/github/github.test.ts | Covers large-file hydration, absence, authorization failures, bodyless responses, and byte-cap handling. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Connector lists documents] --> B[Hydrate deferred batch]
B --> C{Structured rate limit?}
C -->|Yes| D[Stop later hydration batches]
D --> E[Preserve provider error and retry delay]
E --> F[Schedule connector backoff]
C -->|No| G[Isolate ordinary document failures]
G --> H[Process successful documents]
Reviews (3): Last reviewed commit: "fix(connectors): inspect all drive error..." | Re-trigger Greptile
There was a problem hiding this comment.
2 issues found across 6 files
Confidence score: 3/5
- In
apps/sim/lib/knowledge/documents/utils.ts, structured Google DriverateLimitExceededanduserRateLimitExceeded403 responses without rate-limit headers are missed, leaving later hydration batches without the intended rate-limit handling; detect these typed provider errors explicitly. - In
apps/sim/connectors/github/github.ts, a bodyless 200 blob without trustworthyContent-Lengthcan be recorded as a false size-limit skip rather than a hydration failure; reject unavailable bodies separately and classify size-limit skips only when the size is bounded.
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/documents/utils.ts">
<violation number="1" location="apps/sim/lib/knowledge/documents/utils.ts:245">
P2: When Google Drive returns a structured `rateLimitExceeded` or `userRateLimitExceeded` 403, it does not necessarily send rate-limit headers. This branch misses that typed provider error, so later hydration batches still amplify the throttle; normalize provider-specific rate-limit markers into a shared signal before requiring headers here.</violation>
</file>
<file name="apps/sim/connectors/github/github.ts">
<violation number="1" location="apps/sim/connectors/github/github.ts:171">
P2: When GitHub returns a bodyless 200 blob without a trustworthy `Content-Length`, this path records a false size-limit skip instead of a hydration failure. Reject unavailable bodies separately and classify only a bounded-read failure with observed bytes above `MAX_FILE_SIZE` as oversized.
(Based on your team's feedback about distinguishing oversized responses from unavailable bodies.)</violation>
</file>
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
|
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 8 files
Confidence score: 3/5
- In
apps/sim/connectors/google-drive/google-drive-errors.ts,rateLimitedcan miss a later rate-limit reason when more than 16 preceding reasons are present, potentially misclassifying throttling errors and causing incorrect retry or user-facing handling—compute the throttle signal from the uncapped validation data.
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/connectors/google-drive/google-drive-errors.ts">
<violation number="1" location="apps/sim/connectors/google-drive/google-drive-errors.ts:111">
P2: When a structured error contains more than 16 preceding reason entries, `rateLimited` misses a later rate-limit reason because it inspects the capped diagnostic list. Compute the throttle signal from the uncapped validated reasons before applying the diagnostic cap, so deferred hydration still stops on every structured rate limit.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
|
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Staging's #7255 added this case while this branch was making `profile` part of SecureFetchOptions. The rebase kept both, leaving a call that exercised the fail-closed fallback rather than asserting a real profile — tests are excluded from type-check, so nothing caught it.
Summary
Testing
bun run --cwd apps/sim test -- connectors/github/github.test.ts lib/knowledge/documents/utils.test.ts lib/knowledge/connectors/sync-engine.test.tsbun run --cwd apps/sim type-checkbun run agent-stream-docs:generatebun run skills:syncbun run lintbun run apps/sim/scripts/check-block-registry.ts origin/stagingbun run check:audits