Skip to content

fix: classify MiniMax business errors and map structured model errors - #6946

Open
cocolord wants to merge 17 commits into
volcengine:mainfrom
cocolord:trae/model-error-phase1
Open

cocolord wants to merge 17 commits into
volcengine:mainfrom
cocolord:trae/model-error-phase1

Conversation

@cocolord

@cocolord cocolord commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Classify structured provider business errors and project existing ModelErrorKind values to public protocol errors on top of #6921.

  • Classify MiniMax embedding business codes so authentication, quota, throttling, and temporary failures use the existing recovery policies.
  • Declare the default public protocol code together with every ModelErrorKind; the server no longer maintains a separate fallback table or silently defaults an unmapped kind to INTERNAL.
  • Preserve a real upstream HTTP error status as the public fact when present. Only status-less structured errors use the kind's explicit protocol projection.

MiniMax has two distinct error paths. Non-2xx responses keep their real response.status_code through requests/httpx and bypass provider business-code classification. The documented business errors (1002, 1004, etc.) are carried in base_resp.status_code inside an HTTP 200 response, so _sdk_kind classifies that provider-scoped body code instead of treating HTTP 200 as an error status.

Provider business-code recognition uses the same _sdk_kind flow as OpenAI, Ark, LiteLLM, Gemini, httpx, and requests. _sdk_kind first consumes an existing carried kind; only UNKNOWN consults the data-driven _PROVIDER_CODE_KINDS lookup by provider/code. MiniMax is one table entry, not a conditional branch. The adapter only carries its existing provider and raw code, and the separate model_error_from_code path has been removed.

Classification remains nearest-first. ModelError and SDK exceptions share one classification loop. Protocol mapping consumes the resulting kind without reclassifying provider business codes: upstream error status wins when available; otherwise kind.protocol_code is exhaustive. A status-less timeout is still distinguished from a normal connection failure using the exception chain. map_exception, VikingDB handling, model_retry.py, and circuit_breaker.py are unchanged.

Code meanings follow the MiniMax error-code reference and the official ChatCompletionResp schema, whose only declared response is HTTP 200 and whose base_resp.status_code field lists the business errors.

Verification

  • Rebased without conflict onto main at 5f53cbf011.
  • No repository test changes; all existing test files match main.
  • Relevant existing regression files: 146 passed, 1 skipped (test_model_retry.py, test_error_mapping.py, test_minimax_embedder_simple.py, and test_gemini_embedder.py).
  • Disposable behavior probes verified MiniMax 1004 -> UNAUTHENTICATED/401, MiniMax 1002 -> RESOURCE_EXHAUSTED/429, status-less timeout/connection separation, Gemini status 400 precedence, explicit-kind precedence, unknown-provider behavior, and provider/code metadata retention. No probes are added to the repository.
  • ModelErrorKind construction and JSON serialization were checked under Python 3.10.
  • Ruff lint/format and git diff --check pass. Current-head CI checks.

@ZaynJarvis ZaynJarvis added the kernel Core server, runtime, storage, retrieval, SDK, and CLI. label Nov 4, 2026
@cocolord
cocolord force-pushed the trae/model-error-phase1 branch from dcd8bcb to 8c7089c Compare November 10, 2026 13:44
@cocolord
cocolord requested a review from qin-ctx November 10, 2026 14:04
@cocolord cocolord changed the title fix: centralize model error identification fix: classify MiniMax business errors and map structured model errors Nov 13, 2026
cocolord and others added 15 commits November 16, 2026 12:13
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
@cocolord
cocolord force-pushed the trae/model-error-phase1 branch from 0d1b79b to b8448d0 Compare November 16, 2026 04:21
cocolord and others added 2 commits November 16, 2026 12:48
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

This branch has not been deployed

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

Labels

kernel Core server, runtime, storage, retrieval, SDK, and CLI.

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants