diff --git a/apps/fabro-web/app/routes/run-detail/failure.test.ts b/apps/fabro-web/app/routes/run-detail/failure.test.ts index c5d575ab1..e3421feb7 100644 --- a/apps/fabro-web/app/routes/run-detail/failure.test.ts +++ b/apps/fabro-web/app/routes/run-detail/failure.test.ts @@ -82,6 +82,20 @@ describe("buildRunFailureView", () => { .toBe("The request to OpenAI timed out"); }); + test("doesn't blame the provider for failures on Fabro's side", () => { + const failure = (message: string) => view(failedRun({ message })); + expect(failure("model request failed (configuration): provider anthropic is disabled in the catalog")).toMatchObject({ + headline: "Fabro couldn't send the request to Anthropic", + nextStep: "Check Anthropic and the step's model under Settings → Models, then choose Retry from Actions.", + }); + expect(failure("model request failed (model_selection): provider anthropic has no default model")?.headline) + .toBe("Fabro couldn't send the request to Anthropic"); + expect(failure("model request failed (network): provider openai connection refused")?.headline) + .toBe("The request never reached OpenAI"); + expect(failure("model request failed (resource_limit): provider openai response exceeded 16 MiB")?.headline) + .toBe("Fabro stopped the request to OpenAI"); + }); + test("falls back to the provider's status and code", () => { const failure = view( failedRun({ diff --git a/apps/fabro-web/app/routes/run-detail/failure.ts b/apps/fabro-web/app/routes/run-detail/failure.ts index 3f8080d65..3788db2a2 100644 --- a/apps/fabro-web/app/routes/run-detail/failure.ts +++ b/apps/fabro-web/app/routes/run-detail/failure.ts @@ -141,6 +141,22 @@ function parseModelRequest(message: string): ModelRequest | null { } function requestAdvice({ kind, status, code }: ModelRequest, message: string, who: string): Advice { + // These kinds fail on Fabro's side, before or without the provider's say. + if (kind === "configuration" || kind === "model_selection") { + return { + headline: `Fabro couldn't send the request to ${who}`, + nextStep: `Check ${who} and the step's model under Settings → Models, then ${RETRY}.`, + }; + } + if (kind === "network") { + return { + headline: `The request never reached ${who}`, + nextStep: "Check that the Fabro server can reach the provider, then choose Retry from Actions.", + }; + } + if (kind === "middleware" || kind === "resource_limit") { + return { headline: `Fabro stopped the request to ${who}`, nextStep: "The message, under Details, says why." }; + } if ( kind === "quota_exceeded" || status === 402 ||