mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 09:10:45 +00:00
test(live): classify provider HTTP 5xx as server drift
This commit is contained in:
@@ -99,6 +99,10 @@ describe("server error status classification", () => {
|
||||
expect(isServerErrorMessage("status: internal server error")).toBe(true);
|
||||
});
|
||||
|
||||
it("classifies provider HTTP 5xx wrapper errors as server errors", () => {
|
||||
expect(isServerErrorMessage("provider failed (HTTP 500): upstream apiKey is empty")).toBe(true);
|
||||
});
|
||||
|
||||
it("does not classify prefixed plain internal server error status prose", () => {
|
||||
expect(isServerErrorMessage("Proxy notice: Status: Internal Server Error")).toBe(false);
|
||||
});
|
||||
|
||||
@@ -53,6 +53,7 @@ const ZAI_AUTH_CODE_1113_RE = /"code"\s*:\s*1113\b/;
|
||||
const STATUS_INTERNAL_SERVER_ERROR_RE = /\bstatus:\s*internal server error\b/i;
|
||||
const STATUS_INTERNAL_SERVER_ERROR_WITH_500_RE =
|
||||
/^(?=[\s\S]*\bstatus:\s*internal server error\b)(?=[\s\S]*\bcode["']?\s*[:=]\s*500\b)/i;
|
||||
const HTTP_5XX_STATUS_RE = /\bHTTP\s+5\d\d\b/i;
|
||||
|
||||
const ZAI_AUTH_ERROR_PATTERNS = [
|
||||
// Z.ai: error 1113 = wrong endpoint or invalid credentials (#48988)
|
||||
@@ -305,7 +306,7 @@ export function isServerErrorMessage(raw: string): boolean {
|
||||
if (!value) {
|
||||
return false;
|
||||
}
|
||||
if (STATUS_INTERNAL_SERVER_ERROR_WITH_500_RE.test(value)) {
|
||||
if (STATUS_INTERNAL_SERVER_ERROR_WITH_500_RE.test(value) || HTTP_5XX_STATUS_RE.test(value)) {
|
||||
return true;
|
||||
}
|
||||
const scrubbed = value.replace(STATUS_INTERNAL_SERVER_ERROR_RE, "").trim();
|
||||
|
||||
Reference in New Issue
Block a user