test(live): classify provider HTTP 5xx as server drift · openclaw/openclaw@9c4a335
vincentkoc
·
2026-05-05
·
via Recent Commits to openclaw:main
File tree
src/agents/pi-embedded-helpers
| Original file line number | Diff line number | Diff line change |
|---|
@@ -99,6 +99,10 @@ describe("server error status classification", () => {
|
99 | 99 | expect(isServerErrorMessage("status: internal server error")).toBe(true); |
100 | 100 | }); |
101 | 101 | |
| 102 | +it("classifies provider HTTP 5xx wrapper errors as server errors", () => { |
| 103 | +expect(isServerErrorMessage("provider failed (HTTP 500): upstream apiKey is empty")).toBe(true); |
| 104 | +}); |
| 105 | + |
102 | 106 | it("does not classify prefixed plain internal server error status prose", () => { |
103 | 107 | expect(isServerErrorMessage("Proxy notice: Status: Internal Server Error")).toBe(false); |
104 | 108 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -53,6 +53,7 @@ const ZAI_AUTH_CODE_1113_RE = /"code"\s*:\s*1113\b/;
|
53 | 53 | const STATUS_INTERNAL_SERVER_ERROR_RE = /\bstatus:\s*internal server error\b/i; |
54 | 54 | const STATUS_INTERNAL_SERVER_ERROR_WITH_500_RE = |
55 | 55 | /^(?=[\s\S]*\bstatus:\s*internal server error\b)(?=[\s\S]*\bcode["']?\s*[:=]\s*500\b)/i; |
| 56 | +const HTTP_5XX_STATUS_RE = /\bHTTP\s+5\d\d\b/i; |
56 | 57 | |
57 | 58 | const ZAI_AUTH_ERROR_PATTERNS = [ |
58 | 59 | // Z.ai: error 1113 = wrong endpoint or invalid credentials (#48988) |
@@ -305,7 +306,7 @@ export function isServerErrorMessage(raw: string): boolean {
|
305 | 306 | if (!value) { |
306 | 307 | return false; |
307 | 308 | } |
308 | | -if (STATUS_INTERNAL_SERVER_ERROR_WITH_500_RE.test(value)) { |
| 309 | +if (STATUS_INTERNAL_SERVER_ERROR_WITH_500_RE.test(value) || HTTP_5XX_STATUS_RE.test(value)) { |
309 | 310 | return true; |
310 | 311 | } |
311 | 312 | const scrubbed = value.replace(STATUS_INTERNAL_SERVER_ERROR_RE, "").trim(); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。