5 Commits
Author SHA1 Message Date
yetone ea805ecc92 trae 0.2.45: an enterprise chat names its limit where Trae's client does, and a cut reply says length
@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).
2026-11-19 13:57:20 +08:00
yetone 8989cc1d92 trae 0.2.44: a chat is sent its model's max_tokens, so an enterprise reply isn't cut at 2000
@liuyuexue2020 on X (0.2.43, Trae CN enterprise seat, console.enterprise.trae.cn,
model AI/deekseek-v4.1-flash): in Trae the model writes past 2000 tokens;
through magpie every reply stopped at exactly 2,000 output tokens (their
Usage rows: 26,037 / 2,000, 24,870 / 2,000, 23,097 / 2,000, streamed).

Cause: chatBody sent max_tokens only when the agent named one, held to the
__dev detail's max_tokens (`most`). An enterprise model has no __dev
detail, so it had no `most`, its listed output limit was 0, and an agent
naming no limit sent llm_utils_chat none. Trae's own client always sends
one: the ai-agent's ModelConfig carries the detail's max_tokens with every
model ("[ModelConfig] Received config_name=, model_name=, max_turn=,
prompt_max_tokens=, max_tokens=" in Trae CN 3.4.20's ai-agent strings;
CloudModelDetailInfo has max_tokens beside model_name and provider). The
2000 is most likely what Trae gives a request naming none; that wasn't
measured, having no seat.

Now:
- an enterprise model's `most` and listed output come from its own detail
  (enterpriseDetail: the __dev one, else the first naming a model);
- every chat whose model has a known `most` sends it when the agent names
  no limit, and holds a larger ask to it, as Max mode already did. A
  preset asked through the function naming its __dev detail now sends
  that detail's max_tokens too, the value Trae's client sends; a function
  that doesn't name it still sends nothing.
- a detail with no max_tokens sends the agent's limit or none, as before.

Siblings: Trae CN and Trae international are one plugin (both sites go
through chatBody); SOLO's functions (solo_agent, solo_coder, ...) too. No
other plugin in the repo sets a fixed max_tokens/max_output_tokens cap
(grep for 1000/1024/2000/2048/4000/4096 near those keys). magpie's gateway
sends no fixed 2000 (its fill-in, askedOutput, is Anthropic-only).

Run (mote, HOME=$(mktemp -d), this tree on 62645ece):
packages/trae bun test: 287 pass, 0 fail (24 files);
bun scripts/check.mjs trae: ok;
root bun test: 9058 pass, 0 fail, 9078 tests across 636 files (514s);
bun scripts/check.mjs (all packages): ok.

Broken by hand: with 0.2.43's index.mjs, entmodels.test.mjs has 2 of 10
red: the enterprise test (max_tokens 0 listed / none sent, expected 8192)
and the preset test (undefined, expected 32000).

Not tried: a real enterprise seat (we have none), so the detail's
max_tokens in the fixture (8192) is invented and the 2000 default
is inferred from the reporter's numbers. If their detail carries no
max_tokens, a request naming none still goes without one.
2026-11-19 10:39:05 +08:00
yetone 11e7afe584 trae 0.2.43: an enterprise model's chat sends its detail's model_name and provider (#1258)
On 0.2.42 the reporter's enterprise seat (@liuyuexue2020 on X, Trae CN,
console.enterprise.trae.cn) got past 4001: both of its enterprise models,
AI/deekseek-v4.1-flash and volc/deepseek-v4-1-flash, now got 502 with
Trae's 4023 "We're sorry, something went wrong. Please try again later or
contact our support team for assistance." on chat_v3, solo_work_lite,
solo_agent, solo_agent_lite and solo_coder (their two screenshots on
#1258). config_source 2 was accepted; what the server then needed was
missing.

Trae CN 3.4.20's list types (libharness, serde field order) are
CloudModelConfigInfo { usage, is_default, display_config, ...,
model_detail_list, config_source, ... } and CloudModelDetailInfo
{ model_name, provider, icon, prompt_max_tokens, max_tokens, ... }:
provider sits on each model_detail_list item, not on the config. 0.2.42
read entry.provider off the config (so sent none), and model_name comes
only from a __dev detail, which an enterprise model doesn't have (so
none was sent either). Trae's own llm_utils_chat sends config_name,
model_name, config_source, is_custom_model and provider.

chatBody now sends, for an enterprise model, the model_name and provider
of its detail (the __dev one if any, else the first naming a model),
the config's provider still first when present. A preset's body is
unchanged.

Run (mote, HOME=$(mktemp -d), at this tree on 50f1ec18):
packages/trae bun test, 284 pass, 0 fail (24 files);
bun scripts/check.mjs trae ok.

Broken by hand: with 0.2.42's index.mjs, the two new entmodels tests
fail (the fake answers the reporter's 4023 text to an enterprise chat
without its detail's model_name and provider); the other five pass.

Not tried: a real enterprise seat; we have none, and the reporter can't
capture the list entry or the chat (the native ai-agent process sends
them). The detail values in the fixture (provider "AI"/"volc") are
inferred from their config names; the real entry hasn't been seen.
2026-11-18 10:04:39 +08:00
yetone fd42292240 trae 0.2.42: an enterprise model's chat says its config_source at the top (#1258)
On 0.2.41 the reporter's enterprise seat (@liuyuexue2020 on X, Trae CN,
console.enterprise.trae.cn) now lists its enterprise built-in models, but
a chat with one, AI/deekseek-v4.1-flash, got 502 with Trae's 4001 "We're
sorry, the param is invalid. Please try with a valid param." on chat_v3,
solo_work_lite, solo_agent, solo_agent_lite and solo_coder (their
screenshot on #1258). The error also confirms the list entry carries
config_source 2, the first real-seat sight of that field.

0.2.41 sent config_source, is_preset, custom_model_id and provider under
user_message_context.model_info, which is the agent task's model info.
Trae CN 3.4.20's own llm_utils_chat request (libharness,
worktree/branch_name.rs, asked with the user's selected model) is
usage, function, messages, conversation_id, access_type, config_name,
model_name, config_source, is_custom_model, provider: those fields go at
the top of the body. chatBody now sends config_source 2, is_custom_model
true and the entry's provider there, and no model_info for it. A preset's
body is unchanged.

Run (mote, HOME=$(mktemp -d), at this tree on 324acd60):
packages/trae bun test, 282 pass, 0 fail (24 files);
bun scripts/check.mjs trae ok.

Broken by hand: with the enterprise block in chatBody turned off, both
new entmodels tests went red (the fake answers the reporter's 4001 to an
enterprise config sent without config_source), and green again once
restored.

Not tried: a real enterprise seat; we have none. The field set comes from
the 3.4.20 client binary, and whether Trae's server wants more (model_name,
access_type) for an enterprise config is not known. The reporter couldn't
capture the IDE's chat in DevTools because the native ai-agent process
sends it, not the renderer.
2026-11-17 19:10:21 +08:00
yetone 4858e144a6 trae 0.2.41: an enterprise's built-in models are listed and say what failed (#1258)
A Trae CN enterprise seat (@liuyuexue2020 on X, magpie v0.1.4288,
0.2.40) didn't see the tenant's own built-in models in magpie's list. A
name typed in by hand got a bare 502.

Trae CN 3.4.20's client (ai-modules-chat) marks each entry's
config_source as Trae 1, Enterprise 2 or Personal 3, and shows the
Enterprise ones as "Enterprise-builtin". They aren't presets
(is_preset false), so they read as custom models, and chatModel dropped
them together with the personal ones (is_custom_model, custom_model*
ids).

- chatModel keeps config_source 2 entries unless status is false (the
  IDE's "disabled by the administrator"). Personal custom models stay
  out.
- A chat with one of them carries user_message_context.model_info as
  the client builds it: config_name, config_source 2, is_preset false,
  use_remote_service, display_model_name, custom_model_id, provider.
  A preset's body is unchanged.
- A refused chat that isn't a lapse or a quota now names the model, the
  functions tried and the host. When the account's list doesn't have
  the model, it says that too; the list is read for this on the failing
  path only.

Run (mica, HOME=$(mktemp -d), at this tree on 8c7e8f66):
packages/trae bun test, 281 pass, 0 fail (24 files);
bun scripts/check.mjs trae ok.

Broken by hand: I turned off the chatModel enterprise branch, the
model_info block and the error context. All 4 new tests in
entmodels.test.mjs went red, then green again once restored.

Not tried: a real enterprise seat. The fields in the list entry and the
chat shape come from the client bundle. Nothing has seen them from Trae's
server, and #1258 asks the reporter for both. Trae Global's enterprise
console isn't covered either.
2026-11-17 17:02:27 +08:00