Commit Graph
3 Commits
Author SHA1 Message Date
yetone 34786edadb qoder 0.2.65: two tool calls at one index with their own ids are two (#930)
Qoder Ultimate sent two native tool calls at tool_calls[].index 0, each
with its own id and name. events() kept one call per upstream index, so
the second call's arguments were sent as more of the first:
{"key":"A"}{"key":"B"}, which the client refused as unparseable JSON.

A fragment with a non-empty id that differs from the open call's id at
that index now starts a new call with an output index of its own. A
fragment with no id, or the open call's id, still goes on with the open
call (OpenAI's argument fragments, and relays that repeat the id). A call
pushed aside before it got a name still counts as nameless (#579).
After two ids at one index, id-less fragments go to the newer call; the
report suggested failing there instead, but OpenAI streams each call's
fragments right after its start, so the newest is the one open.

Siblings with the same index-keyed fold, fixed the same way:
- zed 0.1.19: chatWhole (a streamed chat reply folded for stream:false).
- codearts 0.3.7: completionFromChunks.
- zen-free 0.1.27: stream.mjs chatAccumulator, and tool-response.mjs's
  chat buffer, which gives each call its own index when two collided.
- page-chat 0.1.13: lib/server.mjs folds through toolCallFolder.
Looked at and left: codearts' stream name restorer and kimi-desktop's
Agent hold pass fragments through unchanged and join no arguments;
zed's streaming path passes Zed's chunks through, and magpie's gateway
already starts a new call on a new id (internal/gateway/chat.go).

Run (WSL magpie-desktop, bun 1.4.2, node 22):
- pedh's repro.mjs with his fixture: [0,0] gave one tool event plus an
  args event on 0.2.64; now two tool events (index 0 and 1), each with
  valid JSON. [0,1] unchanged.
- HOME=$(mktemp -d) bun test packages/qoder packages/zed
  packages/codearts packages/zen-free packages/chat: 987 pass, 0 fail,
  1 skip (the epub reader's, as before). bun scripts/check.mjs: every
  package and registry.json ok.

Broken by hand:
- qoder back to index-only: 3 of the new tests fail (two ids, id-less
  after a second id, streaming adapter).
- qoder starting a call on any fragment without the open id: 8 fail,
  the id-less continuation test among them.
- qoder treating any id as new: the repeated-id test fails.
- zed, codearts, zen-free (both) on main's code and chat keyed by index
  only: each new collision test fails (5 of 5).

Not tried: a real Qoder account (no Qoder Ultimate here), real Zed,
CodeArts or OpenCode Zen replies with a collision, and the chat page
in a browser.

Reported-by: pedh <pedh@users.noreply.github.com>
2026-11-10 16:56:37 +08:00
yetone 5403c21484 qoder 0.2.51: a native tool call that never gets its name no longer fails the turn (#579)
bigstage915 (Qoder CN, qoder-cn/qfmodel through ZCode) saw qfmodel now and
then begin a native tool call and never send its function name. events()
then ended the stream with "the model's native tool call has no name", an
SSE error frame on a 200, which ZCode reads as not retryable: the whole
turn died, with the reasoning and text already shown (9 incidents in four
days, after reasoning-end and after a named call's tool-input-start and
argument deltas).

An unnamed call is still never given, and its held arguments go nowhere,
not into the text. Now:
- Nothing of the answer said before it (no text, reasoning or call): the
  reply is the same 502 as before, marked nameless, and ask sends the
  request once more under a new request_id. A second such reply goes back
  as the 502, before any byte, which magpie's gateway retries or fails
  over (retryable: status >= 500).
- The answer had begun: the call is dropped and the answer ends as it
  would have without it, tool_calls beside a named call, stop (or length)
  otherwise, and console.warn says so (the host's stderr, in magpie's
  log). The non-streaming reply is the same: named calls kept, the
  unnamed one left out.

Tests (native-tools.test.mjs): the after-reasoning test now expects the
reasoning kept, no tool frame, finish stop and the warning; new cases for
an unnamed call after a named call's start and argument deltas (stream),
beside a named one (non-streaming, unnamed first and after), after text,
and nothing-said (asked twice, then 502; asked twice, second answer
given). The two 502 tests now also count two chat requests.

Run, on the WSL2 box (magpie-desktop, Bun 1.4.2; mote at load ~120):
- native-tools.test.mjs: 15 pass.
- The new test file against origin/main's index.mjs: the 7 new or
  changed tests fail, the 8 others pass.
- Broken by hand: the in-plugin retry off, 3 fail (the retry tests);
  reasoning not counted as said, 1 fails (after-reasoning).
- Full `HOME=$(mktemp -d) bun test` at this tree: 4469 pass, 1 fail,
  agent-office's "midnight and metadata-only changes do not read JSONL
  again", red alone on untouched origin/main 26864ec too, in UTC and
  Asia/Shanghai: filed as #580. `bun scripts/check.mjs`: ok.

Siblings: no other package has this guard (grep of the error text and an
unnamed-call check over packages/). magpie's own chatTidy already drops a
call whose first fragment has no name and ends stop (#1475), the same
choice.

Not tried: a real Qoder CN account; the failure is the model's and not
reproducible on demand.
2026-11-01 07:06:57 +08:00
Euraxluo 915f14324e qoder 0.2.20: keep unnamed native tool deltas out of history (#256, Euraxluo)
A Qoder reply's native tool-call deltas no longer become a tool with an empty name. An empty or null placeholder is skipped; an id or arguments that arrive before the name are held until it comes; each upstream index keeps its own output index, so interleaved parallel calls get their own arguments (streamed and non-streamed). A native call that ends without a name ends the turn as a 502 instead of being sent on, since clients persist the empty name and Responses providers then reject the history. Qoder and Qoder CN share this parser.

Run at the reviewed head 9c755fd62cfd11cb80a9d960862aad25c32fb97d:
- bun test packages/qoder: 150 pass, 0 fail
- bun scripts/check.mjs qoder: ok
- native-tools.test.mjs on origin/main 5b68df0 (old parser): 0 pass, 11 fail
- PR CI (test, on-npm): green
Not tried against a live Qoder account; the frames are synthetic.
2026-10-20 15:56:06 +08:00