laya-serve: /v1/systemone/batch silently drops the request controls and skips the single endpoint's validation
POST /v1/systemone/batch (new in 0.3.22) only forwards model. Every other control that /v1/systemone accepts since #724 is read into the body and dropped without an error, and the batch path skips two of the single endpoint's input checks.
Reproduced against laya-serve 0.3.22 (6d942c9):
| Request | /v1/systemone |
/v1/systemone/batch |
|---|---|---|
~11k-char state with "max_len": 4096 |
usage.truncated: false |
usage.truncated: true (budget ignored) |
"hooks": ["a"] |
422, "hooks run inside the server process…" | 200 |
"min_confidence": 7 |
422 | 200 |
state containing a lone \ud800 escape |
400, "unpaired surrogate escape" | 500, "inference failed" |
import json, urllib.request
q = {"spam": {"type": "noul", "instructions": "Is this spam?"}}
long = "Lorem ipsum dolor sit amet. " * 400
req = urllib.request.Request(
"http://127.0.0.1:8000/v1/systemone/batch",
json.dumps({"states": [long], "questions": q, "max_len": 4096}).encode(),
{"Content-Type": "application/json"},
)
print(json.load(urllib.request.urlopen(req))["results"][0]["usage"]["truncated"]) # TrueWhere: _systemone_batch_inner in laya/serve.py builds {"state", "questions", "model"} per state and never runs _refuse_body_refusals, _has_lone_surrogate, _validate_budget_param, _validate_language_param or _validate_min_confidence.
Expected: the batch endpoint applies the same BODY_CONTROLS / BODY_REFUSALS handling as /v1/systemone, one set per request applied to every state, so a client can move from single to batch calls without losing its token budget or getting different error statuses. tests/test_serve.py could pin both endpoints to the same lists.
Source: NandhaKishorM/laya