#159 and #162: the "far from Cursor" fake showed a Run's usage event
SHOWS (225 ms scaled) after the Run's stream closed. The step's wait
takes its last look about 180 ms after that close, so only ~45 ms stood
between "the event is not there yet" (what the test means) and "the
event is already there" (the step owns it and the sum moves). A loaded
machine eats 45 ms. #162's title guessed an earlier test's cached
usage; it was the step's own event showing inside its wait.
The fake now holds a far Run's event until the step whose Run it is has
answered, and shows it at once if that step already has: the state the
test is about, not a duration.
#165: test 1 bounded each step's wait in milliseconds, which load
stretches. Each wait asks once and the round trip is most of it, so the
bound is now at most 2 asks per step (its own event, plus what earlier
steps owe).
Run (bun 1.4.2, load average 280-295 throughout):
- Old test, cause injected by showing the event earlier (SHOWS - 50 ms):
#159's failure; SHOWS - 80 ms: #162's. New test with the same
injections: green.
- packages/cursor/latency.test.mjs: 9 of 9 green.
- packages/cursor whole package (HOME=$(mktemp -d) bun test): 3 of 3,
272 pass, 0 fail.
- Broken by hand in index.mjs, each turned the new test red: the step
waiting for its own event removed; owed() not gathering at the end;
the ask bound raised (a step asking 3+ times).
Not run: the whole-repo suite (test-only change in one file).
"refreshTokens orders hosts by the token's source_id and falls back on
400002" compared the expiry refreshTokens computed (Date.now() + 3600s -
10min) with Date.now() read again after it returned. On a millisecond
boundary between the two reads it is off by one: publish run 38885546686
(devin 0.1.20's push, 29adee2) went red on ubuntu with expires
1792148517446 against 1792148517447, and no package published. The test
now takes the clock before and after the call and checks the expiry lies
between them.
Run: with a 3ms busy-wait injected after refreshTokens returns, the old
test is red (0 pass, 1 fail) and the new one green. bun test in
packages/autoclaw under a mktemp HOME: 9 pass. bun scripts/check.mjs
autoclaw: ok. Test only; the package's version is unchanged.
magpie.page.titles names the page in zh, zh-TW, ja and de; a magpie that
doesn't know titles still reads title. The tiles were auto-fill, which left
a hole in their row at most widths; now four across, two by two under 640px.
Run: bun test in packages/usage (6 pass). Tried in the magpie sandbox app's
dev UI with the real usage.jsonl, WebKit, dark and light, zh and en, at
900 and 560px.
magpie's built-in Devin (internal/gateway/devin.go buildDevin) sends the
images a tool returned on the tool message that answers the call
(inlineImages(p.Images), field 10). A chat's tool message holds text
alone, so magpie's gateway hands the plugin those images in the user
message after the results (buildChat's seeLater: "[From the result of
<tool> (tool call <id>):]" then the images, and the result's text ends
"[The tool returned an image; it follows in the next message.]"). The
plugin sent them to Devin as a user message of their own, and a tool
message's own image_url parts were dropped.
build() now puts each result's images back on its tool message: the
images under a heading naming a result just sent, up to the number its
note says (so the user's own images after them stay the user's), and a
tool message's own data: image_url parts. The note is taken off the
result's text when every image it names went back with it; an empty
result is "(no output)", as the built-in words it. Images without bytes
(URLs) are left out, as inlineImages leaves them. A heading that names no
result just sent is left as the user's text.
Run:
- bun test in packages/devin under a mktemp HOME: 93 pass, 0 fail.
- bun scripts/check.mjs devin: ok.
- tool-images.test.mjs against the old index.mjs: 3 of its 4 tests red
(the fourth guards a heading naming no result, which held before too).
With the count limit broken by hand (images past the note's number taken
as the tool's), the two-results test goes red.
- The fixtures in testdata/ are magpie's literal buildChat output at
origin/main b03031738, captured with a throwaway test in a separate
magpie worktree (codexViewImage, and an Anthropic request with two Read
results and the user's own image).
Not tried: a real Devin account (whether Devin's model reads a tool
message's images better than a user message's was not measured); OpenCode
itself, outside magpie, whose own shape for a tool's images was not read.
Three things magpie's built-in Command Code did that the plugin didn't,
ahead of retiring the built-in:
- The Credits window had no reset, though the month's credits come back
when the plan's period ends, which billing/subscriptions' currentPeriodEnd
says (sub.until, already the card's "until"). allowanceOf now puts it on
the window as resetsAt (yetone/magpie#2454). No period end, no reset.
- The models the CLI marks FREE (magpie's cmdFree, all 11: Space Bunny
Alpha, Pixel Canary, Laguna S 2.1, the Ling 3.0/3.1 Flash ones, the
MiniMax M3/M2.7 free ids, LongCat 2.0 free, Tencent Hy3) now say
free: true on every list: the Provider API's, Go's, and Go's table when
the list can't be had.
- A Go chat's max_tokens sent to /alpha/generate is kept within 200,000,
the most Command Code takes ("Too big: expected number to be <=200000
at params.max_tokens"; magpie's CommandCodeMaxOutput in cmdRequest).
Before, a 384,000 ask failed the whole request.
Run: bun test in packages/commandcode: 49 pass, 0 fail. parity.test.mjs
is new; usage.test.mjs's two plan-with-period cases now expect the reset.
Broke each by hand and watched red: no resetsAt, 3 fail; no free flag,
3 fail; no cap, 1 fail. bun scripts/check.mjs commandcode: ok.
Live, with the owner's GOAT key: the card's Credits window says resetsAt
2026-10-28T16:16:42Z, the subscription's until; its list (71 models) has
poolside/laguna-s-2.1-free free, the only one of the 11 Command Code lists
today. Not tried live: a Go request over 200,000 (no Go key here).
Two things magpie's built-in Cursor did that the plugin didn't, ahead of
the built-in's retirement:
- The stateless path (conversation) sent every tool result with
isError false. A chat tool message with is_error: true (what magpie now
sends for a failed tool, as the built-in's cursorResult told Cursor
isError) is marked isError, as the native path already did.
- cliToken ran `security` on every call. It now reads the Keychain as the
built-in's cursorKeychainToken (internal/provider/cursor.go; magpie
#746, #2408): a read is kept 10s; a read that failed with anything but
exit 44 (no such item) may have been a dialog the user said no to, and
is not asked again for 10 minutes; reads go one at a time, so callers
at once share one run. A sign-in and the read after `cursor-agent
status` read afresh, as forgetCursorStatus / cursorTokenOf(true) did.
README's "read on every request" says so now.
What was run (bun 1.4.2, macOS, load average ~280-300):
- parity.test.mjs (new, 5 tests): green. Broken by hand, each watched
red, then restored: is_error ignored (1 red), cache check removed
(3 red), denied backoff at 10s (1 red), exit 44 treated as refusal
(1 red), no read serialisation (1 red).
- `security find-generic-password` for a missing item gives execFile
err.code 44 (number) on this Mac, as the mapping assumes.
- Full `bun test` in packages/cursor, 7 runs: 272/272 green in 4; the
other 3 red only in latency.test.mjs ("events never show in time",
#159; "nothing naming the session", #162), which the change doesn't
touch. On clean origin/main aec06bd, latency.test.mjs alone is red
too, including "far from Cursor ... cache and all" (filed as #165).
- Not tried: a real Keychain dialog denial; the backoff is checked with
a fake `security`.
What changed:
- usage: magpie's built-in zedLoginQuota showed a free account's card
(plan_v3 zed_free, or none) as "No plan", unless an overdue invoice was
its error, while the account row kept zed.PlanName's "Free". magpie's
card knows "No plan" (app.js noPlan) and translates it. The plugin's card
said "Free". It now says "No plan" in the same case; the sign-in still
saves planName "Free", and an overdue free card keeps "Free" with its
error, as the built-in's switch did.
- README: "Not included" listed the plan display, which the usage hook has
shown since 0.1.x, and several accounts and the web-search stand-in,
which magpie gives a plugin provider itself (plugin_accounts.go, the
gateway's generic searchReply path). It is now a "Usage" section and an
"In magpie, not the plugin" section.
What was run:
- usage.test.mjs: the free-account test (zed_free, "" and an overdue free
account) fails on 0.1.7's index.mjs ("Free" for "No plan"), passes now.
- packages/zed under a scratch HOME: 31 pass, 0 fail (4 files).
- bun scripts/check.mjs zed passes.
Not tried: a real free Zed account.
What changed, for parity with magpie's built-in ZCode before it retires:
- Personal resets. The built-in's zcodeQuota read
/api/biz/customer-package-reset/list?targetType=PERSONAL with the plan's
key (zhipuPersonalResets, yetone/magpie#1191) and showed the count, by
window, and each reset's end. The plugin read only the team's list.
codingUsage now reads the personal list alongside the subscription list,
so a Coding Plan card (and a dual gift + Coding Plan card, built on it)
carries resets: {count, byWindow, fiveHour, weekly, until, each}.
- Team resets now carry team: true and each, as zhipuTeamResets set Team.
Both lists are read by one resetsOf: only available ones count, each
{until?, window} sorted soonest first with an endless one last
(sortResetCards), nothing on a failed read or none left.
- Start Plan refusal. A Start Plan answer that is a 405, the block page
("request has been blocked" / errors.aliyun.com) or code 3012 / "unusual
activity" now comes back, same status, as {type:"error", error:{message:
"<vendor's words, or the status for a block page> — <hint>"}}, the hint
word for word magpie's provider.ZCodeStartBlockedHint, as the built-in's
zcodeStartExplain / Provider.Explain put it. The block page's own words
are left out, so magpie's APIError no longer reads it as a network
firewall's (BlockedHint). Coding Plan and team answers are untouched.
- README: the resets and the Start Plan's hint.
What was run:
- usage.test.mjs: a new test with #1191's literal reset list (the
built-in's zhipuResetList) fails on 0.1.18 (no resets); the team test,
now expecting team and each, fails on 0.1.18 too.
- start.test.mjs: the new refusal test fails with the startBlocked line
disabled by hand (block page passed through), passes with it.
- Every packages/zcode test file under a scratch HOME: dual 25, gift 20,
models 1, moved 1, own 6, signin 3, start 11, usage 16 (83 pass).
- bun scripts/check.mjs zcode passes.
Not tried: a real account's reset list or a real Start Plan refusal.
`team` and `each` reach magpie's card from its next release; older magpie
ignores them.
Every model in MODELS carries the tokenMultiplier droid 0.241.1's registry
has for it (testdata/droid-0.241.1-costs.txt, byte for byte). A promotion
running takes its discount off it, with the multiplier before it as rateWas;
one that has ended or not begun is no discount. The rate reaches magpie
through a provider hook (host.js reads rate/rateWas from its models; a
config hook's models carry no rate there). Fast Mode entries stay last.
Reviewed at 498b8723e5350657aa26f8f0e2bb1d859f59803b:
- each multiplier and promotion checked against the testdata excerpt;
gpt-5.6-sol's expired M promotion is skipped and Pt (20%) applies, as
droid's first-running-promotion rule gives
- host.js info(): the provider hook's list replaces the config list, and
the request path strips temperature for OpenAI models in droidBody, so
capabilities.temperature=true in providerModel changes nothing sent
- factory unchanged on main between the PR's base 7687314 and fe5631c
Run (HOME=$(mktemp -d), PR head merged with main fe5631c):
- bun test: 1620 pass, 2 fail; the two are cursor latency.test reds under
the full run at load ~260, already filed as #159 and #162; packages/cursor
alone: 267 pass, 0 fail
- bun test packages/factory: 149 pass, 0 fail
- packages/factory/rate.test.mjs against main's index.mjs: 5 fail
- bun scripts/check.mjs: passes
Not tried with a real Factory account here (the author did, 46 models).
Devin's GetChatMessage has no field for the answer's format, so magpie's
built-in Devin (internal/gateway/devin.go, req.inSystem()) told the model
in the instructions: the json_schema's schema, or any JSON object for
json_object. The plugin dropped response_format, and magpie's generic
plugin path falls back to inSystem only when an upstream answers 400
naming the format, so a moved user asking for JSON got prose. build()
now adds the built-in's words (format.go's instruction) after the
system messages, ahead of the tool descriptions, at the head of the
first user message. A json_schema with no schema asks for any JSON
object, as the built-in's openAIFormat reads it.
Checked against the built-in, no change needed:
- Lightning variants (swe-2-high-lightning, swe-1-7-lightning-medium):
the built-in's tiers are fast and priority only (devinTiers), so a
-lightning id is no effort and no tier and is listed as its own model,
as the plugin lists it.
- A failed tool's result: magpie sends its content as "Error: …", and
build() passes a tool message's text to Devin as it came; a test now
holds that.
Run: HOME=$(mktemp -d) bun test in packages/devin: 89 pass, 0 fail.
structured-output.test.mjs: 3 of its 5 tests red with the index.mjs
change taken out (the other two: no format unchanged, and the
"Error: " pass-through). bun scripts/check.mjs devin: ok.
Not run: a real Devin account, nor magpie end to end.
Kiro's generateAssistantResponse has no field for the answer's format, so
magpie's built-in Kiro (internal/gateway/kiro.go, req.inSystem()) told
the model the schema at the end of the system prompt: "Respond with a
single JSON value and nothing else, matching this JSON schema:\n<schema>."
The plugin dropped output_config.format, and magpie's generic plugin path
falls back to inSystem only when an upstream answers 400 naming the
format, which the plugin never did, so a moved user asking for JSON got
prose. buildKiro now says the schema the same way, after the caller's
system prompt and before the thinking budget prefix. The AI SDK's
output_format is read too. A JSON object with no schema needs nothing
here: magpie's Anthropic body already tells it in the system prompt.
Run: HOME=$(mktemp -d) bun test in packages/kiro: 46 pass, 0 fail.
structured-output.test.mjs: 3 of its 4 tests red with the index.mjs
change taken out (the fourth checks a request with no format is
unchanged). bun scripts/check.mjs kiro: ok.
Not run: a real Kiro account, nor magpie end to end.
A user typed keys made under several OpenCode accounts into Zen Free's key
field and expected several accounts. The method's authorize() always
returns key "public", and magpie's host stores result.key over the typed
key (host.js save), so every such sign-in is the same shared credential
and the typed key is dropped. The label and README now say so and point
own keys to magpie's built-in OpenCode Zen provider (several keys,
rotation and failover).
Run: bun test in packages/zen-free, 174 pass 0 fail. Read host.js
apiKey/save on magpie 63be47717 to confirm the stored key is "public".
Not tried: a sign-in through magpie's GUI with the new label.
Reported on magpie's Discord (#help): through magpie, Trae CN's doubao
model said it couldn't read images, while in Trae it reads them.
Every model was listed as text-only (MODEL's modalities), and partText
put "[an image, which this model can't see]" in every image's place, so
no image ever reached Trae.
What changed:
- Trae's lists mark each entry `multimodal` true or false
(config_info_list). A listed model's flag now decides
capabilities.input.image, attachment and modalities, over a fallback
entry's word. Doubao-Seed, Kimi K3/K2.6, Qwen 3.7 Plus and MiniMax M3
are true; GLM-5.x and DeepSeek V4 are false.
- An image sent to a model that takes images goes to llm_utils_chat as
an OpenAI image_url part ({url}) after the text part. That is the
shape TRAE's ai-agent carries (LLMRawMultiContent/LLMRawChatImageURL,
in the ai-agent binary's strings) and what autumnsentiment/Trae2api-cn
passes llm_utils_chat unchanged.
- A model marked false still gets the placeholder.
- The fallback list marks kimi-k2.6 and qwen-3.7-plus as taking images,
as Trae's SOLO list does.
The list fixture is two entries of a relay's capture of the SOLO list
(wangqi233/trae2api scripts/_solo-models-clean.json).
Run:
- images.test.mjs: 6 pass on this change; 5 of 6 fail on 0.2.14's
index.mjs (only the text-only case passes there).
- packages/trae: 146 tests, 0 fail.
- HOME=$(mktemp -d) bun test across the repo: 1616 pass, 0 fail.
- bun scripts/check.mjs: ok.
Not tried: a real Trae account. Magpie's owner has none signed in, so no
real image request was sent to Trae.
The 15-minute absolute lifetime spans all of a retained Run's tool
roundtrips. A tool-result continuation that arrives with no more than
min(60s, lifetime/10) left now retires the owner (410 "retired before
lifetime deadline") and rebuilds from the supplied history before writing
any result, instead of resuming and failing mid-segment with "native Run
lifetime expired". Replays of an already submitted batch keep their path.
Merging main resolved a conflict with a7614aa (#143): expireIn sets
expiresAt as well as the timer.
Reviewed at 75e481a (nicegui's 6f03753 plus the merge of main):
- packages/cursor `bun test` (isolated HOME) 267 pass, 0 fail, three
times; `bun scripts/check.mjs` ok; PR CI run 38868447170 green, attempt 1.
- The near-expiry test fails on the source without the reserve check.
- Near-deadline injected by shifting Date.now() from the owner's
expiresAt, not by waiting: 62s left resumes on the same Run (1 Run, 1
result written); 59s and 0.5s left rebuild (2 Runs, no result written).
With the check removed by hand, 59s and 0.5s go red.
The native retention test set NATIVE_LIMITS.lifetime = 65 before the
first ask. The lifetime counts from the Run's start, so on a loaded
machine the first Run expired before it answered: 410 where the test
wants 200. NativeSession now sets its deadline through expireIn(ms), the
constructor giving it the whole lifetime as before, and the lifetime case
calls owner.expireIn(65) after the first answer. The resultWait case
still sets its limit up front, since that wait counts from the answer.
The plugin's behaviour is unchanged, so there is no version bump.
Run:
- Injected: on the old test, a lifetime of 0–10 ms is red ("Expected: 200
Received: 410"); 15 ms and up is green. The new test is green.
- HOME=$(mktemp -d) bun test, whole repo: 10 runs in a row, 0 fail
each. On current main 2dd4328 plus this change: 1609 pass, 0 fail.
- bun test packages/cursor/latency.test.mjs 8 runs: green with this
change. On main without it, 1 red in 8 runs. That red is
"events never show in time" at load ~120, filed as #159. It is not
this test. grok's login flake from an earlier run is #160.
An opt-in gateway middleware for Codex Responses history after a provider
or account switch. For a provider whose rule turns historyFilter on, it
drops old reasoning items and items typed encrypted_content, removes the
optional server id from message and tool items, and sets store false. It
keeps text, tool arguments, results and call_id pairing. It rejects
previous_response_id, conversation, item_reference, encrypted compaction
and /responses/compact with a message, instead of dropping them silently.
Every provider passes through unless configured. No network, file, env or
child-process access.
Run at the reviewed head 96881ead, merged with origin/main:
- bun test packages/codex-history: 22 pass, 0 fail.
- The same 22 cases.json cases through magpie's own engine (moejs, via
internal/middleware Begin/Request in a throwaway test): 22 ran, all equal.
- Broke it by hand (reasoning items kept): bun 4 fail, moejs 4 BAD; restored.
- Whole repo: bun test 1606 pass, 0 fail; bun scripts/check.mjs exit 0.
#156: a native Run of N tool steps ended with TurnEndedUpdate's totals as
the final step's prompt_tokens (1,105,934 on erzay's ~21-step turn, where
the real context was ~61K), and Codex compacted at once. The final step
now keeps its last model call's share, max(that call's chars/4 prompt
estimate, turn total / model calls), split proportionally across input,
cache read and cache write; the rest goes into usage.magpie_deferred
(merged with any settled stateless debt), so magpie still bills the whole
turn. On erzay's numbers that is ~52.7K reported, ~1.05M deferred.
#155: waitForBatch armed once, at a step's first call, so a step whose
calls arrive one by one as the model writes them (13 calls, 9 long-arg)
failed 502 "did not complete its declared native tool batch" ~30s after
the first call even though it never paused that long. The deadline now
restarts on every call, answered call, count and text/reasoning frame.
Run at this commit: packages/cursor `bun test` (isolated HOME) 266 pass,
0 fail, three times; `bun scripts/check.mjs` ok. The three new tests fail
on 4e64f26's source (prompt 1105934; sealed step failed at 300ms; stall
failed 303ms after the first call instead of after the latest).
Adds packages/autoclaw, @magpie-community/opencode-autoclaw-auth, for AutoClaw (Zhipu OpenClaw).
- Providers autoclaw (oversea, web sign-in through Google or z.ai) and autoclaw-cn (CN, phone SMS).
- Reads the credit balance and runs the daily check-in through auth.checkin.
Since the 10-08 review, this fixes:
- The OAuth callback takes a code only with the state the authorize page handed out (login CSRF). The legacy /callback is gone.
- The local server closes after 10 minutes even if magpie never calls callback, so port 18432 isn't held.
- The registry entry no longer uses ZCode's icon.
- The User-Agent names the real arch.
- The check-in row's used is 0.
- A 401 or 403 the upstream answers without an envelope marks the sign-in expired.
- New tests with a fake fetch cover loader().fetch, refreshTokens and the callback's state check.
What was run, at 356fb53 (8a0fd3a plus a merge of origin/main 118cf2e; the merge resolved registry.json, raccoon's entry beside autoclaw's):
- HOME=$(mktemp -d) bun test packages/autoclaw: 9 pass, 0 fail.
- Whole repo, HOME=$(mktemp -d) bun test: 1584 pass, 0 fail.
- bun scripts/check.mjs: all ✓.
- Broken by hand, each turning a test red:
- Dropping the callback's state comparison: 1 fail.
- Dropping the expired mark on a non-envelope 401: 1 fail.
- The package isn't on npm yet. magpie serves it from the dist branch until an owner publishes its first version.
Not verified: a real AutoClaw account, and the 10-minute server close (read, not tested).
Adds packages/raccoon, @magpie-community/opencode-raccoon-auth, for SenseTime Raccoon (商汤小浣熊, xiaohuanxiong.com).
- Sign-in: through the browser, or reusing Raccoon desktop's live sign-in.
- Lists the models and makes chat requests.
- Reads account credits (balance and bills).
- Runs the daily check-in through auth.checkin, plus the desktop's first-login grant. The grant is marked settled only when the vendor gives a definite answer.
What was run, at the reviewed head 6078f92 merged onto origin/main 4e64f26:
- HOME=$(mktemp -d) bun test packages/raccoon: 21 pass, 0 fail.
- bun scripts/check.mjs: every package ✓, raccoon included.
- Whole repo, HOME=$(mktemp -d) bun test: 1575 pass, 1 fail.
- The failure was grok's "a login's link is still handed on", a 5s timeout. Another full suite was running on the machine at the same time.
- The test passed 5 of 5 when run alone.
- It is filed separately.
- The raccoon code is byte-identical to c068cc5. That head was reviewed line by line on the PR, and every fix was broken by hand to check that its test goes red. 6078f92 only merges main.
- The package isn't on npm yet. magpie serves it from the dist branch until an owner publishes 0.1.0 (scripts/new-to-npm.sh).
Not verified: a real Raccoon account. Only the reply bytes the author captured were used.
OpenAI's reasoning models turn temperature and top_p away with a 400, and
droid sends neither. droidBody now takes both out of a Responses request
for a model whose upstream is openai, also when the body already opens
with droid's line. configModels says temperature: false for those models,
so OpenCode doesn't send it either. Grok and the chat-completions models
keep theirs.
Run: bun test in packages/factory, 144 pass. The new test fails on 0.1.30's
index.mjs (temperature still in the body). Not tried against Factory's API
with a real account.
A routing-strategy gateway plugin (magpie.gateway, exports strategies):
reserve/ceiling fills accounts in listed order up to `ceiling` percent of
their allowance (80 by default), then the next; past it everywhere, the
least used first. reserve/accounts-first puts subscriptions before API
keys, accounts least used first, keys by weight then recent tokens.
Resting seats go last in both. One file, no imports, for moejs.
Run:
- bun test packages/reserve: 12 tests (10 strategies.json cases through
checkStrategies, exactly two strategies and no hooks, every answer a
permutation for 2-8 seats). Breaking the resting rule by hand turned
its case red.
- Sandbox magpie from yetone/magpie origin/main b03031738: `magpie plugin`
lists "routings reserve/accounts-first, reserve/ceiling". A stub
OpenAI-compatible provider on 127.0.0.1:3593 recorded the key of each
request; the provider had key-a, key-b, key-c (weight 5), listed in that
order. routing=reserve/accounts-first: 3 of 3 went to key-c. With key-c
answering 429: key-c 429 once, then key-a, key-b, key-a (key-c resting,
last; equal weights by fewer tokens). routing=reserve/ceiling: 4 of 4
to key-a (keys' allowance unknown, so listed order).
Not tried: the over-ceiling tier with real subscription accounts; it is
covered by strategies.json only.
A new kind of package: a page in magpie's window (magpie.page), with
magpie.permissions ["usage:summary"] and nothing else. Today, 7 or 30
days; models by tokens, calls or cost; the picks are saved through
magpie.options.set (debounced past the bridge's once-a-second limit).
Theme from --magpie-* variables; en and zh text.
Run:
- bun test packages/usage: 6 tests (permissions are exactly what the
scripts read; no fetch/XHR/WebSocket; no inline scripts; every local
reference exists; what tiles and rows say).
- Sandbox magpie from yetone/magpie origin/main b03031738: `magpie plugin`
lists "page Usage glance (reads usage:summary)". `magpie web` on
127.0.0.1:3595 serves every page file under the sandbox CSP
(connect-src 'none'); /api/plugin-pages/read usage:summary answers the
sandbox's 10 calls; providers:list is refused 403. Headless Chromium and
WebKit (playwright 1.62.0) opened the sidebar tab: tiles "Calls 10,
Errors 0, Tokens 70, Cost $0", row "stub-1 70 · 10 calls", no console
errors; picking 7 days wrote "period": "7d" to plugins.json.
A new kind of package: an OpenCode plugin whose only hook is `tool`,
which magpie serves to every agent on /mcp/magpie/tools. Three tools:
eval (exact rational arithmetic in BigInt fractions), convert (data,
time, length, CSS, mass, angle, temperature) and date (calendar-aware
add, between, weekday/ISO week, IANA zones through Intl, DST included).
No network, no key, no dependency.
Run:
- bun test packages/calc: 8 tests, 73 expects, pass with TZ=UTC and
TZ=Pacific/Kiritimati.
- A sandbox magpie built from yetone/magpie origin/main b03031738
(nogui, HOME in a scratch dir, gateway on 127.0.0.1:3591):
`magpie plugin add <folder>`; `magpie plugin` lists
"tools calc_convert, calc_date, calc_eval". Over /mcp/magpie/tools:
initialize, tools/list (3 tools with their schemas), tools/call
calc_eval 0.1+0.2 -> {"exact":"3/10","decimal":"0.3"}, 1/0 -> isError
"division by zero", calc_convert 1 GiB->MB -> 16777216/15625
(1073.741824), calc_date across New York's DST with `to` -> between.
Not tried: an npm install. From npm the tools are named tools-calc_*,
since magpie's ShortName doesn't strip "tools-".
sryimnoob123 measured a streaming request to every model on each of
amr-link's three APIs: chat completions carries the thinking of most,
claude-haiku-5.5 and deepseek-v4-pro think longer on Responses, and
glm-5.3-flash thinks only on Anthropic's messages. The vendor also names
max beside low and high. #141 was written against 0.1.4 and conflicted
with 0.1.5 (#137's levels), so it is ported onto main here:
- WIRE/MODEL_WIRE/wireOf as the PR had them; the provider default is
chat completions, and a live list's and the seed's models each carry
api.npm/provider.npm, which magpie's host reads per model.
- The config hook sets every model's wire again over a kept copy, so a
model 0.1.5 left on the Responses API moves to its own.
- max joins every measured level list.
Run: bun test in packages/opendesign, 22 pass (a new test holds a kept
0.1.5 model moving to its wire; the old Responses-only expectations were
changed to the measured ones). Not tried against a real amr-link account.
Co-authored-by: sryimnoob <314134180+sryimnoob123@users.noreply.github.com>
sryimnoob123 measured amr-link with reasoning_effort high and low on all
11 models (magpie 0.1.1254, Windows): every one answered 200, and all but
gpt-6-luna streamed reasoning, four the catalog calls "standard" too.
Their install showed all 11 with reasoning false and no levels. Two
causes:
- provider.models gave the live list in the config's shape
(reasoning: true, modalities: [...]). magpie's plugin host reads a
listed model's thinking from capabilities.reasoning and its kinds from
capabilities.input, so for a signed-in account every model read as not
reasoning, with no image input. It now gives OpenCode's model shape
(servedOf: api, capabilities, variants), as minimax/workbuddy do.
- No model had levels: nothing declared variants, and magpie shows a
model's levels only from them. models.mjs now records the measured
levels (efforts): ["low", "high"] on the 10 that thought, [] on
gpt-6-luna (took it, never thought). Only the two levels the table
shows were given. A model with levels reasons whatever its capability
word; one the seed doesn't know keeps the old rule (advanced reasons)
with no levels. refresh-models.mjs keeps efforts like names.
Run:
- bun test packages/opendesign: 21 pass, 0 fail. New: "a signed-in
account's models reason at the levels amr-link took (#137)", "the
seed's models carry the measured levels as the config's variants";
the live-list test now pins the OpenCode shape.
- Broken by hand: modelsOf back on modelOf (config shape) -> 2 fail;
efforts not passed from the seed to the live list -> 1 fail.
- magpie origin/main internal/plugin/host.js run under bun with a
preloaded fetch stub serving a 3-model catalog (init + providers, a
stored oauth account): with 0.1.4 gpt-6-luna, deepseek-v4-pro and
claude-haiku-5.5 all list reasoning=false variants=[] image=false;
with this change luna false/[]/image true, v4-pro true/[low high],
haiku true/[low high]/image true, url the amr-link base.
- refresh-models.mjs against the same stub: efforts kept per model.
- bun scripts/check.mjs: every package ok.
- TMPDIR/HOME isolated bun test (whole repo): 1526 pass, 0 fail. A first
run had 1 fail, packages/grok/login.test.mjs "a login's link is still
handed on" timing out at 5s with load average ~100; alone 3/3 pass and
the rerun of the whole repo passed. Untouched package; not filed.
Not tried: a real Open Design account (none here) or magpie's
`model efforts` command end to end; the levels rest on the reporter's
table.
Full suite: bun test (whole repo, with factory 0.1.30 below it): 1527 pass, 0 fail
sky杨, on magpie 0.1.1254 with this plugin at 0.1.29, got 403 "Factory:
Forbidden" from Claude Code on every model, GPT, Claude and Gemini alike.
Factory's body was a bare "Forbidden", not a phrase-specific refusal.
Header diff against droid 0.242.0 (npm droid and @factory/cli-darwin-arm64
0.242.0, unpacked with --ignore-scripts into an empty directory and read
with strings, never run). Its model requests carry: Authorization,
X-Factory-Client: cli, X-Client-Version, X-Factory-Org-Id, User-Agent
factory-cli/<ver>, x-session-id, x-assistant-message-id, x-api-provider,
x-provider-routing-source (registry_default without a routing claim),
OpenAI-Platform: org-bHuLtG1fGmYk5YaOihAAXFBw for openai/azure_openai,
and X-Api-Key "placeholder" from its Anthropic client. The plugin sends
each of these with the same value, apart from the release: 0.233.0, nine
releases behind. The WorkOS client id is unchanged. droid's binary still
reads a server-side min_cli_version flag and runs a forced auto-update.
0.1.16 was the same case (JL: every model 403 "Forbidden" from pi and
Claude Code while droid worked; the plugin said 0.231.0, two behind), and
JL's later reports (0.1.25) were about models, not refusals. Whether
Factory refuses an old release with a 403 is still not confirmed: there is
no Factory account to try with. This is the one header difference found.
Run: bun test in packages/factory, 143 pass. With VERSION put back to
0.233.0, droid.test.mjs goes red (Expected "0.242.0", Received
"0.233.0"). bun scripts/check.mjs factory: ok.
Not tried against Factory itself.
Full suite: bun test (packages/factory) 143 pass
Zen made deepseek-v4.1-flash-free free (in its /models as the public key
reads it, 2026-10-15) and the plugin never offered it. Two causes:
- buildModels left out a listed model that neither the catalog
(models.opencode.ai) nor the docs' endpoint table described: a free
model Zen lists before they catch up, or every model but the snapshot's
when either can't be read. A listed id ending in -free with no word from
either is now asked through the provider's own package
(openai-compatible, chat), as OpenCode asks a model with no package of
its own. A paid or unknown id that doesn't say -free still needs the
catalog; the docs saying SystemOne still keep one out.
- A discovery with the catalog or the docs unread was marked
magpie.fellBack, though Zen's own list was read. magpie answers a
fallen-back list by keeping the last list read in full
(plugin.keepListed), so a user who can't reach GitHub's raw host or the
catalog kept that old list, and every model Zen made free since stayed
out. Only a failed read of Zen's /models is fallen back now; models
verified before are still kept while Zen lists them.
Tests (no network; the fixture server serves
fixtures/zen-models-2026-10-15.json, Zen's /models byte for byte):
- "a free model Zen lists that the catalog and the docs don't describe is
offered, on chat (#2385)": catalog 503, docs 404 -> the ten free models
Zen lists (Jev, "test" and the paid ones out), deepseek-v4.1-flash-free
on chat, muse-spark-1.3 on Responses, not fallen back; a request for it
goes to /chat/completions
- "... before the catalog has it is offered with the catalog read (#2385)"
- models.test: an unknown -free id is offered on the provider's package,
"unknown-paid", "freebie" and "free-model" aren't, SystemOne stays out
(replaces "unknown models require a known protocol rather than a
guessed chat endpoint")
- two partial-discovery tests now expect no fellBack
Broken by hand: models.mjs back to 0.1.8's -> 3 fail; provider.mjs back
to 0.1.8's -> 3 fail; both fixed: bun test 174 pass, 0 fail (bun 1.4.2).
bun scripts/check.mjs zen-free: ok.
Not tried: a live request to deepseek-v4.1-flash-free through the plugin
(one GET of Zen's /models was the only network used). A future free
model Zen serves on Responses or Messages that the catalog doesn't
describe yet would be offered on chat and refused by Zen until the
catalog has it.
No magpie mover to raise: zen-free isn't a moved built-in, and magpie
updates @magpie-community plugins by itself within the hour.
Cursor's tool_requests_listed (InteractionUpdate 27) counts every call of
the model's step, and is sent after them. That count includes calls the
plugin answers itself: a tool the request doesn't have (0.2.14's native
path refuses those) and Cursor's get_mcp_tools (exec 36). 0.2.14 counted
only the calls it accepted. A step with a refused call then either waited
30s for a call that never came (502 "did not complete its declared native
tool batch") or met the next step's count with the stale one (502
"inconsistent native tool count", the reporter's error). The stateless
decoder had the same miscount and hung. Both paths now count answered
calls toward the step and end a step whose calls were all answered without
one.
503 "native outbound messages limit reached": a long history goes out as
one blob per message, and Cursor asks for every blob at once. The native
transport caps its pending writes at 256 messages / 16 MiB and failed the
Run when a slow link backed them up past that. KV replies now wait for
room (NATIVE_LIMITS.writeWait, 30s) and fail only if the link doesn't
drain for that long. The stateless path writes directly and has no cap.
The fixtures are real Cursor frames captured on 2026-10-15 (model auto,
cursor-agent's agent.v1): get_mcp_tools plus a refused WebSearch in one
step followed by read_file, which gave 0.2.14 the reporter's exact
"inconsistent native tool count"; and read_file, refused WebSearch,
read_file under a count of 3, which gave 0.2.14 the batch timeout.
Run at this commit (on origin/main 43d93b0):
- packages/cursor `bun test` (isolated HOME): 263 pass, 0 fail.
- `bun scripts/check.mjs`: every package ok.
- Broken by hand: with native-session.mjs and index.mjs reverted to
0.2.14, the new tests fail with "inconsistent native tool count",
"native outbound messages limit reached", the batch wait, and the
stateless decoder's hang; 4 of 5 red (the stateless mixed case passes
on 0.2.14, which hands WebSearch to the caller there).
- Real Cursor, before the fix: the captures above reproduced both 502s
through the plugin's native path. The 503 was not reproduced on a real
link (my queue peaked at 160 of 256); it is reproduced in the test with
a 16-message bound and a slow fake write.
- Real Cursor, after the fix (owner's account, model auto, the mixed
prompt): native path 3 of 3 runs 200 with read_file a.txt and b.txt
(WebSearch refused to the model), stateless 3 of 3 runs 200; a native
Run with 1200 history messages 200.
- Not proven: the reporter's empty replies. They are likely the turns
after these failures and are not addressed separately.
太陽と向日葵 on magpie's Discord: Usage no longer shows what calls through
Devin cost. Two causes, both in what the list gives magpie:
- Every model went with a price of 0 (runtimeModel's cost), and magpie
falls back to models.dev, which has none of Devin's own models (SWE-2,
SWE-1.7 Lightning). Devin lists each paid model's price in
GetCliModelConfigs: field 32 of a config, one per "Input", "Cached input"
and "Output", a float32 in USD per "1M tokens". parsePrices reads it
(fields() now keeps a fixed32's bytes), and listed() gives an entry the
price its variants share, none when they differ. Read from Devin's own
response on 10-15: Opus 5.5 4/20 (cache 0.2), its fast run 8/40, SWE-1.7
Lightning 2.5/12.5, SWE-2 Lightning 1/5, GLM-5.2 1.4/4.4. The Free tier
lists none.
- Devin now files swe-2-high-, -medium- and -max-lightning under SWE-2 at
the High cost tier. A family was free only when every model under it
was, so swe-2 lost free (seen in the owner's plugin-providers.json on
0.1.17), and with it 0.1.16's rule that a used-up day and week don't hold
SWE-2. A family is now judged by the variants variantFor sends it as:
those at an effort and its default.
Run: HOME=<mktemp -d> bun test in packages/devin: 84 pass. prices.test.mjs
uses Devin's real GetCliModelConfigs bytes of 10-15, cut to 11 configs
(testdata/model-configs-1015.bin, no account data in it). Without the
index.mjs change: 3 of its 4 tests red. Broke by hand: the family's free
over every model again turns 2 red; cost back at 0 turns 1 red.
bun scripts/check.mjs devin: ok. Every price above checked by decoding the
full real response with a separate Python reader.
Not run: magpie end to end with this version (magpie reads a plugin's
price from its next commit on).
wyp's WorkBuddy AI requests worked for a while, then every turn failed as
"502 WorkBuddy AI: ECONNRESET: The socket connection was closed
unexpectedly". Measured on www.workbuddy.ai and copilot.tencent.com: the
front door answers a token it refuses with 401 only for a body up to
2097152 bytes. At 2097153 bytes and above it resets the connection with no
reply. With an accepted token, 20 MB bodies go through, and app errors
(400 11128) still come back on big bodies. So once a long Claude Code
session is past 2 MiB and the account's sign-in is refused, every turn is a
reset, and nothing about it is temporary.
Keep-alive reuse was ruled out: the server closes an idle connection with
a FIN at 60s, and Bun opens a new connection for requests at 59.99s and
59.995s.
When a chat over 2 MiB fails before any reply, the loader now asks the meter
(POST /billing/meter/get-user-resource-summary, 401 for a refused token) once.
On a 401 it returns that 401 with the reason and the remedy (sign in again,
in magpie or in the desktop app), marked kept like the plugin's other 401s.
Any other answer, a failed meter read, or an abort leaves the original
error. The chat is never sent again.
Run: HOME=<temp> bun test in packages/workbuddy: 97 pass (reset.test.mjs is
a socket fake of the front door that resets past 2 MiB). Broke it by hand
(unanswered rethrows at once): 3 of the 5 new tests go red. bun
scripts/check.mjs workbuddy: ok. Against the real endpoint in a sandbox
HOME: refused token + 2.2 MB body gives 401 with the message (0.1.23:
ECONNRESET); refused short chat gives the front door's HTML 401; good
token + 2.2 MB body gives 200. Not run: magpie's gateway end to end with
this version. Why wyp's token was refused is not yet confirmed.
checkIn() opened a fake over the one the test had already opened; closing
the second put the first's 127.0.0.1 origin back as trae-cn's hosts, so
global.test.mjs, run after it in one process, read a fake host. The
publish run for 2009f49 went red on it and 0.2.14 never reached npm.
checkIn now closes the fake before it opens another.
Ran: HOME=$(mktemp -d) bun test at the repo root: 1509 pass, 0 fail.
Broken by hand: without the close, `bun test ./ownclient.test.mjs
./global.test.mjs` fails "the realm's table is its own" (26 pass, 1 fail),
as the publish run did.
On one account Trae CN's desktop client's claim went through while the
plugin's, on a device id it had made up (digits(19)) with a hard-coded
brand and OS, came back 9074 every day (MiFaZhan on yetone/magpie#808;
aliceh1 on #1920, where Buddy Switch reads the local client). Now, for a
check-in (/trae/api/v2/ug/*) only, the account whose uid matches the
userId of this machine's Trae CN client sends the client's own device id,
the one Trae's device service registered: the digits in the client's
storage.json key iCubeAuthInfo://icube-dc:<id> (seen in real clients'
files, #808 and #1705). x-device-type and x-os-version are this machine's
(Windows' product name, else its build; elsewhere the kernel release),
and no brand is sent, as the client's fb leaves it out with no model.
The uid comes from the client's sign-in envelope
(iCubeAuthInfo://icube.cloudide), plain JSON or the client's fixed
AES-128-CBC codec, read as dingminhua/dsh-connect-trae (MIT) reads it;
only userId is looked at, the client's token is never used. The file is
only read, never written. Every other account keeps its own device; a
missing or unreadable file, one that can't be made out, a failed
integrity check, or zero or several icube-dc keys change nothing. No id
is made up, changed or rotated (the owner's ruling on #1705 stands).
Ran: bun test in packages/trae, 140 pass (11 new in ownclient.test.mjs);
bun scripts/check.mjs trae ok. Broken by hand: matching every account
instead of the client's uid fails "an account the client isn't signed in
as keeps its own device"; not passing the client's device to ugHeaders
fails the two matched-account tests. Tests never read this machine's
client (fake.mjs points ownClient.paths at nothing). Not tried: a real
Trae CN client or account (none here), so whether the claim now goes
through for the matched account is unproven; the Linux paths are guesses.
Cursor's Run (native) calls stay on one Cursor session across a tool result. With them, a tool that runs longer than Cursor's limit resumes stateless, not as a failed turn. The session pool lives in native-session.mjs. It applies to a conversation's first user turn, and a new user turn goes stateless (see the README). X-Magpie-Cursor-Continuity says which path a request took.
The dashboard-usage ledger counts two distinct events in one response that share a millisecond, as main did. Only timestamps claimed by earlier fetches are left out. A new deferred-usage test covers it.
Run at the reviewed head 398aeddc0186cfc38189b1f05577b181aa2d587d (merge base 5d5d86e; main has no packages/cursor change since):
- packages/cursor `bun test` 3 times: 258 pass, 0 fail each time.
- `bun test latency` 12 times with fresh HOMEs: 12/12 pass.
- Broken by hand: putting back `if (claimed.has(key + "\0" + ev.timestamp) || at >= before()) continue` makes the new test "distinct same-millisecond events in one response are billed together, not again on later fetches" fail (2 pass, 1 fail). The head's line passes.
- `bun scripts/check.mjs`: all packages pass.
- `npm pack`, extracted into a fresh dir: index.mjs, native-session.mjs, package.json, README.md. `import("./index.mjs")` exports CursorAuthPlugin and _internal, and native-session.mjs imports.
- CI: test and on-npm green.
Not tried: a real Cursor account. The owner's stored plugin sign-in has no access token. The author reports a real Claude Code run through an isolated gateway: a child resumed stateless after a 125s tool, and all 6 requests returned 200.
Adds @magpie-community/agent-type4me: Type4Me (macOS voice input) as a magpie agent. magpie writes the picked model, its /v1 address and Type4Me's key into ~/Library/Application Support/Type4Me/magpie-agent.json, which Type4Me reads before each dictation (joewongjc/type4me#343, merged). The folder is the one Type4Me and Type4Me Dev share (AppDataLocation.sharedProfileName).
Run at the reviewed head dc9d19bd: bun test packages/type4me (4 pass), bun scripts/check.mjs (green). Checked every field against magpie's agentplug.Desc and the file path, keys and folder against Type4Me's MagpieAgentFile and AppDataLocation.
Not done: the first npm publish of a new package name is manual (the package has no trusted publisher yet), and registry.json is not updated in this PR.
WorkBuddy serves a model at x0.00 (deepseek-v4.1-flash) with the account's
credits used up: hheei's account at 560 / 560 was still served it. The
usage read gave one Credits window over every model, so at 100% magpie's
routing ranked the account spent for its free models too: put behind every
other account, and moved off by conversation affinity.
The Credits window (personal and enterprise) now carries notModels: the
ids the account's live list (/v3/config) prices at x0.00. A model free only
some hours (a night promotion) still counts, as the list never says it is
free. A list that can't be read leaves the window as before. magpie reads
notModels as it does for Devin's and Cursor's windows (Limit.applies), so
For(free model) no longer sees the full window, and a 14018 on a paid model
rests only that model (Pooled), as PaidBesideFree already did.
Run: HOME=<temp> bun test in packages/workbuddy: 92 pass. Broke it by hand
(no notModels set): the two new usage tests go red. bun scripts/check.mjs
workbuddy: ok. Not tried against a real account at 100% credits; the
behaviour that free models are still served there is the reporter's.
Echoo, with Factory moved onto this plugin, got "API Error: 403 Factory:
Forbidden" from Claude Code on GLM-5.3-Flash, while Codex worked on the
same account and model. GLM is a chat model Factory serves on /api/llm/o,
so magpie translates Claude Code's Messages request into chat completions
(or Responses) before the plugin gets it. Only anthropicBody, the
/api/llm/a route, adapted Claude Code's fixed phrases Factory refuses (its
identity line, "You have been invoked in the following environment", "You
are powered by the model", update-config's "not Claude, so memory", tool
output quoting them). droidBody, for /api/llm/o, only added droid's line,
so all of them went to Factory as they were. The headers, the model and
the account are the same for both agents; Codex's prompt has none of the
phrases.
anthropicBody's per-text adapters are now functions of their own
(claudeIdentity, promptText, systemMessageText, userBlockText), and
droidBody applies them to chat completions and Responses:
- chat's first system message and Responses' instructions as a system
prompt; other system and developer messages as system messages;
- user text as a user block; a chat user string, where magpie joins a
turn's blocks with nothing between them, also reminder by reminder;
- chat's tool messages and Responses' function_call_output as tool output.
The Messages route is unchanged: the refactor kept every earlier test
green before the new code went in.
testdata/claude-code-2.1.300-glm-{chat,responses}.json are magpie's
translations of a real Claude Code 2.1.300 request, captured in a sandbox
HOME (paths changed to /Users/me, tools left out).
Run: bun test in packages/factory, 143 pass. With index.mjs at 0.1.28 the
new claude-chat.test.mjs fails 4 of 5 (the Codex one passes on both).
bun scripts/check.mjs factory: ok. Routed the captured request through the
plugin: each refused phrase is 0 in the chat and Responses bodies now, as
on /api/llm/a (1 each with 0.1.28).
Not tried against Factory itself: there is no Factory account to try with.
The reporter, on 0.1.7 with the public key, saw only Big Pickle, Space
Bunny Free and Muse Spark 1.3 Free: the three models the plugin knows
offline. Two causes:
- DOCS pointed at packages/web/src/content/docs/zen.mdx, which OpenCode
removed on 2026-10-12 (anomalyco/opencode#54761, "replace old Zen and Go
pages with V2 console docs"). It answers 404, so every discovery since
was partial. The endpoint table now lives in
services/www/src/docs/content/console/models.mdx; parseProtocolDocs
reads its rows as they are.
- A listed model the catalog (models.opencode.ai) didn't describe and the
docs didn't name was left out. When the catalog can't be read, that is
every listed model but the three in bootstrapProvider, which is the
reporter's list exactly. bootstrapProtocols is now a snapshot of the
console docs' free rows (2026-10-15), used under whatever the docs say,
and bootstrapProvider gains the catalog's metadata for Cat Jam, Step 5
Preview, LongCat 2.5 Preview, MiMo-V2.6-Flash and Nemotron 3.5
Lightning Free.
Not changed, on purpose: jev-1.13-free is a SystemOne decision model
(docs: endpoint /v1/systemone, no AI SDK package), which can't answer a
chat, so it stays out as SystemOne models always have. exo-free is
"deprecated" in the catalog and not in Zen's /models list now.
Tests (no network; the fixture server): "listed free models are offered
when the catalog and the docs can't be read" (catalog 503, docs 404,
listing big-pickle, step-5-preview-free, cat-jam-free, jev-1.13-free,
paid -> the three free chat models only) and "reads the console docs'
endpoint table, and Jev stays out as SystemOne" (literal rows from the new
page). Both fail on 0.1.7's models.mjs/provider.mjs (2 fail, 170 pass)
and pass with the change; bun test: 172 pass. bun scripts/check.mjs ok.
Real use (live Zen, public key, this checkout): discovery now lists
big-pickle cat-jam-free longcat-2.5-preview-free mimo-v2.6-flash-free
muse-spark-1.3-contributor-free nemotron-3.5-lightning-free
space-bunny-free step-5-preview-free, not fallen back (0.1.7: the same
eight with the docs 404 marking it partial). A request to cat-jam-free
through the plugin's fetch streamed 200; step-5-preview-free answered
Zen's own 429 "Upstream request failed: Endpoint is unavailable." twice.
The reporter's catalog failure itself wasn't reproduced from here.
7eleven, in ZCode on devin/gemini-4-argon, got every turn refused:
"Devin: There is an issue with this request, please try a different
model." (invalid_argument). It is the request content, on Gemini models
only. On a real account, gemini-4-argon, gemini-3-1-pro and
gemini-3-8-flash refuse a request offering a tool whose schema has, at
any depth:
- a list type: ["string","null"], ["string"], ["string","number"];
- type "array" with no items, items true, or items that are a list;
- properties with no type;
- an enum with no type.
claude-sonnet-4-6 and swe-2 take all of them. Nullable written as anyOf,
items {}, nullable:true, const, $ref/$defs, additionalProperties and
format all go through on Gemini.
geminiSchema rewrites them, for a Gemini uid only:
- a list type becomes its one type, nullable when it had "null", or
anyOf of each type;
- such an array's items become {} (a one-schema list becomes that
schema);
- a schema with properties gets type object;
- an enum gets its values' type, and an enum of mixed values is dropped.
The caller's schema is not changed. Claude and swe-2 requests are byte
for byte what they were.
What was run:
- HOME=$(mktemp -d) bun test packages/devin: 80 pass.
- gemini-schema.test.mjs, with the gemini line in build() turned off by
hand: 10 red, one per refused shape.
- bun scripts/check.mjs: ok.
- Real account: each refused schema, sent as built here, went through on
gemini-4-argon-medium and gemini-3-1-pro-high.
- build() end to end with a search tool holding a list type, an array
with no items and an untyped enum: gemini-4-argon called the tool, where
0.1.16 got invalid_argument. claude-sonnet-4-6 called it on both.
Not tried: ZCode itself against the plugin. The reporter's exact tool is
not known; ZCode's own zod 4 tools write anyOf, so it is likely one of
their MCP or plugin tools.
A <tool_call> block whose JSON wasn't whole ({"path":}) was reprinted as
text, and one the stream ended inside was flushed as text; either way the
turn finished "stop" with a 200, the call lost and nothing to fail over on.
Mirrors trae since 0.2.5 (#38): a block on its way to being a call (its
content starts with "{" or holds "<function=") that can't be read, or is
cut short at the end, ends the turn as an error: the stream with the error
frame and no finish, a request not streamed (or one with nothing before the
block) a 502. A block whose JSON (or XML function) is whole when the stream
ends without its close is still the call. A tag in a code fence or inline
code, or one that isn't call-shaped (<tool_call>incomplete), stays text.
Siblings: only trae (already fixed) and qoder parse calls out of the text;
grep for tool_call/function=/invoke/DSML across packages/*/index.mjs finds
no other parser.
Run at this head:
- textcall.test.mjs (new, the issue's literal frames: closed with bad JSON,
stream ends inside, readable control, whole JSON without its close, XML
form, look-alike text; streamed whole and 3 chars per frame, and not
streamed): 7 of 9 red on the 0.2.15 code (the control and look-alike
tests passed there), all green after.
- packages/qoder: 118 pass, 0 fail.
- Whole repo as CI runs it: HOME/TMPDIR in a scratch dir, bun test:
1320 pass, 0 fail; bun scripts/check.mjs: ok.
Not tried against a real Qoder account; the frames are the reporter's.
bun test runs every package's files in one process. opendesign's tests
set globalThis.fetch directly, and mock.restore() doesn't undo that, so
every file after it (minimax, trae, zcode, zen-free: 148 tests) got
opendesign's stub and failed. The publish run at 3db704a went red at its
test job, so neither dist nor npm ran. #84's review saw these failures
and wrongly put them down to load.
Run: `bun test packages/opendesign packages/minimax packages/zen-free
packages/trae/usage.test.mjs` with HOME in a temp dir: 234 pass, 0 fail.
Without this change: 34 fail.
New package @magpie-community/opencode-opendesign-auth 0.1.4, provider id `opendesign`: an Open Design Cloud account's Design Plan as a magpie provider (dbydd, #84).
Reviewed at this head (37ef688), as in the PR's last review: `HOME=<temp> bun test` for packages/opendesign, 19 pass; `bun scripts/check.mjs opendesign` ✓; the package loads under Node and Bun; `npm pack --dry-run` packs 5 files; a stubbed usage call sent its User-Agent to amr-api.open-design.ai only. The only hosts in it are amr-api.open-design.ai and amr-link.open-design.ai, with no install script, child process, or write outside OpenCode's auth store.
It no longer waits on its first npm publish: the publish workflow packs it onto the dist branch, and magpie 0.1.1243 and later install it from there until npm has it.
#130: a cancel that landed between the HTTP/2 head and runOnce's abort
listener left the Run streaming upstream with its heartbeat, for nobody.
#131: claimed/owed/flights are keyed by account and conversation, so one
account's Run no longer collects another's debt from its own dashboard.
Run at this commit: full `bun test` (isolated HOME) 1292 pass, 0 fail;
`bun scripts/check.mjs` ok. Version bump only.
Cursor's dashboard usage accounting is kept per account, not per conversation.
claimed, owed and flights were keyed by conversation_id alone. When one
conversation's steps ran on two accounts (magpie moving a session between
Cursor accounts), account B's Run collected A's debt from B's own dashboard:
B's own event was counted as A's earlier Run's usage (magpie_deferred) and
B's turn-ending step polled for a debt its dashboard can't have. The keys
are now sha256(token) + conversation_id (usageKey), used by collect, owe,
ledger and the flights cleanup alike. A token change starts a new identity,
as misses/unreadable already were keyed.
Reviewed at 19bbdf8d7162735d7ddafd015d8dfadbb233c3bd, then merged main
(ca6415f, #130) into the branch at 74578e51e4214b75056746aa81ecc8fcba104ed2;
the only conflict was the _internal export line (both openH2 and usageKey
kept). Diff against main unchanged (168+/34-).
- full `bun test` (isolated HOME/TMPDIR): at 19bbdf8 1267 pass/0 fail; at
74578e5 (with #130) 1292 pass/0 fail; `bun scripts/check.mjs` ok; PR CI
green at 74578e5.
- own test: A owes one Run on conv, the next step runs on B whose dashboard
shows B's own event. On main B's owed(true) returns B's event as A's debt
and polls B's dashboard; here it returns null with no request, and A later
collects its own event.
- broke by hand: usageKey back to conversation alone fails the three new
stepusage tests.
Not tried: real Cursor accounts. A conversation moving accounts leaves the
first account's collected-but-unreported carry under that account (expires
after owedFor) instead of reporting it on the other account's row.
A Chat cancelled while its Run opens is closed upstream, not left running.
Before, a cancel that landed after the HTTP/2 head arrived but before runOnce
subscribed to the signal was never seen ({once:true} listener added to an
already-aborted signal): the Run kept streaming upstream for nobody with its
5s heartbeat interval, and the session was never closed. open/openH2/openH1
now check the signal at each hand-off, close what arrived, and remove their
abort listeners; runOnce checks again before starting the heartbeat. HTTP/1's
write callback now waits for its BidiAppend, so backpressure and close see
the pending upload. A cancelled open answers 410 instead of 502.
Reviewed at a4e1db1b0d734c1a1b15c1fe0cafb0f9cb5313c0 (on main 5fc0a75):
- full `bun test` (isolated HOME/TMPDIR): 1288 pass, 0 fail (main: 1265/0);
`bun scripts/check.mjs` ok.
- own plugin-level test (fake HTTP/2 session, abort a microtask after the
200 head, upstream never ends): on main the request hangs, req never
closed or destroyed; at this head it answers at once, req closed once.
- broke by hand: dropping runOnce's aborted check fails "the plugin: head
abort ..."; reverting the H1 write callback to an immediate cb() fails
three openH1 append tests.
- checked: destroying the H1 Duplex with a write in flight emits no
'error' (bun and node); 410 "the request was cancelled" doesn't match
magpie's modelRetired words.
Not tried: a real Cursor account or a real proxy (offline fakes only).
c9cu on magpie v0.1.1239: "opencode muse 1.3 又不行了". Every free model
answered 403 FreeTierError "OpenCode's free tier can only be used from
within OpenCode" through 0.1.6 and magpie's built-in alike.
Found against the real upstream on 2026-10-15, with OpenCode 1.19.0's
own requests captured through a local proxy under a sandbox HOME:
- OpenCode now asks https://opencode.ai/inference/v1 (models.dev gives
it this URL). Its own captured request, replayed word for word, is
200 there and 403 at /zen/v1.
- Zen also refuses bash or read offered with no parameters, as the
stand-ins here were ({"properties":{}}); one property is enough.
Now:
- DEFAULT_BASE is the inference API. A request still sent to a model
listed at /zen/v1 is accepted and asked at the inference API.
- Each stand-in takes OpenCode's own first parameter (bash command,
read/edit filePath, glob/grep pattern), still "Never call this tool".
Run:
- bun test in packages/zen-free: 170 pass. With 0.1.6's provider.mjs
put back by hand: 13 fail (the 12 tool-guard tests on the stand-ins'
parameters, and the new inference-API test).
- bun tools-smoke.mjs against the real Zen: big-pickle,
mimo-v2.6-flash-free and muse-spark-1.3-contributor-free, streamed and
not, all 200 with a Bash call.
- npm shows 0.1.1 as latest: publish runs refused this package (no
Trusted Publisher), so 0.1.2 to 0.1.6 never reached users; 4ef68fb's
NPM_TOKEN path is what publishes this one.