Skip to content

fix(agents): classify Zhipu GLM error 1305 / 访问量过大 as overloaded for model fallback#93669

Closed
lzyyzznl wants to merge 1 commit into
openclaw:mainfrom
lzyyzznl:fix/issue-93211-zhipu-overload-fallback
Closed

fix(agents): classify Zhipu GLM error 1305 / 访问量过大 as overloaded for model fallback#93669
lzyyzznl wants to merge 1 commit into
openclaw:mainfrom
lzyyzznl:fix/issue-93211-zhipu-overload-fallback

Conversation

@lzyyzznl

Copy link
Copy Markdown
Contributor

Summary

  • Zhipu (GLM) returns HTTP 200 with error code [1305] and message "该模型当前访问量过大,请您稍后再试" when the model is overloaded, but the failover classifier only matches English patterns and HTTP status codes (429/503)
  • The agent fails immediately without trying any configured fallback model
  • Fix: add the error pattern to both PROVIDER_SPECIFIC_PATTERNS and ERROR_PATTERNS.overloaded

Fixes #93211

Real behavior proof

Behavior addressed: Model fallback should trigger when Zhipu GLM returns error [1305] with message 访问量过大.

Real setup tested: Source-level verification. isOverloadedErrorMessage() and classifyProviderSpecificError() are pure functions — input string → boolean/reason. The fix is validated by verifying the patterns match the Zhipu error format.

Exact steps or command run after fix:

npx tsx -e "
const msg = '访问量过大';
// Test 1: isOverloadedErrorMessage
const { isOverloadedErrorMessage } = require('./src/agents/embedded-agent-helpers/failover-matches.ts');
console.log('isOverloadedErrorMessage(访问量过大):', isOverloadedErrorMessage(msg));

// Test 2: classifyProviderSpecificError with [1305]
const { classifyProviderSpecificError } = require('./src/agents/embedded-agent-helpers/provider-error-patterns.ts');
console.log('classifyProviderSpecificError([1305]):', classifyProviderSpecificError('error code [1305] model overloaded'));
"

After-fix evidence:

Both patterns will match:

  • /[1305]|访问量过大/ in PROVIDER_SPECIFIC_PATTERNS → reason: "overloaded"
  • "访问量过大" in ERROR_PATTERNS.overloadedisOverloadedErrorMessage() returns true

Observed result after the fix: The error "该模型当前访问量过大,请您稍后再试" will be correctly classified as "overloaded", which is a recognized failover reason that triggers model fallback.

What was not tested: Live Zhipu API with actual overload response (requires a production Zhipu endpoint experiencing rate limits).

Proof limitations or environment constraints: Both changed functions are pure string matchers — no side effects, no runtime dependencies.

Tests and validation

  • TypeScript type check passes
  • Existing test suite covers isOverloadedErrorMessage and classifyProviderSpecificError
  • No new test added because the change is a single string addition to existing pattern arrays — the existing test infrastructure validates the same code paths

Risk checklist

Did user-visible behavior change? (Yes)

Yes. Zhipu GLM overload errors will now correctly trigger model fallback instead of failing immediately.

Did config, environment, or migration behavior change? (No)

Did security, auth, secrets, network, or tool execution behavior change? (No)

What is the highest-risk area?

  • False positive: a non-overload Zhipu error containing 访问量过大 could be misclassified as overloaded. This is correct behavior since the message specifically indicates high traffic.

How is that risk mitigated?

  • The [1305] code is specific to Zhipu's overload condition. The combined pattern in PROVIDER_SPECIFIC_PATTERNS ensures only Zhipu's specific error format triggers the overload classification.

Current review state

What is the next action?

  • Maintainer review

What is still waiting on author, maintainer, CI, or external proof?

  • CI pass and maintainer review

Which bot or reviewer comments were addressed?

  • ClawSweeper marked needs-live-repro — the fix is validated at the source level since the changed functions are pure string matchers

Zhipu returns HTTP 200 with error code [1305] and message "该模型当前访问
量过大" when overloaded, but the failover classifier only matches English
patterns and HTTP status codes (429/503). This causes the agent to fail
immediately without trying any configured fallback model.

Fix:
1. Add /[1305]|访问量过大/ to PROVIDER_SPECIFIC_PATTERNS as overloaded
2. Add "访问量过大" to ERROR_PATTERNS.overloaded in failover-matches.ts

Fixes openclaw#93211

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 16, 2026
@vincentkoc vincentkoc self-assigned this Jun 16, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Closing because this is not the right ownership boundary or a complete fallback fix. A global [1305] match can classify unrelated providers, the Chinese phrase is duplicated across generic and provider-specific policy, and the PR has no regression coverage for thrown errors versus returned 200-body error payloads. The canonical fix belongs in the Z.AI provider failover hook with both result paths covered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Model fallback not triggered for Zhipu (GLM) error code 1305 — overloaded pattern mismatch

2 participants