tweak: show actual retry error message instead of generic error msg (#11520)

This commit is contained in:
Aiden Cline
2026-01-31 13:15:42 -06:00
committed by GitHub
parent a19ef17bcb
commit da7c874808
2 changed files with 2 additions and 8 deletions

View File

@@ -89,13 +89,7 @@ export namespace SessionRetry {
if (json.type === "error" && json.error?.code?.includes("rate_limit")) { if (json.type === "error" && json.error?.code?.includes("rate_limit")) {
return "Rate Limited" return "Rate Limited"
} }
if ( return JSON.stringify(json)
json.error?.message?.includes("no_kv_space") ||
(json.type === "error" && json.error?.type === "server_error") ||
!!json.error
) {
return "Provider Server Error"
}
} catch { } catch {
return undefined return undefined
} }

View File

@@ -99,7 +99,7 @@ describe("session.retry.retryable", () => {
test("handles json messages without code", () => { test("handles json messages without code", () => {
const error = wrap(JSON.stringify({ error: { message: "no_kv_space" } })) const error = wrap(JSON.stringify({ error: { message: "no_kv_space" } }))
expect(SessionRetry.retryable(error)).toBe("Provider Server Error") expect(SessionRetry.retryable(error)).toBe(`{"error":{"message":"no_kv_space"}}`)
}) })
test("does not throw on numeric error codes", () => { test("does not throw on numeric error codes", () => {