fix(agents): classify Zhipu GLM overload as overloaded for failover (… · openclaw/openclaw@6c10413
0xghost42
·
2026-06-21
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -103,6 +103,19 @@ describe("Z.ai vendor error codes (#48988)", () => {
|
103 | 103 | }); |
104 | 104 | }); |
105 | 105 | |
| 106 | +describe("Chinese provider overload messages", () => { |
| 107 | +const ZHIPU_OVERLOAD = "[1305][该模型当前访问量过大,请您稍后再试]"; |
| 108 | + |
| 109 | +it("classifies the Zhipu GLM overload body as overloaded", () => { |
| 110 | +expect(isOverloadedErrorMessage(ZHIPU_OVERLOAD)).toBe(true); |
| 111 | +}); |
| 112 | + |
| 113 | +it("does not misclassify the GLM overload body as rate limit or auth", () => { |
| 114 | +expect(isRateLimitErrorMessage(ZHIPU_OVERLOAD)).toBe(false); |
| 115 | +expect(isAuthErrorMessage(ZHIPU_OVERLOAD)).toBe(false); |
| 116 | +}); |
| 117 | +}); |
| 118 | + |
106 | 119 | describe("Volcengine Coding Plan subscription errors", () => { |
107 | 120 | it("classifies InvalidSubscription JSON body as billing", () => { |
108 | 121 | const raw = |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -107,6 +107,7 @@ const ERROR_PATTERNS = {
|
107 | 107 | // Chinese provider overloaded messages |
108 | 108 | "服务过载", |
109 | 109 | "当前负载过高", |
| 110 | +"访问量过大", |
110 | 111 | ], |
111 | 112 | serverError: [ |
112 | 113 | "an error occurred while processing", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -746,6 +746,24 @@ describe("runWithModelFallback", () => {
|
746 | 746 | expect(result.attempts[0].reason).toBe("unknown"); |
747 | 747 | }); |
748 | 748 | |
| 749 | +it("falls back on a Zhipu GLM 1305 overload body and classifies it as overloaded", async () => { |
| 750 | +const cfg = makeCfg(); |
| 751 | +const glmOverload = new Error("[1305][该模型当前访问量过大,请您稍后再试]"); |
| 752 | +const run = vi.fn().mockRejectedValueOnce(glmOverload).mockResolvedValueOnce("ok"); |
| 753 | + |
| 754 | +const result = await runWithModelFallback({ |
| 755 | + cfg, |
| 756 | +provider: "glm", |
| 757 | +model: "GLM-5.2", |
| 758 | + run, |
| 759 | +}); |
| 760 | +expect(result.result).toBe("ok"); |
| 761 | +expect(run).toHaveBeenCalledTimes(2); |
| 762 | +expect(requireMockCall(run, 1, "fallback run")).toEqual(["anthropic", "claude-haiku-3-5"]); |
| 763 | +expect(result.attempts).toHaveLength(1); |
| 764 | +expect(result.attempts[0].reason).toBe("overloaded"); |
| 765 | +}); |
| 766 | + |
749 | 767 | it("does not prepare agent harness plugins for forced OpenClaw candidates", async () => { |
750 | 768 | const cfg = makeCfg({ |
751 | 769 | models: { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。