Add HTTP 499 to transient error codes for model fallback

499 (Client Closed Request) is commonly returned by Anthropic during
overload but was missing from TRANSIENT_HTTP_ERROR_CODES, so it didn't
trigger model fallback.

Fixes #41467
This commit is contained in:
Zaf (via OpenClaw)
2026-03-09 22:35:10 +00:00
committed by Altay
parent de4c3db3e3
commit f40d2e34bd

View File

@@ -1,5 +1,6 @@
import type { AssistantMessage } from "@mariozechner/pi-ai";
import type { OpenClawConfig } from "../../config/config.js";
import type { FailoverReason } from "./types.js";
import { createSubsystemLogger } from "../../logging/subsystem.js";
import { formatSandboxToolPolicyBlockedMessage } from "../sandbox.js";
import { stableStringify } from "../stable-stringify.js";
@@ -13,7 +14,6 @@ import {
isTimeoutErrorMessage,
matchesFormatErrorPattern,
} from "./failover-matches.js";
import type { FailoverReason } from "./types.js";
export {
isAuthErrorMessage,
@@ -189,7 +189,7 @@ const HTTP_STATUS_PREFIX_RE = /^(?:http\s*)?(\d{3})\s+(.+)$/i;
const HTTP_STATUS_CODE_PREFIX_RE = /^(?:http\s*)?(\d{3})(?:\s+([\s\S]+))?$/i;
const HTML_ERROR_PREFIX_RE = /^\s*(?:<!doctype\s+html\b|<html\b)/i;
const CLOUDFLARE_HTML_ERROR_CODES = new Set([521, 522, 523, 524, 525, 526, 530]);
const TRANSIENT_HTTP_ERROR_CODES = new Set([500, 502, 503, 504, 521, 522, 523, 524, 529]);
const TRANSIENT_HTTP_ERROR_CODES = new Set([499, 500, 502, 503, 504, 521, 522, 523, 524, 529]);
const HTTP_ERROR_HINTS = [
"error",
"bad request",