zcode 0.1.26: a gift's -Trial models are listed when ZCode's config is out of reach, a failed gift read is asked again in a minute, and a card with no ZCode session says the gift needs one

bigsteven (Discord #feedback, 10-24): GLM Coding Plan spent, requests
go to it, and the model list has no GLM-5.3-Trial. Which sign-in the
account has is still asked; three ways the plugin drops a signed-in
account's -Trial entries, or drops them unsaid, are fixed here:

- ZCode's provider config out of reach (cdn-zcode.z.ai, 8s): the list
  falls back to the table and is marked magpie.fellBack, and magpie
  then keeps the list it was told last (internal/plugin/providers.go),
  from before the gift. The -Trial entries just read from the balance
  went with it. A list that carries trial entries is no longer marked.
- A gift balance read that failed was cached as "no gift" for ten
  minutes beside a good plan list, so one hiccup hid the -Trial
  entries and the gift's card section for ten minutes. It is now
  unknown and asked again in a minute (an expired session is known,
  and kept for ten).
- A key, or a sign-in whose ZCode session has expired (that token
  can't be renewed, and with a key beside it the account is never
  marked), reads no gift, so it lists no -Trial models, and the card
  said nothing. Its card now sets aside a line "ZCode gift plans
  (-Trial models) need ZCode's sign-in", with why in the display (an
  API key / no ZCode session / sign-in expired).

Run: HOME=<scratch> bun test packages/zcode: 102 pass (3 new tests);
bun scripts/check.mjs zcode ok.
Broken by hand: each of the three fixes reverted alone turns its
tests red (fellBack 1, retry 2, card line 1), restored after.
Changed on purpose: dual.test's "a gift read that fails at once still
trusts the plan list for ten minutes" now says a minute; usage.test's
key and key-only oauth cards carry the new line.
Not tried: a real account (no ZCode sign-in with a gift in this
session), nor a real CDN failure; the config fallback was forced in the
test through _internal.config(null). The new line's name is not yet in
magpie's i18n. A team-seat sign-in (an account with no plan of its own)
still lists no -Trial entries; not changed here.
This commit is contained in:
yetone
2026-10-24 17:04:32 +08:00
parent 9f6c4e8861
commit cc0bd902b3
6 changed files with 124 additions and 12 deletions
+13 -2
View File
@@ -57,7 +57,9 @@ over Anthropic's Messages API. Provider id: `zcode`.
Start Plan, ZCode 1024 Dev Day) are served to ZCode's own session,
which a key doesn't carry: for an account with only a gift plan, the
card and each refused request (1113) say to sign in with ZCode
instead.
instead. For an account with a GLM Coding Plan, the card says the
gift plans' `-Trial` models need ZCode's sign-in, since a key lists
none of them.
## Where the sign-in is kept
@@ -139,12 +141,21 @@ that fails, or lists nothing, adds no line at all, and a card that is an
error keeps its error. Claim the plan in the ZCode app (open it once);
the next read shows it as an ordinary gift bucket.
**No ZCode session.** A card read with a key, or with a sign-in whose
ZCode session has run out (it can't be renewed), sets aside a line named
"ZCode gift plans (-Trial models) need ZCode's sign-in", with why in its
display: such an account reads no gift and lists no `-Trial` entries.
Sign in again with ZCode to get them back. A gift read that fails
otherwise is asked again a minute later, not ten.
## Models
The models are the ones ZCode offers for the account's plan. They come
from ZCode's provider config: the release zcode.z.ai names, or an
installed ZCode's copy if that one is newer. The list is kept for 10
minutes. When the config can't be read, the plugin falls back to this list:
minutes. When the config can't be read, the plugin falls back to this list
(and magpie keeps the list it was told last, unless the account's gift
plans add `-Trial` entries, which are told as read):
| Model | Context | Output | Efforts |
|---|---|---|---|