Replies: 1 comment
|
Supporting your "classify by semantics, not by status" proposal with a datapoint from the layer below, which shows how much of this is already solved and how much is not: Already right at the transport layer: pi-ai's own retry classification handles the transient families correctly — fault injection into the unmodified 0.84.1 transport shows 429 (with Not covered anywhere: exactly the case you isolated — a semantically misfiled status. Kimi returning 401 for an over-context request is the same shape as the 403-quota-shown-as-invalid-key family (#1631, #3222, and #666's user hitting the same wall). Nothing below the adapter can help there: the transport sees a status, the body is the only place the truth lives, and only the adapter reads it. So the split I'd suggest for the fix: keep status as the fallback classifier, and add body-semantic overrides for the small set of well-known lies (auth status + context/quota wording). Two properties worth building in from the start:
|
Uh oh!
There was an error while loading. Please reload this page.
Problem
Kimi's coding API rejects an over-context request with HTTP 401:
Both adapters classify by HTTP status first —
llm-deepseek'shttpErrorCodereturnsAUTHfor any 401/403, andllm-pi-ai'sclassifyPiAiErrormatches the401text — so this failure is labeledAUTH. The client's AUTH projection (which exists to protect against credential fragments in provider copy) then replaces it with the fixed copy "API key is invalid", and the real failure (context overflow) only survives in the session log. A user with a perfectly valid key ends up chasing a key problem for hours.Fix — body semantics win over HTTP status
Three commits on
exposir/deepseek-harness, branchfix/error-classify-body-semantics(clean base: upstream47f9438):fix(llm-pi-ai): classify Kimi context-limit 401 as overflow, not AUTHisContextWindowExceededErrorwith capacity-claim wording ("supports only 256K context","context window is limited to N")classifyPiAiErrormessageout of pi-ai's"<status>: <json body>"wrapper so the GUI shows the real sentencefix(llm-deepseek): let 401/403 body name context overflow or quotahttpErrorCode: for 401/403, checks context-overflow and quota semantics in the parsed body before defaulting toAUTHfix(llm-pi-ai): align quota precedence with llm-deepseek's httpErrorCodeclassifyPiAiErrorso both adapters share the same precedenceResulting precedence in both adapters: body semantics (context overflow / quota) → HTTP status (401/403 → AUTH, 429 → RATE_LIMIT, …) → fallback.
AUTHis the default once recognized non-auth meanings are ruled out — never an immediate return.Behavior-change surface (deliberate, minimal)
AUTHCONTEXT_WINDOW_EXCEEDEDAUTHQUOTAAUTHAUTH(unchanged)No retry-policy impact:
AUTH,QUOTA, andCONTEXT_WINDOW_EXCEEDEDare all outside the default retryable set. The client's AUTH safe-projection (credential-fragment protection) is untouched.Verification
llm,llm-deepseek,llm-pi-ai); no existing assertion was editedHTTP-prefixed wrapper format, quota-on-401, and the negative cases (bare 401/403 staysAUTH, 413 staysHTTP_413)Related
Text-matching is needed because pi-ai flattens provider errors into a single
errorMessagestring (see theXXX(pi-ai upstream)note inllm-pi-ai/src/stream.ts). A structured{status, type, body}passthrough in pi-ai would let this classify on fields instead of text — tracked as a separate upstream item.Branch: https://github.com/exposir/deepseek-harness/tree/fix/error-classify-body-semantics
All reactions