Files
magpie/internal
yetone 32201c6a06 gateway: what GLM leaves between a written tool call and its close is no longer sent on as text (#1945, XcodeFish)
GLM writes calls as text, <tool_call>{json}</tool_call>, and often
leaves stray "]", "}", "}}", `">` or longer runs between the JSON and
the close. hermesCall's json.Decoder stopped at the first whole object
and the tail went to the agent as an answer of its own beside the
call. A heredoc whose quotes the model left unescaped also closed the
object early, and the command went to the agent cut short.

hermesCall now looks at what follows the object: junk (blanks and
}]"'>) and then </tool_call> is taken with the call; other text before
a </tool_call> means the object closed early, so the block is no call
and stays text for the model to write again. A call with no close
followed by prose reads as before. textCallJunk also drops such a tail
after a call's own close.

The same fix for moved users is in the trae plugin 0.2.11
(magpie-community/plugins c3bcb5c).

Tests (textcalls_tail_test.go): TestTextWrittenCallTailDropped (the
issue's tails, and one after the close) and
TestTextWrittenCallCutEarlyNotCalled; both fail on the old code. Ran:
the full gateway package, go vet darwin/linux/windows, gofmt -l.
2026-10-13 16:17:06 +08:00
..
…
…