Files
magpie/internal
ggbdpq 06a4e71ecb qoder: a tool call written into the text that can't be read ends the turn as an error, never as the answer
What changed
A whole <tool_call> block whose JSON doesn't parse, or one the stream
ends inside, reached the agent as the reply text with finish "stop" and
a 200: the call was lost and nothing could fail over. The moved qoder
plugin's 0.2.16 ends such a turn as an error (plugins#132, as trae's
since plugins#38); 8fdd296d, which raised the mover's min, left the
built-in's two exits as they were. The built-in now ends the turn the
same way the plugin does: a block on its way to being a call (its JSON
began, or the XML function form) that can't be read is a 502 — an error
frame with no finish once text was streamed, the status alone before
anything was — and one the stream ends inside is the call when its JSON
is whole, else a 502. A marker that is no call at all, and a block
inside a code fence or inline span, stay text (TestQoderEOF's
"incomplete" case among them, unchanged). Splitter state is qoderText's
new sent (the text given out, so a block in code is told from a call)
and qoderFrag's err, lifted by decodeQoder's emit.

Run
- go test -tags nogui -p 2 -count=1 -run 'TestQoder|TestTextWritten|TestPluginTextWritten|TestQuiet' ./internal/gateway/: ok
  (new TestQoderUnreadableToolCall: the four defect shapes red on
  2e2c8903 — 200 with the block as content, and the cut-short whole-JSON
  call as text — green here; the two stays-text guards green on both)
- gofmt -l internal/: clean. go vet -tags nogui ./internal/gateway: clean.
- Full matrix and ablation recorded in the issue body.

Generated-by: GLM-5.3-Flash (ZCode)
2026-10-16 00:44:19 +08:00
..
…
…
…