Files
PaperClipAI/server/src/services/skill-source-retry.ts
T
DottaandPaperclip 473c80d13f Automatically import and update project repository skills (#16066)
Automatically import skills from new GitHub project repositories and update enabled sources in the background. Preserve project-derived access, saved selections, immutable execution versions and explicit pins; add legacy adoption, refresh and connection repair in Sources.

Include durable scheduling and bounded work credits, production Storybook journeys, real GitHub-to-routine acceptance receipts and final-head CI/security/Greptile qualification.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-13 16:11:43 -05:00

10 lines
620 B
TypeScript

/** Share retry scheduling between initial imports and subsequent refreshes. */
export function skillSourceRetryAt(error: unknown, failureCount: number, now = new Date()) {
const backoff = Math.min(60 * 60_000, 5 * 60_000 * 2 ** Math.min(failureCount, 4));
const providerDelay = error instanceof Error && 'details' in error
? (error.details as { retryAfterMs?: unknown } | null)?.retryAfterMs : undefined;
const delay = typeof providerDelay === 'number' && Number.isFinite(providerDelay)
? Math.max(backoff, Math.min(24 * 60 * 60_000, providerDelay)) : backoff;
return new Date(now.getTime() + delay);
}