feat: show specific retry messages for known LLM provider errors (#953)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user