From 40c508fe8c426f185b8cf177ffd87bf60dca7104 Mon Sep 17 00:00:00 2001 From: jnjpng Date: Fri, 13 Feb 2026 12:31:23 -0800 Subject: [PATCH] feat: show specific retry messages for known LLM provider errors (#953) --- src/cli/App.tsx | 5 ++--- src/cli/helpers/errorFormatter.ts | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/cli/App.tsx b/src/cli/App.tsx index b0d5726..102fe06 100644 --- a/src/cli/App.tsx +++ b/src/cli/App.tsx @@ -178,6 +178,7 @@ import { import { setErrorContext } from "./helpers/errorContext"; import { formatErrorDetails, + getRetryStatusMessage, isEncryptedContentError, } from "./helpers/errorFormatter"; import { formatCompact } from "./helpers/format"; @@ -4365,9 +4366,7 @@ export default function App({ // Show subtle grey status message const statusId = uid("status"); - const statusLines = [ - "Unexpected downstream LLM API error, retrying...", - ]; + const statusLines = [getRetryStatusMessage(detailFromRun)]; buffersRef.current.byId.set(statusId, { kind: "status", id: statusId, diff --git a/src/cli/helpers/errorFormatter.ts b/src/cli/helpers/errorFormatter.ts index 16697df..005fe3c 100644 --- a/src/cli/helpers/errorFormatter.ts +++ b/src/cli/helpers/errorFormatter.ts @@ -433,6 +433,25 @@ export function formatErrorDetails( return String(e); } +const DEFAULT_RETRY_MESSAGE = + "Unexpected downstream LLM API error, retrying..."; + +/** + * Return a user-facing status message for a retriable LLM API error. + * Matches known provider error patterns from the run's error detail and + * returns a specific message; falls back to a generic one otherwise. + */ +export function getRetryStatusMessage( + errorDetail: string | null | undefined, +): string { + if (!errorDetail) return DEFAULT_RETRY_MESSAGE; + + if (errorDetail.includes("Anthropic API is overloaded")) + return "Anthropic API is overloaded, retrying..."; + + return DEFAULT_RETRY_MESSAGE; +} + /** * Create a terminal hyperlink to the agent with run ID displayed */