Qoder CN's QoDuck (lmodel) refuses a max_tokens above 131072 with a 400
"Error in upstream response: Range of max_tokens should be [1, 131072]".
qoderBody sent the client's budget unchanged (a DeepSeek-sized 384K from
DeepSeek Harness / pi), and failure() read every "Error in upstream
response" as the vendor's transient 502, so magpie retried on each
account and rested them all with backoff; lmodel never answered.
- qoderBody holds max_tokens to the model's ceiling and never raises a
smaller one: what a refusal named for that model key, else the listing
entry's max_output_tokens, else OUTPUT_CAPS (lmodel 131072). The
context_length window is counted with the held value.
- failure() reads "Range of max_tokens should be [lo, hi]" before the
upstream-failed 502 as the request's 400 (signIn ""), with Qoder's
words and the ceiling.
- ask and askLingma send such a refusal again once at that ceiling and
remember it for the model, so a model with no known ceiling (any other
Qoder, Qoder CN or Lingma model) answers too. Refused again, the 400
goes back as Qoder said it.
Siblings: one body builder (qoderBody) serves every site (qoder, qoder-cn,
QwenWork, enterprise, VPC, dedicated, Lingma) and both stream=true/false;
the plugin has no Responses path. The HTTP reply and the stream's
envelope both go through failure().
Run (mote): packages/qoder bun test 417 pass; bun scripts/check.mjs qoder
ok; repo HOME=$(mktemp -d) bun test 6662 pass 0 fail. Fixtures use the
issue's literal error text.
Broken by hand: without the clamp 19 of the new tests red; without the
range read 11 red; without the resend 10 red.
Not tried: a real qoder-cn account on lmodel (none here); whether Qoder
also validates context_length (the issue could not capture the body);
the learned ceiling is kept per model key in the process, not per site.
Reported-by: Gruu6y