Commit Graph
2 Commits
Author SHA1 Message Date
moxuanchen 40d7c528fb trae: a claim's extra_credits alone, the reasoning an empty field hid, a name that grows, the realm in an error (#260, moxuanchen)
A check-in claim answering extra_credits alone is credited (NaN before); an
empty reasoning_content no longer hides the event's reasoning; a native call's
name snapshot that grows takes the place of its first piece; a Global reply's
error names Trae Global.

Run at the reviewed head 2a0a835, merged with #257 and #273 on main 68170b3:
bun test in packages/trae 173 pass 0 fail; check.mjs trae ok. The new tests
fail on main's index.mjs. Not tried against a live Trae account.
2026-10-20 22:06:02 +08:00
YuCreateandyu b32b510c9d trae 0.2.12: the call a service left mid-wrapper in a native call's name is read as the call (#106)
trae-cn/glm-5.3 under DSH (2026-10-13): over three turns, 28 of 54 native calls
arrived with the model's call in `function.name` instead of `function.arguments`
— the JSON wrapper the tool prompt asks for, with GLM's own
<arg_key>/<arg_value> tags where Trae's service stopped reading it, and a value
whose close left off:

  {"name":"bash","arguments":{"command</arg_key><arg_value>ls -la</arg_value>
  {"name":"bash","arguments":{"command":"grep -n x a.ts | head -3</arg_value>
  {"name":"bash","arguments":{"command":"grep -n "x" a.ts","description":"…"}}
  bash_abstract_command_0>{"name":"bash","arguments":{"command":"…scan.mjs</description>Re-run scan</arg_value>

Each went out under a name no request declares, so the agent answered "unknown
tool" and the call was lost — twelve steps in a row before the model recovered.
All 28 sit in the context the session compacted at the end of turn 8: turn 9's
input went from ~5k to 94.5k tokens. Whether the compaction is what makes the
service hand a call back this way is not established — only that the two line
up, and that the session's earlier turns on workbuddy-ai/hy4-preview-f and
group/auto-hy4-preview-f sent 270 whole calls and none of this shape. No
workbuddy/glm-5.3 call was routed that day, so nothing is claimed about it.

- A name holding the wrapper is read as the call: the tool, then the fields the
  text between the tags still spells out. The tags are the service's own
  handoff, so what stands between them is the model's text as the model wrote
  it: a quote left unescaped is read as the quote it is, a value the service
  cut at its tag keeps the text it got, a comma inside a value is the model's
  own (`sed -n 1,9p` reads whole), and a closing tag that is a field's own
  (`</description>`) ends the value before it — what follows such a tag is the
  service's text, not the model's.
- A field the tool's schema says is no string is its JSON where the text is
  one, and its text where it isn't.
- The native call's own arguments are kept, and the name's fields are filled in
  beside them: the service moves the arguments it read into the call and leaves
  the rest in the name, so the two halves are one call (command in the name,
  description/workdir in the call).
- A name whose tool the request doesn't have, or one no field can be read from,
  goes on as written, as any other unknown tool does — including one the
  service cut before it wrote a value (at a key, at a colon, at an open quote),
  where an empty call read out of it would be a call the model never wrote.
  Calls already written into a session's history under a mangled name still go
  back on as that name; the plugin reads what it is handed and cannot rewrite
  what was already sent.
- What main already read of a whole name keeps reading the same (`input`,
  `parameters`, arguments given as a string, the flat fields, a wrapper written
  with a space), and a call's own arguments that are not a set of fields — text
  the service cut, a value that isn't a call's fields — go on as they stand, as
  main passed them, for the agent to answer.

The wrapper and the tags are upstream's; the plugin reads what it was handed.
The same shapes are already handled by the DSH-ecosystem relays (trae2api's
_ARG_KEY_VALUE_RE takes a key whose opening <arg_key> was dropped) and by
@ai-sdk-tool/parser's GLM-5 name resolution (a declared name followed by a
structural tag is that tool), which is where the fail-closed reading of an
unknown name comes from.

Run: namecall.test.mjs (16 tests; the real payloads, a name in front of the
wrapper, a field's closing tag cut into a value, a comma inside a value, the
whole-name shapes main reads, the shapes the reader must leave alone, and the
streamed path) — 11 of 16 fail on main's index.mjs, the five that pass being
the ones that pin what main reads.
HOME=<tmp> bun test, 125 pass 0 fail; bun scripts/check.mjs trae green. The 28
payloads this was drawn from were replayed through NativeCalls.take: 28
recovered into calls to tools the request declares, and the 270 calls that
arrived whole in the same session unchanged, byte for byte. Against the same
names and calls main can take (187 pairs) the only differences are the fields
the name's side fills in beside the call's own, and the names main could not
read at all.

Co-authored-by: yu <wowyuarm@users.noreply.github.com>
2026-10-14 18:36:39 +08:00