Files
PaperClipAI/server/src/services/native-runtime/setup-probe-failure.ts
T
Devin FoleyandPaperclip 6e340a3f96 Verify onboarding models and explain provider failures (#23563)
Verify deployment-configured model preferences with the selected account.
Preserve structured provider failures and show descriptive messages for known
causes through the existing onboarding error display. Keep the existing failure
buttons, account binding, and retry/sign-in behavior.

Validation: UI typecheck, 38 focused tests, four browser journeys, all applicable
CI checks, and Greptile 5/5 with no unresolved review comments.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-12-02 16:47:58 -08:00

23 lines
1.3 KiB
TypeScript

import { providerFailureFromError } from "../../vendor/paperclip-runner/index.js";
import type { AdapterEnvironmentCheck } from "@paperclipai/adapter-utils";
export function setupProbeFailure(error: unknown): AdapterEnvironmentCheck {
const failure = providerFailureFromError(error);
const messages = {
model_unavailable: "Your account does not have access to the selected model.",
authentication: "Your sign-in could not be verified. Please sign in again.",
permission: "Your account does not have permission to make this request.",
quota_exhausted: "Your account has no usage remaining. Check your plan's limits or available credits.",
rate_limit: "Your account is temporarily rate limited. Please wait before trying again.",
overloaded: "The provider is temporarily unavailable. Please try again shortly.",
timeout: "The provider did not respond in time. Please try again.",
};
if (failure && failure.category in messages) {
const category = failure.category as keyof typeof messages;
return { code: `runner_hello_probe_${category === "authentication" ? "auth_required" : category}`,
level: "error", message: messages[category] };
}
return { code: "runner_hello_probe_failed", level: "error",
message: "Paperclip could not verify your account. Please try again." };
}