@liuyuexue2020 on X (0.2.44, Trae CN enterprise seat): their own request,
volc/deepseek-v4-1-flash with max_tokens 4096, temperature 0, stream
false, asking for 120 long lines. Four enterprise models
(AI/deekseek-v4.1-flash, volc/deepseek-v4-1-flash,
AI/deekseek-v4-flash-0731, AI/GLM-5.3-Flash) each answered exactly 2000
completion tokens, finish_reason "stop", mid-answer (24, 27 and 52 of
120 lines; deekseek-v4.1-flash no content at all).
What 0.2.44 sent: top-level max_tokens = min(4096, the detail's
max_tokens), so 4096 unless the list gives the model less. magpie's
gateway only lowers a limit (the user's Max output, withMaxOutput) and
fills one in on the Anthropic API only (askedOutput); it has no 2000.
The plugin passes Trae's completion_tokens and finish_reason through, and
reads the stream to Trae's done event; it doesn't cut it.
Cause (inferred, no enterprise seat to measure): Trae CN 3.4.22's own
client never sends llm_utils_chat a max_tokens (its request struct in
libharness has none), and its agent task carries an enterprise model's
limit as enterprise_custom_hyper_params {max_tokens, prompt_max_tokens,
multimodal} beside config_source and is_custom_model (AgentSpec,
CreateTaskRequest). So Trae most likely ignores the top-level max_tokens
for an enterprise model and gives it 2000, and says "stop" when it cuts.
The other reading, the list giving these models max_tokens 2000, would
show as 2000 output in /v1/models; the reporter is asked for it.
Now:
- an enterprise model's chat also sends enterprise_custom_hyper_params
(max_tokens as sent, the detail's prompt_max_tokens, multimodal from
the list) when a limit is known; the top-level max_tokens stays. A
preset gets nothing new.
- a reply Trae ends with "stop" or no reason, having used every token it
was let have (the max_tokens sent, or 2000 for an enterprise model),
finishes "length" in a body and in a stream, so the agent knows it was
cut. Tool calls, content_filter and shorter replies are unchanged; a
preset's 2000 isn't taken for a cut.
Tests (entmodels.test.mjs), from the reporter's request: a fake Trae
that reads the limit from enterprise_custom_hyper_params only and cuts
at 2000 with "stop". On 0.2.44's index.mjs all three new tests are red
(3100 expected, 2000 received; "length" expected, "stop" received).
Not tried: a real enterprise seat (none here). Whether Trae honours
enterprise_custom_hyper_params on llm_utils_chat is read from the
binary, not measured; if it doesn't, the reply is still cut at 2000 but
now says length.
Siblings: Trae CN and Trae international share chatBody and openai();
SOLO functions too.
Run (mica, HOME=$(mktemp -d), this tree on 67fb1258; mote was over its
cores):
packages/trae bun test: 290 pass, 0 fail (24 files);
bun scripts/check.mjs trae: ok;
root bun test: 9060 pass, 3 fail, 20 skip (636 files, 533s). The 3 reds
are in untouched packages and pass alone at once (agent-office jump.test
12/12, doubao-work 59/59): agent-office's jumpRequest is #642,
doubao-work's two are filed as #1350.
Broken by hand: 0.2.44's index.mjs with these tests, 3 of 13 red in
entmodels.test.mjs (above).