Skip to content

Commit db79e94

Browse files
committed
refactor(agents): keep overload matching provider-neutral
1 parent b1f2691 commit db79e94

3 files changed

Lines changed: 3 additions & 11 deletions

File tree

src/agents/embedded-agent-helpers/failover-matches.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,10 @@ describe("Z.ai vendor error codes (#48988)", () => {
103103
});
104104
});
105105

106-
describe("Zhipu (GLM) overload error (#93211)", () => {
107-
// Zhipu returns HTTP 200 with the error in the body, so failover keys on the
108-
// message phrase rather than a status code.
106+
describe("Chinese provider overload messages", () => {
109107
const ZHIPU_OVERLOAD = "[1305][该模型当前访问量过大,请您稍后再试]";
110108

111-
it("classifies the GLM overload body as overloaded so failover triggers", () => {
109+
it("classifies the Zhipu GLM overload body as overloaded", () => {
112110
expect(isOverloadedErrorMessage(ZHIPU_OVERLOAD)).toBe(true);
113111
});
114112

src/agents/embedded-agent-helpers/failover-matches.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ const ERROR_PATTERNS = {
107107
// Chinese provider overloaded messages
108108
"服务过载",
109109
"当前负载过高",
110-
// Zhipu (GLM) overload contract: code 1305 ships a 200 body
111-
// "该模型当前访问量过大,请您稍后再试" (model traffic too high); the
112-
// distinctive phrase is the overload signal failover keys on (#93211).
113110
"访问量过大",
114111
],
115112
serverError: [

src/agents/model-fallback.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -746,11 +746,8 @@ describe("runWithModelFallback", () => {
746746
expect(result.attempts[0].reason).toBe("unknown");
747747
});
748748

749-
it("falls back on a Zhipu (GLM) 1305 overload body and classifies it as overloaded (#93211)", async () => {
749+
it("falls back on a Zhipu GLM 1305 overload body and classifies it as overloaded", async () => {
750750
const cfg = makeCfg();
751-
// Zhipu (GLM) signals overload as a 200 body "[1305][该模型当前访问量过大,请您稍后再试]";
752-
// the runtime surfaces it as a thrown error. Without the overload pattern it
753-
// classifies as "unknown"; with it, failover keys the recovery on "overloaded".
754751
const glmOverload = new Error("[1305][该模型当前访问量过大,请您稍后再试]");
755752
const run = vi.fn().mockRejectedValueOnce(glmOverload).mockResolvedValueOnce("ok");
756753

0 commit comments

Comments
 (0)