provider: ZCode's mover min is 0.1.49, whose -Trial entry is no longer answered "quota exhausted" after a free-first refusal (Can4ry_ on X)

Can4ry_ on X: GLM-5.3-Flash-Trial answered "429 · ZCode's limited quota
for glm-5.3-flash is exhausted or temporarily unavailable" in magpie while
ZCode's own app was served. The plain GLM-5.3-Flash also kept going to
the Coding Plan after the Start Plan opened at 23:00. And there was no
freeFirst under Providers › ZCode.

zcode 0.1.49 (plugins 36a017a):
- A free-first gift refusal that isn't a quota answer (405/3012) now
  rests only free first's use of the model. Before, it shared the rest a
  -Trial entry obeys, so the Trial answered a local 429 without asking
  ZCode.
- The local 429 keeps the spent words last. 0.1.48 appended "(ZCode
  answered 429 …)" after them, so zcodeSpentWords didn't match and the
  account rested whole.
- free first is a switch, "Free quota first", in the provider's editor
  under Plugin options, just above Advanced (auth.options free_first,
  on by default).
keepMovedCurrent updates every moved user to 0.1.49.

The gateway test gets 0.1.49's rested wording, which rests the Trial
entry alone, and 0.1.48's, which rested the account.

Correction to plugins 36a017a's body: its old-code block-page test
fails because the old code has no `sidelined` map. Its second plain
request did not go to the gift again.

Run on mote, at this tree (rebased on origin/main 7aff42d86, run again there):
- go vet ./internal/provider ./internal/gateway
- go test ./internal/provider -run 'Mov|Migrat|Mover|ZCode|Zcode|Plugin',
  ok
- go test ./internal/gateway -run 'ZCode|Zcode', ok, both new subtests
  pass
- gofmt -l clean
- npm view --prefer-online @magpie-community/opencode-zcode-auth version
  says 0.1.49

Broken by hand: in the plugin (see 36a017a), the new tests against the
old index.mjs, 4 fail, the reported case among them (429 for 200).

Not tried:
- the full suite. mote is running other sessions' suites, and this
  change is one string in the mover plus test cases.
- a real move to 0.1.49.
- a real Start Plan refusal: the owner's account has no live gift.
- the editor's switch in a running app. It comes from host.js optionsOf
  and app.js pluginOptionsField, unchanged.
This commit is contained in:
yetone
2026-11-04 02:07:15 +08:00
parent 7aff42d863
commit e2d52b5012
2 changed files with 9 additions and 1 deletions
+8
View File
@@ -17,6 +17,12 @@ const (
zcodeFlashTrialEnded = `{"type":"error","error":{"type":"invalid_request_error","message":"ZCode has no active limited quota for GLM-5.3-Flash-Trial"}}`
zcodeTrialEnded = `{"type":"error","error":{"type":"invalid_request_error","message":"ZCode has no active limited quota for GLM-5.3-Trial"}}`
zcodeTrialSpent = `{"type":"error","error":{"type":"rate_limit_error","message":"ZCode's limited quota for glm-5.3 is exhausted or temporarily unavailable"}}`
// zcode 0.1.49's words for an entry it rests a minute after a quota
// answer: why goes in front, so the spent words stay last (Can4ry_ on
// X). 0.1.48 put "(ZCode answered 429 …)" after them, which these
// words didn't match, and the account rested whole.
zcodeTrialRested = `{"type":"error","error":{"type":"rate_limit_error","message":"ZCode said the last request for GLM-5.3 was over its quota, so it is not asked again for a minute: ZCode's limited quota for GLM-5.3 is exhausted or temporarily unavailable"}}`
zcodeTrialRested048 = `{"type":"error","error":{"type":"rate_limit_error","message":"ZCode's limited quota for GLM-5.3 is exhausted or temporarily unavailable (ZCode answered 429 to the last request for it, so it is not asked again for a minute)"}}`
// zcode.z.ai's edge firewall's block page, as the plugin's startBlocked
// puts it (windy_66454 on Discord, 10-31: "405 Method Not Allowed — the
// provider's network firewall blocked …"), and ZCode's risk control
@@ -44,6 +50,8 @@ func TestZCodeTrialRefusalRestsTheTrialAlone(t *testing.T) {
{"trial ended", "zcode", "GLM-5.3-Trial", zcodeTrialEnded, 400, false, false},
{"trial ended, still listed", "zcode", "GLM-5.3-Trial", zcodeTrialEnded, 400, true, false},
{"trial spent", "zcode", "GLM-5.3-Trial", zcodeTrialSpent, 429, true, false},
{"trial rested", "zcode", "GLM-5.3-Trial", zcodeTrialRested, 429, true, false},
{"trial rested, 0.1.48's words", "zcode", "GLM-5.3-Trial", zcodeTrialRested048, 429, true, true},
{"account quota", "zcode", "GLM-5.3", `{"error":{"type":"rate_limit_error","message":"quota exhausted"}}`, 429, false, true},
{"account quota 400", "zcode", "GLM-5.3", `{"error":{"type":"invalid_request_error","message":"quota exhausted for this account"}}`, 400, false, true},
{"account key", "zcode", "GLM-5.3", `{"error":{"message":"invalid api key"}}`, 401, false, true},
File diff suppressed because one or more lines are too long