Skip to content

fix(runtime-fallback): classify localized balance failures as quota exhaustion#3934

Merged
code-yeongyu merged 1 commit into
code-yeongyu:devfrom
Qihao0v0:fix/unifyllm-quota-classifier
May 15, 2026
Merged

fix(runtime-fallback): classify localized balance failures as quota exhaustion#3934
code-yeongyu merged 1 commit into
code-yeongyu:devfrom
Qihao0v0:fix/unifyllm-quota-classifier

Conversation

@Qihao0v0

@Qihao0v0 Qihao0v0 commented May 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Classifies localized proxy-provider balance/pre-charge failures as quota_exceeded.
  • Allows runtime fallback to switch models immediately when providers return localized quota errors without a
    standard status code.
  • Observed with a UnifyLLM-style proxy response:
预扣费额度失败, 用户剩余额度: 0.265718, 需要预扣费额度: 0.680208 (request id: ...)

Changes

  • Added a localized quota exhaustion matcher for balance/pre-charge failure messages.
  • Added a regression test covering the localized pre-charge balance failure response.

Testing

bun test src/hooks/runtime-fallback/quota-error-classifier.regression.test.ts src/hooks/runtime-fallback/error-
classifier.test.ts src/hooks/runtime-fallback/provider-matrix.test.ts
bun run typecheck
bun run build

Related Issues


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

Summary by cubic

Classifies localized balance/pre‑charge failures from proxy providers as quota_exceeded. This lets runtime fallback switch models immediately when Chinese quota errors appear without standard status codes.

  • Bug Fixes
    • Added localized matcher that flags messages with “预扣费额度失败”+“用户剩余额度” or “用户剩余额度”+“需要预扣费额度” as quota_exceeded.
    • Added regression test for UnifyLLM pre‑charge balance failure to ensure classification and retryability.

Written for commit 583fa24. Summary will update on new commits.

@github-actions

github-actions Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: The change adds a well-defined localized quota exhaustion matcher with combined Chinese phrase checks and a regression test, mirroring existing English patterns, so there is negligible risk of regression.

@Qihao0v0 Qihao0v0 force-pushed the fix/unifyllm-quota-classifier branch from 9451557 to 583fa24 Compare May 11, 2026 03:07
@Qihao0v0

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants