7b42e404f5f656d7bfb4aa5c7ddbcd1031264a86
10
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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>
|
||
|
|
1080b81c7d |
zen-free 0.1.22: tool names Zen refuses go under other names (#624)
alonewolfsy-web bisected a real Claude Code desktop request that Zen's free tier answered 429 FreeUsageLimitError while 0.1.21 had added the environment block and core tools: a tool name with "terminal" in it (an MCP server's terminal tools), and ReportFindings offered beside ScheduleWakeup, as Claude Code desktop does, each got 429 at once; the same request with those tools renamed was served (their patch, 40+ real requests). Either of the pair alone was served. Such tools now go to Zen under other names of the same words (mcp__ide__terminal_run as mcp__ide__console_run, RunTerminal as RunConsole, ReportFindings and ScheduleWakeup as findings_report and wakeup_schedule, with _2 when the agent has that name), in the agent's past calls and tool_choice too, on Chat, Responses and Messages. A call of one comes back under the agent's own name (toolPolicy.renamed, read first by nameGuard). A request without them is sent as before, and one of the pair alone keeps its name. Run at this head on mote (bun 1.4.2, HOME=$(mktemp -d)): - packages/zen-free bun test: 208 pass, 0 fail. - whole repo bun test: 4785 pass, 14 skip, 0 fail. - bun scripts/check.mjs zen-free: ok. Broken by hand: - origin/main's provider.mjs: the three per-protocol #624 tests red. - origin/main's tool-response.mjs (no renamed lookup): the same three red. - the pair renamed even alone: "a request without a refused name" red. Not tried: a request to the real Zen. Every probe from this network was answered 429 FreeUsageLimitError today, a plain control without tools included (the address's free allowance is spent until 00:00 UTC), so the gate itself rests on the reporter's bisection. Not tried with Claude Code desktop. |
||
|
|
ec884d09dc |
zen-free: a later null or empty tool-call id keeps the id already streamed (#188, #259)
When a Chat Completions stream sends a call's id first and then id: null or
id: "" in a later delta for the same index, the buffered call kept the later
value, so the client got null/"" ids and a later request failed with
"Duplicate value for 'tool_call_id'" (#188). A later null or empty id now
keeps the id already buffered; an id that first arrives in a later delta is
still taken.
Run at the reviewed head 8f19ba1e6bf09f105a47e4fb2f7233de22a99b06 (base
|
||
|
|
2ef6d6b62b |
zen-free: a null name or arguments in a streamed function delta adds nothing, instead of failing the turn (#252, ChuHanModel)
A Chat Completions stream whose tool_calls or function_call delta carries `"name": null` or `"arguments": null` (some OpenAI-compatible vendors send these) failed the whole turn with "Invalid upstream function delta". appendFunction now treats a null/undefined name or arguments as no new bytes and keeps the fragments already buffered. Other non-string types still fail. The name is still checked on the whole concatenated value when the choice finishes, so a call whose name stays null is still left out with its note; skipping null can't let a call past the policy. Siblings: no other package vendors tool-response.mjs (grep for "Invalid upstream function delta" finds only zen-free); zed's tool-call merge already appends only truthy arguments. Run at the reviewed head 48a266070ed1ad3e63fa864e438af8163110f5f6: - Fix removed by hand: 4 new tests red (tool_calls / function_call "ignores null fields..." and "still drops calls whose name remains null", failing on `!values.some(value => value.error)`), 104 pass. Restored: node --test packages/zen-free/tool-response.test.mjs 108 pass, 0 fail. - HOME=$(mktemp -d) bun test: 1853 pass, 0 fail across 168 files. - bun scripts/check.mjs: passed. Version bump to zen-free 0.1.12 follows in its own commit. |
||
|
|
d556ef8dda |
zen-free 0.1.11: a call of a tool the agent doesn't have reaches the agent as called (#209, xiotbox)
#209: since 0.1.3 (#76) a call whose name the agent has no spelling of
(DSH with pwsh declared: psh, pash, ppwsh, pshh, bash, shell_command) was
left out with a text note, and a reply of only such calls was rewritten
to a plain stop. DSH read that as a finished answer: 16 of xiotbox's 19
cases ended an autonomous turn, and the model never saw an error it
could correct.
Now nameGuard answers the model's own name when no declared tool folds
to it, so every protocol (Chat JSON/SSE, Responses, Messages) hands the
call on with its id, arguments and tool-call finish, as every other
provider in magpie does. The agent answers an unknown name itself (DSH's
ToolRuntime, Claude Code's "No such tool available", Codex's
"unsupported call", OpenCode's invalid tool) and the model corrects it.
Case and separator folding (todowrite -> todo_write, bash -> Bash) is
unchanged, and an ambiguous fold is still never guessed: it goes on as
called. Only a call with no name is still left out with the note. Any
correction budget is the agent's, as with any provider; the plugin keeps
no per-turn state.
Tests: the #76/#209 names (bedit, bcp, ash, mcp__netcatcatty__unused,
psh, pash, ppwsh, pshh, shell_command) alone and beside a declared call,
JSON and streamed, in all three protocols: the call arrives with its id,
no note, no error, a tool-call finish; a Responses or Messages stream
comes through frame for frame. index.test's plugin-level case (loader
fetch against a local fake Zen) now expects an undeclared `edit` handed
on as a tool call. The leave-out machinery tests use a nameless call.
Run:
- packages/zen-free `bun test`: 174 pass, 0 fail. With nameGuard put
back to `|| null`: 28 fail.
- `node --test` (Node 25.8.2 and 22.22.0): 171 pass, 3 fail, the
"sends OpenCode's own headers" tests, red the same on origin/main
|
||
|
|
b033987516 |
zen-free: a declared name of separators only matches only itself, and the unused injected set is gone (#76 follow-up, tkhs101)
foldsTo kept a declared name whose fold is "" (an agent declaring "_"),
so any call of separators only ("--", "-", "__") was handed that tool:
an empty fold matching an empty fold, not a name matching a name. Such a
name is now skipped in the fold maps, so it matches only itself and the
other calls are left out with the note like any unknown name.
normalizeTools still built and returned `injected`, which nothing has
read since the guard folds over `declared` alone; it is gone. The "Never
call this tool" stubs are sent as before.
Run: packages/zen-free `bun test` 162 pass; the new test goes red with
the foldsTo change taken out. Whole repo `bun test` (temp HOME and
TMPDIR) and `node --test packages/zen-free` pass; `bun scripts/check.mjs
zen-free` ✓. Rides in 0.1.4 with the #91 change.
|
||
|
|
6a5dd01d5d |
zen-free 0.1.4: a streamed Chat reply Zen closes before its [DONE] ends cut short, with a note, instead of failing the turn (#91, tkhs101)
Zen now and then closes a space-bunny-free Chat Completions stream after some frames, with no finish_reason, usage or [DONE] (~0.1% of turns in the reporter's logs). The tool guard turned that into an error frame at the end of the 200 stream, so the agent threw away the reasoning and text it already had, and magpie can't ask a Zen Chat reply to go on. Now, for a client that streams, a Chat reply cut short that has said something (text or reasoning) and has no tool call pending ends as an ordinary answer: each open choice gets the note "(The reply was cut short: Zen closed the stream before it finished. Ask again to go on.)" and finish_reason "stop", then [DONE]. A reply whose every choice had finished only gets its [DONE]. It still fails when a tool call is pending (its arguments may be half written), when nothing was said (an empty reply), and when the reply is collapsed for a client that doesn't stream (nothing reached the client yet, so magpie can ask again). Anthropic Messages and Responses streams cut short still fail: magpie's gateway tells such a reply from a whole one itself (#370) and, for an Anthropic upstream reached through translation, goes on with it (continuation.go); a made-up message_stop or response.completed here would stop that. The error that remains names the reply's id, the events and bytes received, and an unfinished tool call, as the reporter asked. The README also says the free tier needs tools, which is why the five core tools are sent. Run: packages/zen-free `bun test` and `node --test` (161 pass). The new tests use the reporter's three frames byte for byte, at chunk sizes 7, 31 and 4096; all 6 go red on the old tool-response.mjs/provider.mjs. Broken by hand: dropping the pending-call check turns the "still fails" test red; ending cut short for non-streaming clients too turns the loader test and the "still fails" test red. Whole repo `bun test` with a temp HOME and TMPDIR: 1109 pass. `bun scripts/check.mjs`: all ✓. Through the plugin's loader against a node fake upstream on 127.0.0.1:3720 that sends role, reasoning and two text frames 50 ms apart and FINs: streamed → 200 with the text, the note, stop and [DONE]; not streamed → 502 "Upstream SSE ended without a completion marker (reply x2, 4 events, 659 bytes received)". Not run: real Zen (the cut can't be provoked) or magpie's plugin host. |
||
|
|
da7e2f67a5 |
zen-free 0.1.3: a call of a tool the agent doesn't have is left out with a note, not a failed turn (#76, tkhs101)
#76: Zen's free models sometimes call a tool by a name the agent never declared (tkhs101's table: bedit, bcp, ash, mcp__netcatcatty__unused, beside declared edit, bash, mcp__netcatty-external__list_hosts). The guard answered each with "Upstream called a tool not declared by the client", which failed the whole turn. The rows without a name are from before 0.1.1 (published 10-10 11:51 UTC), which added the name. Now such a call (or one with no name) is left out of the reply instead: - chat: dropped from tool_calls/function_call; the reply's content says "(The model called a tool this agent doesn't have: "bedit". The call was left out.)"; kept calls are renumbered from 0; finish_reason becomes "stop" when no call is left, including a repeated finish. - responses: the function_call item becomes a message item with the note (added, text deltas, done, and in response.completed); its argument events are not passed on. - anthropic: the tool_use block becomes a text block with the note; its input deltas are not passed on; stop_reason tool_use becomes end_turn when no call is left. A call of an unsupported type (custom tools, non-object input) still fails as before. Run: - bun test packages/zen-free: 155 pass, 0 fail; node --test packages/zen-free/*.test.mjs: 155/155; bun scripts/check.mjs zen-free. - The new tests on the old tool-response.mjs: 35 fail. - Breaking the finish rewrite by hand: 5 fail. - Chat stream fixtures use the shape a live step-5-preview-free stream sent (name whole in the first delta, arguments in pieces, two tool_calls finishes). Zen sends names whole, so the names in #76 are the model's own; a real misnamed call was not reproduced live. |
||
|
|
cdbaff644a |
zen-free 0.1.1: an OpenCode tool name is given the agent's own spelling, and a refused call names its tool (#76, tkhs101)
Zen's models open multi-step work with OpenCode's own todowrite, while DeepSeek Harness declares todo_write. The guard folded names only for the five core tools the plugin injects, so with an agent that declares all five nothing was injected, nothing folded, and the whole turn died with "Upstream called a tool not declared by the client" - without saying which tool. Now any call is given the agent's tool whose name differs only in case, or else only in case and separators (todowrite -> todo_write, webfetch -> web_fetch, BASH -> bash), when exactly one declared tool folds to it; a name two declared tools fold to is still refused rather than guessed. A refused call's error ends with the tool's name. Run: bun test and node --test in packages/zen-free (141 pass; under a load average of ~140 bun's 32 MiB buffer tests sometimes hit their 5s timeout, the same on the old code, one run fully green); the new #76 tests fail on the old tool-response.mjs (6 red). bun scripts/check.mjs zen-free. Live against Zen (step-5-preview-free, chat, stream): calls pass with the folded names; the model didn't emit todowrite in 6 tries, so the mapping itself is shown by the tests. |
||
|
|
f5dc146c2c |
Add OpenCode Zen Free provider plugin (#31)
* Add OpenCode Zen Free provider and market listing * Guard Zen tool calls and address provider review * Preserve upstream SSE error frames in Zen tool guard * Restore Zen Free package name and simplify README title |