gateway: CodeArts's "request param is invalid" is the request's, nobody rests (Abandon332 on X, #6342)

Huawei's gateway answers a parameter it can't take (the codearts plugin sent
`stop` as an array; plugin 0.3.15 sends a string) with InferHub.001001005.400
inside a 200. magpie read it as a plain 400 and rested the account, 182
times in the report. The code joins shapeWords, so a member behind it is
asked and the one that refused doesn't rest, as for any request shape a
vendor can't read.

Run (mica): TestCodeArtsInvalidParamIsTheRequests, shapeRefused, custom-tool
tests; go vet on darwin, windows, linux nogui; gofmt clean. The new test was
red before the regex change. Not tried: a real CodeArts account; the whole
suite (started after the tag). The last member in a group still rests as
before, since shapeRefused only applies when another is left.
This commit is contained in:
yetone
2026-11-12 22:53:32 +08:00
parent 74881f4d6a
commit 4e0026661c
2 changed files with 20 additions and 2 deletions
+16
View File
@@ -0,0 +1,16 @@
package gateway
import "testing"
// Huawei CodeArts answers a request parameter it can't take (a `stop` array,
// #6342) with a 400 that names a code only: the request's content, not the
// account, so the next member is asked and nobody rests.
func TestCodeArtsInvalidParamIsTheRequests(t *testing.T) {
body := `{"error":{"message":"华为云 CodeArts: The request param is invalid, Please check it (InferHub.001001005.400)"}}`
if !shapeRefused(400, []byte(body)) {
t.Errorf("no next member over: %s", body)
}
if shapeRefused(400, []byte(`{"error":{"message":"InferHub.4004.200 benefit not found"}}`)) {
t.Error("another CodeArts code counted as the request's shape")
}
}
+4 -2
View File
@@ -1760,7 +1760,9 @@ func promptRefused(status int, body []byte) bool {
// JSON schema: OpenCode Go's 400 "JSON schema exceeds the maximum nesting
// depth of 10 levels" on muse-spark-1.3-contributor for Claude Code's MCP
// tools (#1870), which another member's model may take as they are; and a
// custom tool turned away (customToolRefusal, DeepSeek's "Unsupported
// Huawei CodeArts's HTTP 200 "The request param is invalid" over a
// parameter it can't take, InferHub.001001005.400 (a `stop` array, #6342),
// which the plugin now sends as a string; and a custom tool turned away (customToolRefusal, DeepSeek's "Unsupported
// custom tool: 'exec'", #2656) where no translation took it in. A
// request missing what every API requires ("field required") or too long
// for the model isn't one. Google's refusal of a function declaration's
@@ -1775,7 +1777,7 @@ func promptRefused(status int, body []byte) bool {
// the only field set." (#5374, worksyang) — a description beside an
// anyOf, which Google's Schema takes alone, the reporter's same tools
// another member took.
var shapeWords = lazyre.New(`(?i)failed to deserialize|unknown (item |content |input )?(type|variant|field|parameter)|unknown_parameter|unrecognized (request argument|field|parameter)|extra (inputs|fields) are not permitted|additional properties are not allowed|schema exceeds the maximum (nesting )?depth|schema[^"]{0,60}\bnesting depth\b|function_declarations\[\d+\]\.parameters\b|schema specified other fields alongside any_?of`)
var shapeWords = lazyre.New(`(?i)failed to deserialize|unknown (item |content |input )?(type|variant|field|parameter)|unknown_parameter|unrecognized (request argument|field|parameter)|extra (inputs|fields) are not permitted|additional properties are not allowed|schema exceeds the maximum (nesting )?depth|schema[^"]{0,60}\bnesting depth\b|function_declarations\[\d+\]\.parameters\b|schema specified other fields alongside any_?of|InferHub\.001001005\.400`)
// unsaidWords are Command Code's Provider API turning a request away with
// nothing but a trace id: {"message":"invalid request error trace_id: