Commit Graph
13 Commits
Author SHA1 Message Date
yetone cc3f000c6d qoder 0.2.48: a job token Qoder refuses as Login expired is renewed once and asked again (#474)
ahang39 (plugins#474): international Qoder answered dfmodel with 403
"Login expired" in bursts of ~16 requests over 2-5 minutes, about every
24h, shown by magpie as 401 "the sign-in lapsed". The report's times put
the burst's start where magpie's renewal came due (saved end less the
10-minute lead) and its end where the renewed pair was saved: Qoder
refused a job token the plugin still had as minutes from its end, and
nothing asked again with a renewed one. Why Qoder ended it early isn't
proven from the report.

- A chat's 401/403 now marks the failure lapsed. ask re-reads the saved
  sign-in under the refresh lock: a pair renewed meanwhile (another
  request, magpie's auth.refresh, another process) is used with no
  refresh; else the refresh token is spent once, the pair saved, and the
  request sent once more. A burst shares one refresh. A token this
  process renewed under 5 minutes ago that is refused too isn't renewed
  again, so a refusal not about the token's end doesn't churn refresh
  tokens; the 401 is said as before.
- A refreshed job token's end is read as an exchanged PAT's was:
  expire_time / expires_at (a date, or an epoch in s or ms) first, then
  expires_in, then a day. An end already past is ignored.

Run (mote, mote-run, HOME=$(mktemp -d), --timeout 60000; mote at load
20-28):
- packages/qoder: 320 pass, 0 fail.
- whole repo: 3129 pass, 1 fail: commandcode "a plan saved stands in
  for a subscription slow to read" (16.8s against its 3s bar), passes
  alone 13/13, filed as #475.
- bun scripts/check.mjs: ok.
- lapsed.test.mjs on the old index.mjs: 8 of 9 red. The 9th (magpie's
  own renewal begun during the refusal) was rewritten after that run and
  not run against the old code again.

Not tried: a real international Qoder account at the moment its token
is refused; the fake Qoder (refusal body {"message":"Login expired"},
single-use refresh tokens) is built from the report's words only.
2026-10-29 10:59:24 +08:00
yetone c0a0fd1955 qoder 0.2.45: a free account with no credits shows none left, not nothing
Ariel on Discord: an international free Qoder account signed in fine but
showed no credits. A free account (userType personal_standard, Qoder's
"Experience" plan) has a plan pool of 0 and, until it gets add-on credits,
nothing else. parseUsage drops every pool whose total is 0, so such an
account came out with no window at all and magpie had nothing to show.
Qoder's own client (Qoder.app's buildUsageItemGroups) shows every pool
present, 0/0 included, and counts the account out of credits when what the
pools have left adds up to 0. Now, when no pool gives a window and the plan,
add-on or shared pool reads a total of 0, the account has one "Credits"
window, "0 credits left", used up. A pool that can't be read (a string
total) or no pools at all still say nothing. An account with credits in any
pool is shown as before (the owner's free account: plan 0, add-on 7 / 600,
one Add-on window, unchanged). Same parser for qoder-cn.

Run: HOME=$(mktemp -d) bun test in packages/qoder on mote (299 pass) and
bun scripts/check.mjs qoder (ok).
Broken by hand: the new test against origin/main's index.mjs, red (it reads
no windows).
Read-only real read of the owner's intl account's /sash/api/v2/me/usage
for the envelope's shape (personal_standard, usageType credits, plan 0/0).
Not tried: Ariel's own account; the fixture is the owner's free envelope
with the add-on pool at 0 or absent, since the owner's has add-on credits.
2026-10-28 12:34:33 +08:00
yetone 202ec68ffd qoder 0.2.44: a spent plan beside add-on credits left is no account used up (#454)
chansee97's Qoder CN trial had its plan's 300 credits spent and 245 of
1,100 add-on credits used, and Routing read the account as 0% left: each
pool was a window of its own, and routing counts the tightest. Qoder spends
the pools one after another before an account stops (docs.qoder.com/Credits:
soonest to expire first, the plan's before add-on on the same day; teams:
then the organisation's shared add-on credits), and its own envelope's
totalUsagePercentage counts them as one. So when more than one of the plan,
add-on and shared pools holds credits in the same unit, "Total credits" is
what they hold together (545 / 1400 here, 61% left) and the one routing
counts, and each pool is shown beside it set aside, as CodeArts' buckets
are under its total. One pool alone is shown as before. Dedicated packages
are left as they were (no word from Qoder on their order).

Run: bun test in packages/qoder (298 pass) and scripts/check.mjs, on mote.
Broken by hand: the new tests against origin/main's index.mjs, red (#454's
reads 0% left; the rotated-token test's windows differ).
Read-only real read of the owner's Qoder account's /sash/api/v2/me/usage:
plan total 0, add-on 7 / 600, which stays one window, unchanged.
Not tried: a real account with both a plan and add-on credits (the owner's
has no plan credits); the fields are the ones that read returns.
2026-10-28 10:29:31 +08:00
yetone 4af310cc57 qoder 0.2.24: Qoder's 400 "Error in upstream response" is a 502, so magpie retries or falls back (SlouchyQuill507 on Discord)
SlouchyQuill507 (Discord, qoder-cn) reported Qoder failures of the model's
own vendor, "Error in upstream response", reaching magpie as a 400 invalid
request: the client's fault, never asked again or of another account.
failure() now maps a message saying "Error in upstream response" to a 502
(no X-Magpie-Sign-In, the account untouched), after the queue, quota and
request codes, so a 400 with one of Qoder's request codes (406, 416, ...)
and any other 400 stay 400. It covers an HTTP 400 and a 400 in the
stream's statusCodeValue envelope, JSON or plain text. magpie still tells
an overflow that fails this way apart by its size (tooLongUnsaid takes 502
as well as 400).

Test: usage.test.mjs "Qoder's 400 \"Error in upstream response\" is a
502" - fixtures from the reported literal text, four shapes through the
loader's fetch, plus genuine 400s kept. Red on the old index.mjs (400 for
each), green with the change.

Run on origin/main 6fd976a: TMPDIR=<scratch> HOME=<scratch>/home bun test
(whole repo) 1919 pass 0 fail across 173 files; bun scripts/check.mjs ok.
2026-10-21 01:52:42 +08:00
Euraxluo 3edbb18510 qoder 0.2.19: a model list that can't be read is a 502, so magpie falls back (#249)
A failed read of Qoder's model list during a chat (DNS, timeout, an HTTP
refusal) now answers 502 instead of 400, so magpie retries and falls back to
the next member of a group instead of ending the request. A lapsed sign-in
met on that read answers 401 with the sign-in mark, as the chat path does.

Run at the reviewed head fcdf173e1 (on origin/main ff13aac):
- bun test packages/qoder: 139 pass, 0 fail
- bun scripts/check.mjs qoder: ok
- with index.mjs put back to main, the two changed tests go red (2 fail)
- magpie's passing() retries 502 and falls back (internal/gateway/fallback.go);
  no magpie parity test pins the old 400
2026-10-19 19:47:00 +08:00
yetone aa2d99bd13 qoder 0.2.12: a chat Qoder refuses (401/403) keeps Qoder's own reason in the error
Yayoi_no_yume on X: a request made right after signing in came back
"Qoder: the sign-in lapsed — sign in again" (401), and only installing and
signing in to Qoder CLI made it work. failure() replaced whatever Qoder said
with that fixed text, so the real reason for the refusal could not be seen.
The message is the same, with "(Qoder said <status>: <its message>)" added
when Qoder gave one; the account is still left unmarked (X-Magpie-Sign-In:
kept), as before.

usage.test.mjs gains the case (a 401 whose body says why); it fails on
0.2.11 and passes. bun test (89 pass) and scripts/check.mjs qoder under a
scratch HOME pass. Not tried against Qoder itself (no Qoder account here),
so the cause of the reporter's 401 is not known yet.
2026-10-10 01:10:39 +08:00
yetone e2c72b2ae7 qoder 0.2.2, workbuddy 0.1.6: each model's credit rate goes to magpie (rate, rateWas), as magpie's built-ins read it (yetone/magpie 33acb6bc, v0.1.667)
magpie now shows each model's credit rate in the provider's model list and an agent's picker (01huadalang on Discord: pick the cheap models without opening Qoder or WorkBuddy); a plugin gives it beside free on each model its provider.models hook lists. Qoder and Qoder CN: rate is the price_factor (priceFactor); rateWas an active promotion's before_promotion_price_factor, else an original_price_factor above the price (Qwen3.8-Flash: 0x, 0.1x struck through); a promotion's 0 that isn't free is its price before times its discount_factor; a listing with no price gives none — the rule of internal/qoder/models.go's ModelInfo.free. WorkBuddy and WorkBuddy AI: rate is the model's credits ("x0.03" is 0.03; x0.00 stays free; an unreadable, negative or infinite rate is neither free nor rated), as wbCredits reads it.

usage.test.mjs in each package gets a test fed a fake listing / fake /v3/config (the cases of core's TestParseModelsRate and TestWBCreditsRate); both fail against the previous index.mjs and pass now. No request was made to Qoder or WorkBuddy. bun test (HOME a temp dir) and bun scripts/check.mjs pass.
2026-10-02 22:54:55 +08:00
yetone 6fd444cf5b qoder 0.2.1: a model is free only at a price_factor of 0 — Qwen3.8-Max, 0.5× with an off-peak discount, is no longer marked free
Qoder's listing (as it came on 2026-10-02) carries is_free true on Qwen3.8-Max, whose price_factor is 0.5 and whose promotion is the off-peak 60% off (错峰 4 折, rule idle_time_model_credit_discount, before_promotion_price_factor 0.5); Qoder's own app ignores is_free in the model picker and shows 0.5×. freeOf took is_free true OR a price_factor of 0, so Max came out free. Now the price decides, as Qoder's app shows it: a price_factor (priceFactor) of 0 is free — Qwen3.8-Flash, 0× with original_price_factor 0.1 struck through, stays free — any other price is not, whatever is_free says, and a 0 that lasts only while an active promotion with a price before it runs is a discount, not free. is_free is read only from a listing that gives no price at all.

usage.test.mjs's new test feeds the listing's own entries (Max, Flash, Qwen3.7-Max, Kimi-K3) and promotion shapes; it fails against 0.2.0 (Max free). The built-in (internal/qoder/models.go, ModelInfo.free) has the same is_free || price 0 rule and needs the same change on magpie's side.
2026-10-02 21:50:13 +08:00
yetone 083251d778 qoder 0.1.4: a job token refresh Qoder refuses while listing the models marks the account, as the built-in's model read through QoderCredentialOf did — the models hook throws with signIn: expired on a 401/403 refresh and falls back to the listed models on any other failure; a renewal made while listing is said renewed by the account's next usage read or answer, and the refresh errors read 'qoder job token refresh' as the built-in's did. Four new tests in usage.test.mjs fail against 0.1.3. 2026-10-01 06:53:59 +08:00
yetone 01aee5da28 all: a usage read says what it means for the sign-in, and a renewal clears the mark whatever follows, as the built-ins did (要保证插件跟内置的所有逻辑都要一模一样) — auth.usage returns signIn on every path: expired where the built-in's quota read marked the account (Zed's /users/me 401, Factory's and MiMo's refused renewals, Qoder's refused job refresh), renewed after a renewal, which took the mark off, kept everywhere else, so magpie no longer guesses from the words 'sign in again' (Kiro's, Devin's and ZCode's usage errors marked accounts their built-ins never did) nor clears on a clean read. A request after a renewal says renewed on any status; one without says kept, as the built-ins cleared only on renewal. Kiro, Cursor, Devin, Command Code, WorkBuddy, Grok and ZCode, whose built-ins never marked an account, say kept on every answer. New tests fail against 85d7dd0's index.mjs. 2026-10-01 04:53:29 +08:00
yetone 85d7dd0d0a all: each plugin fails with its built-in's status and marks the sign-in as it did, through X-Magpie-Sign-In (要保证插件跟内置的所有逻辑都要一模一样) — Factory's and MiMo's refused renewals are the built-ins' 502 marked expired, not 401s; Qoder's vendor 403 is the built-in's 401 kept, its model list's failure a 400, its job refresh refused marked expired; Zed's retried 401 is a 401 kept, not a 403; Kiro's unreachable refresh a 401 kept; Cursor's expired trial a 401 kept; a vendor 401 WorkBuddy, Grok, Devin, Command Code and ZCode passed on no longer marks the account, as their built-ins never did, and Grok and MiMo no longer retry what their built-ins sent once. Messages take the built-ins' words. New tests fail against the previous index.mjs. 2026-10-01 04:47:03 +08:00
yetone eab92c33a0 qoder 0.1.2: a chat Qoder refuses with a 403 stays a 403, only its 401 (the job token refused) is the 401 magpie marks the account lapsed on; a model the listing marks free (is_free, or a price_factor of 0, snake or camel case, as internal/qoder/models.go reads it) is marked free; errors no longer start with "Qoder: ", which magpie adds 2026-10-01 03:16:04 +08:00
yetone 4dd783a2c0 qoder 0.1.1: usage shows as magpie's built-in did — plan, period, windows and what they count, balanceqoder 2026-09-30 23:03:10 +08:00