fix: add CJK quota-exhaustion patterns to 429 classifier - #13536
Closed
KooshaPari wants to merge 2 commits into
Closed
KooshaPari wants to merge 2 commits into
KooshaPari wants to merge 2 commits into
Conversation
added 2 commits
September 13, 2026 02:21
…ns inflation (diegosouzapw#13364) When a client sends a model like 'zed-hosted/claude-haiku-4-5-20251001', the provider prefix was passed through to openaiToClaudeRequest unchanged. The capability lookup in fitThinkingToMaxTokens uses static MODEL_SPECS keyed by bare model id, so a prefixed name silently misses the output cap (64000 for Haiku 4.5) and causes max_tokens inflation: 32000 + 131072 = 163072, which Anthropic rejects with 'max_tokens: 163072 > 64000'. Strip the provider prefix before passing the model to translators, the wire payload, and the stream wrapper so capability lookups resolve correctly. Fixes diegosouzapw#13364
…souzapw#13194) CJK providers (z.ai/GLM, Kimi, Qwen, MiniMax) return Chinese error bodies that none of the English patterns match, causing the gateway to classify long-window quota exhaustion as transient rate_limit. Added Chinese patterns for usage limit, quota exhausted, call limit, and insufficient balance to both QUOTA_PATTERNS and TERMINAL_QUOTA_PATTERNS.
Owner
|
Thanks! #13412, also from you, covers #13194 with a broader pattern set and tests, and it is being merged. This branch also carries the #13537 zed commit, which does not compile. It also adds the CJK patterns to |
diegosouzapw
pushed a commit
that referenced
this pull request
Sep 15, 2026
…13412) Adds CJK quota-exhaustion messages (GLM/z.ai 5-hour window, Kimi, Qwen/DashScope, MiniMax, plus Japanese and Korean phrasings) to the 429 quota classifier. They are now `quota_exhausted` (cooldown + failover) instead of a transient `rate_limit` retry loop (#13194). The patterns go into the recoverable `QUOTA_PATTERNS` only, not the terminal set, and a guard case keeps the Chinese transient "请求过于频繁" as `rate_limit`. Chosen over #13536. Validated in one consolidated batch of this series (37 PRs boarded together on `release/v3.8.51`): `typecheck:core`, `check:open-sse-typecheck` and `check:dashboard-typecheck` clean; ESLint clean on every changed file; file-size, complexity, cognitive-complexity, changelog-integrity, docs-counts, docs-sync and migration-numbering gates green (only the pre-existing `open-sse/utils/stream.ts` file-size red remains, inherited from the base); 3,743 focused `node:test` cases plus 34 vitest cases green. Thanks @KooshaPari!
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…iegosouzapw#13412) Adds CJK quota-exhaustion messages (GLM/z.ai 5-hour window, Kimi, Qwen/DashScope, MiniMax, plus Japanese and Korean phrasings) to the 429 quota classifier. They are now `quota_exhausted` (cooldown + failover) instead of a transient `rate_limit` retry loop (diegosouzapw#13194). The patterns go into the recoverable `QUOTA_PATTERNS` only, not the terminal set, and a guard case keeps the Chinese transient "请求过于频繁" as `rate_limit`. Chosen over diegosouzapw#13536. Validated in one consolidated batch of this series (37 PRs boarded together on `release/v3.8.51`): `typecheck:core`, `check:open-sse-typecheck` and `check:dashboard-typecheck` clean; ESLint clean on every changed file; file-size, complexity, cognitive-complexity, changelog-integrity, docs-counts, docs-sync and migration-numbering gates green (only the pre-existing `open-sse/utils/stream.ts` file-size red remains, inherited from the base); 3,743 focused `node:test` cases plus 34 vitest cases green. Thanks @KooshaPari!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #13194
Changes
QUOTA_PATTERNSandTERMINAL_QUOTA_PATTERNSinclassify429.tsRoot Cause
CJK providers return Chinese error bodies for quota exhaustion that none of the English-only patterns matched, causing the 429 classifier to treat long-window quota exhaustion as transient rate_limit (60s cooldown) instead of quota_exhausted (long cooldown + failover).