fix: restrict HTML timeout short-circuit to transient statuses · openclaw/openclaw@de129a6
2026-04-16
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -176,7 +176,7 @@ describe("formatAssistantErrorText", () => {
|
176 | 176 | ); |
177 | 177 | }); |
178 | 178 | |
179 | | -it("returns upstream HTML copy for prefixed HTML rate-limit pages", () => { |
| 179 | +it("returns upstream HTML copy for prefixed 521 HTML rate-limit pages", () => { |
180 | 180 | const msg = makeAssistantError( |
181 | 181 | "Error: 521 <!DOCTYPE html><html><body>rate limit</body></html>", |
182 | 182 | ); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -354,7 +354,11 @@ function isHtmlErrorResponse(raw: string, status?: number): boolean {
|
354 | 354 | } |
355 | 355 | |
356 | 356 | function isTransportHtmlErrorStatus(status: number | undefined): boolean { |
357 | | -return status !== 401 && status !== 403 && status !== 407; |
| 357 | +return ( |
| 358 | +status === 408 || |
| 359 | +status === 499 || |
| 360 | +(typeof status === "number" && status >= 500 && status < 600) |
| 361 | +); |
358 | 362 | } |
359 | 363 | |
360 | 364 | function isOpenAICodexScopeContext(raw: string, provider?: string): boolean { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -167,6 +167,12 @@ describe("Cloudflare / CDN HTML error page classification (#67517)", () => {
|
167 | 167 | const html407 = |
168 | 168 | "<!doctype html><html><head><title>407 Proxy Authentication Required</title></head>" + |
169 | 169 | "<body><h1>Proxy Authentication Required</h1></body></html>"; |
| 170 | +const html402 = |
| 171 | +"<!doctype html><html><head><title>402 Payment Required</title></head>" + |
| 172 | +"<body><h1>Payment Required</h1><p>Your quota is exhausted.</p></body></html>"; |
| 173 | +const html429 = |
| 174 | +"<!doctype html><html><head><title>429 Too Many Requests</title></head>" + |
| 175 | +"<body><h1>Too Many Requests</h1><p>Rate limit exceeded.</p></body></html>"; |
170 | 176 | const prefixedHtml401 = `Error: 401 ${html401}`; |
171 | 177 | const prefixedHtml407 = `Error: 407 ${html407}`; |
172 | 178 | |
@@ -190,6 +196,14 @@ describe("Cloudflare / CDN HTML error page classification (#67517)", () => {
|
190 | 196 | expect(classifyFailoverReason(prefixedHtml401)).toBe("auth"); |
191 | 197 | }); |
192 | 198 | |
| 199 | +it("preserves billing classification for 402 HTML", () => { |
| 200 | +expect(classifyFailoverReason(`402 ${html402}`)).toBe("billing"); |
| 201 | +}); |
| 202 | + |
| 203 | +it("preserves rate-limit classification for 429 HTML", () => { |
| 204 | +expect(classifyFailoverReason(`429 ${html429}`)).toBe("rate_limit"); |
| 205 | +}); |
| 206 | + |
193 | 207 | it("classifies runtime failure kind as upstream_html for non-auth HTML", () => { |
194 | 208 | expect(classifyProviderRuntimeFailureKind({ status: 502, message: cloudflareHtml502 })).toBe( |
195 | 209 | "upstream_html", |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。