As Qoder's 0.2.40 (axuhere on X: a free model held in a queue while
another provider could answer). When magpie says another account,
provider or routing group member follows this request
(x-magpie-fallback: 1), a 429 with queue-status: queued isn't polled
for up to 5 minutes: the trace leaves the queue (DELETE, as giving up
does) and the plugin answers 503 with the queue's retry-after,
"CodeArts queued the request; try again in 20s", so magpie asks the
next. The header is read and dropped before anything is signed or sent.
Without it, the wait is as before.
Run: packages/codearts `bun test` (115 pass) and `node --test
index.test.mjs` (115 pass); `bun scripts/check.mjs` all green.
Broken by hand: index.mjs as before: the new test red (it waits in
the queue instead).
Not tried: a real CodeArts account queued live; the 429 headers are
the shape the existing queue tests use.
CodeArts turned away ZCode's android emulator MCP tool,
mcp__plugin_android-emulator_android-emulator__android_discover_project
(71 characters), with "Function name [...] length over limit, maximum
is 64 (InferHub.001001017.413)", so every ZCode chat with that MCP on
failed.
A name over 64 now goes as magpie's FlatName cuts one: its first 55
characters, "_" and 8 hex of its SHA-256 (64 in all). It is cut in
every place the body names a tool: tools, functions, tool_choice,
function_call, the history's tool_calls and a tool message's name, so
the history keeps matching its tool on every turn. A cut that equals
another tool's own name, or another cut, is cut again with a salt. The
answer gets the agent's names back: in a folded (non-streaming) reply
and in the stream, where a name the gateway sends whole, repeated in a
later delta, or in pieces (the part past 55 held until the name is
whole) is put back. Events that name no cut tool pass byte for byte,
and a body whose names all fit is not touched at all.
Run: packages/codearts `bun test` (114 pass) and `node --test
index.test.mjs` (114 pass); `bun scripts/check.mjs` all green. New tests
use the reporter's literal tool name, two names alike for 55
characters, a short tool named exactly like a long one's cut, a stream
round trip through the loader's fetch (whole name, name in three pieces
across the 55th character, a name that fits), a gateway repeating the
name, and a folded reply.
Broken by hand: restoreToolNamesInStream returning the stream as it
came (stream and repeat tests red); no salt on a collision (collision
test red); no shortening in prepareChatBody (4 tests red).
Not tried: a real CodeArts account (its refresh token is single-use, so
no live sign-in was copied into a sandbox); whether CodeArts ever sends
a tool name in pieces (handled, not seen).
creditFetcher put the check-in 52s after a sign-up taken from the wall
clock, so in the last 52s of a Beijing day it fell on the next day and the
usage test read runsOut 4000, not 5000. The sign-up is now noon in Beijing
of the same day, so the check-in a minute later can't cross midnight.
Test only; the plugin is unchanged, so no version bump.
Run: bun test packages/codearts under TZ=UTC, Asia/Shanghai and
America/Los_Angeles (sandbox HOME): 109 pass. The new guard test (now 30s
and 1ms before Beijing midnight, at it, and at noon) is red with the old
fixture (1 fail) and green with the new. bun scripts/check.mjs codearts: ok.
The follow-ups from #284's merge review and fixes since: credentials are
signed only for snap-access.cn-north-4.myhuaweicloud.com and
opengw.developer.huaweicloud.com (one signFor every signed call passes),
and no signed or token request follows a redirect (redirect: "error" set
after the caller's init); a callback without a code fails at once and the
callback path is matched as sent; one renewal per refresh token per
account, and a transient renewal failure keeps the sign-in (503, kept);
the free model's TPM limit inside a 200 is a 429, not an empty reply;
benefit claims across Beijing midnight; Content-Length dropped from a
reshaped body; bounded queue polls that leave the queue after failed
polls; a busy callback port is retried. A check-in re-confirms only a claim
this plugin made and failed to confirm (kept for its Beijing day in the
account's state and the ledger's _unconfirmed key); a claim answering
id: null is never confirmed, as the IDE does.
Earlier review at cb14faf asked for three changes (re-confirm of id:null
claims, redirects carrying the security token, a test for leaving the
queue); 1c04a71 and 2447c5f answer them.
Run at the reviewed head 2447c5f9a118098e05439f96b1ff87a9bedc8d83, on
macOS, bun 1.4.2, node 24:
- packages/codearts: bun test 108 pass, node --test 108 pass.
- Whole repo at the head: 2033 pass, 0 fail; merged onto main a20c1b9:
2075 pass, 0 fail; bun scripts/check.mjs ok both times.
- Red without the change: the head's tests against cb14faf's index.mjs
fail 5, against main's (0.2.0) fail 24.
- Broken by hand: dropping redirect: "error" after the init spread fails
"a 3xx is never followed"; re-confirming any CLAIMED item fails the two
check-in tests.
- Harm read: no host beyond the two above and loopback, no .github,
dependency, eval or child process.
Not tried: a real CodeArts account (the author ran two through magpie).
codearts is not on npm yet (a new package needs NPM_TOKEN); magpie serves
it from the dist branch until an owner publishes its first version.
New package @magpie-community/opencode-codearts-auth 0.2.0 (Sakura-Natsu): Huawei Cloud CodeArts (码道) coding plans, with Huawei Cloud OAuth sign-in, request signing (SDK-HMAC-SHA256), a per-account cap of 3 in-flight sessions, per-account free/regular model lists, and requests signed only for https Huawei Cloud hosts.
Reviewed head 31099104 (two rounds; the first asked for changes at a793ca5, all fixed here). Run at the reviewed head, macOS, bun 1.4.2, with a preload that allows only loopback network:
- HOME=$(mktemp -d) bun test packages/codearts: 91 pass, 0 fail
- HOME=$(mktemp -d) bun test (whole repo): 2011 pass, 0 fail
- bun scripts/check.mjs: 21 ok
- 10 parallel bun test --rerun-each 40 in packages/codearts: 0 fail
- 22 hand breaks (signature, DPoP proof, 403 expired mark, session clamp, host check, per-account lists, callback server, refresh mark); 21 went red. The one green is the callback's prefix-path match (follow-up).
Not tried against Huawei's real API (no credentials); sign-in, signature acceptance, session counting and metering rest on the author's use on two accounts. Follow-ups: list the exact Huawei hosts instead of *.myhuaweicloud.com / *.huaweicloud.com; fail at once on a callback with no code; drop the unused ticketId; exact callback path match. This is a new npm name, so its first publish needs an owner.