fix: zai error handling (#1047)

This commit is contained in:
Ari Webb
2026-02-20 12:01:43 -08:00
committed by GitHub
parent b622eca198
commit d9b35895ff
5 changed files with 291 additions and 0 deletions

View File

@@ -8,6 +8,7 @@
import type { MessageCreate } from "@letta-ai/letta-client/resources/agents/agents";
import type { ApprovalCreate } from "@letta-ai/letta-client/resources/agents/messages";
import { isZaiNonRetryableError } from "../cli/helpers/zaiErrors";
// ── Error fragment constants ────────────────────────────────────────
@@ -81,6 +82,7 @@ export function isRetryableProviderErrorDetail(detail: unknown): boolean {
/** Non-transient auth/validation style provider detail that should not be retried. */
export function isNonRetryableProviderErrorDetail(detail: unknown): boolean {
if (typeof detail !== "string") return false;
if (isZaiNonRetryableError(detail)) return true;
const normalized = detail.toLowerCase();
if (NON_RETRYABLE_4XX_PATTERN.test(detail)) return true;
return NON_RETRYABLE_PROVIDER_DETAIL_PATTERNS.some((pattern) =>