ZCode answers 429 with code 3008 "user concurrency limit exceeded" or
3009 "model concurrency limit exceeded" when one account has more in
flight than its plan serves. Such a refusal is now asked again, the same
bytes, after 250ms, 500, 900, 1600, 2800 and 4000 (jittered); one that
outlasts the waits goes on as a 429 with ZCode's words and what they
mean (busyAnswer). spentUp no longer counts 3008/3009 as a spent gift.
maxConcurrency: 3 is declared on the auth hook and as
magpie.maxConcurrency, as a default magpie's per-account queue applies
and a user can raise; the plugin keeps no gate of its own.
By ANDY-JK. Reviewed at 8dc0b8dade49001b3a0e89b5e26fd674e8657694, applied
onto main bf8faa2 (no zcode change on main since the branch's base):
- TMPDIR/HOME sandboxed, Bun 1.4.2: bun test in packages/zcode, 134 pass,
0 fail; bun scripts/check.mjs exit 0.
- PR CI (pull_request run 40323330525, merge ref): test and on-npm green.
- Broken by hand: busy() out of spentUp fails "the cap's own codes are
not a gift spent"; cap forced false fails the retry and outlasts-the-
waits tests; busyAnswer replaced by the plain body fails the latter;
concurrency.test.mjs against main's index.mjs fails at import.
- magpie origin/main e7173958e: host.js concurrencyOf reads both
declared sites. failure() reads the cap refusal as "rate" both before
and after busyAnswer, so a cap that outlasts the waits still rests the
account a minute as before; the README's "instead of resting the
account" is corrected in a follow-up.
- npm had 0.1.31; this is 0.1.32.
Not tried: a real ZCode account (the author measured one Z.ai gift-plan
account through magpie's gateway, numbers on the PR).