An enterprise seat's /billing/meter/get-user-resource-summary answers with
no packages, so the card showed no quota. WorkBuddy's own usage page reads
/billing/meter/get-enterprise-user-usage (credit / limitNum, with the cycle's
start and reset in Beijing time). When the summary gives no credits, wbQuota
now asks that meter and shows a Credits window ("196.13 / 2000", resetting at
cycleResetTime). A personal account's refusal there (400 10001 "uid or
enterpriseID is empty", seen on a real WorkBuddy AI Pro account on
2026-10-13) is ignored and the card stays as before. A paid account with
packages never asks it.
Moved users get the same from @magpie-community/opencode-workbuddy-auth
0.1.19 (plugins 169e4e6, on npm); the mover's min is raised to 0.1.19.
Run: workbuddy_enterprise_test.go, built from the reporter's literal
response bytes. TestWorkBuddyEnterpriseCredits and
TestWorkBuddyPersonalNotEnterprise pass, and both fail with the fallback
taken out. go test -run TestWorkBuddy ./internal/provider passes. Not tried
with a real enterprise account; "credit" is read as used, which the
reporter is asked to confirm.
Also run, rebased on e1b70c13d: go test -tags nogui ./internal/provider
(the whole package, 430s) and go test ./internal/gateway -run WorkBuddy
pass under a sandbox HOME; gofmt clean; go vet for darwin, linux and
windows (-tags nogui) pass. The reporter's follow-up (04:27Z) saw
"Credits 218.67 / 2000" on the same enterprise account after reinstalling,
while get-user-resource-summary still answered empty Packages: the
reinstall installed the plugin's 0.1.19, which carries this fallback.
WorkBuddy answers an account it restricted for unusual activity with
403 {"code":11140,"msg":"request illegal","displayMsg":{"en":"Your
account has been restricted due to unusual activity",...}}. failure()
read it as an unknown failure, so the account rested 1-10 minutes and
was asked again, refused, all day.
What changed:
- provider: WBRestricted knows the refusal by code 11140 (top level,
data or error; number or string; whole, so 111400 isn't it) or by its
displayMsg words. wbExplain ends the built-in's error with
WBRestrictedHint.
- gateway: a new failRestricted ("restricted") rests restrictedRest, 2h:
one refused request per account per 2h, and a lifted restriction (or a
misread refusal) comes back the same afternoon; Unrest lifts it at
once. It is read from the hint in the error (restrictedSaid; both the
built-in and the plugin translate the vendor's body before failure()
sees it, so the raw JSON never reaches it in a chat try), or from the
raw body only for a WorkBuddy candidate (restrictedRefused,
isWorkBuddy), since another vendor's 11140 is its own. Bare "request
illegal" is not matched. 11128 stays promptRefused and rests nobody.
The stale-allowance shortcut skips it, as it does model refusals.
drawsWorkBuddy now uses isWorkBuddy.
- plugin: @magpie-community/opencode-workbuddy-auth 0.1.17 (plugins
caf3908) ends the error with the same hint; the mover's min is 0.1.17
so keepMovedCurrent brings moved users to it.
- gui: Routing labels the try "account restricted by the vendor", says it
rests because only the vendor lifting it brings it back and to appeal,
shows the hint translated, and the account's row has "The restriction
is lifted — try it again" (POST /api/gateway/unrest). en, zh, zh-TW, ja,
de.
- docs/subsystems/gateway-routing.md says the above.
Run: gofmt -l (clean); go vet darwin, GOOS=linux -tags nogui, GOOS=windows
on gateway, provider, gui; go test ./internal/gateway ./internal/provider
./internal/gui (ok). New Go tests use the reporter's literal body through
the vendor's shape, the built-in's and the plugin's, a string code and the
words alone; another vendor's 11140, a non-WorkBuddy account with the same
body, 11128/14018/111400 not restricted; an e2e through the fake plugin
host where the restricted account is skipped by the next request.
Broken by hand, each went red: rest case removed, restrictedSaid removed,
the match unscoped, the raw match removed, the provider hint removed.
GUI: routing-wb-restricted (chromium and webkit x en/zh/zh-TW/ja/de x
1100/420px, 20 pass), routing-wb-refused, i18n-keys; after the rebase
every GUI test of the Routing page (107 files, both engines): 103 green.
The 4 red ones fail the same in WebKit on origin/main 689edbd6b run
alone and are filed: group-member-info (#1745), routing-sessions
(#1307, #1672), routing-steady (#1804, passed on this head on a rerun),
routing-group-fold's group-of-eight (#1672).
Rebased onto 2c30e5cee (with #1672's test fixes) and run again: vet x3,
go test ./internal/gateway ./internal/provider ok. On the final base
5756651e3 (only GUI assets and READMEs changed since): routing-wb-restricted
20/20, routing-wb-refused, i18n-keys, routing-held-dot, mono-icon-redraw,
routing-sessions 38/38, routing-group-fold 40/40; routing-steady's WebKit
case red again, the flake filed as #1804.
Not tried against a real restricted account;
plugin users on <0.1.17 rest by minutes until their plugin updates.
What: for workbuddy-ai alone, a model whose id starts with glm- is listed
with ImageInput false (wbSite.textOnly), whatever /v3/config's
supportsImages says: in the list fetched, in the built-in list shown
before it, and in a list saved before this change (Provider.available).
The workbuddy movers' min goes to 0.1.16, where the plugin does the same
(magpie-community/plugins cb90931).
Why: checked on 2026-10-13 with the owner's real WorkBuddy AI account.
www.workbuddy.ai/v3/config marks every model supportsImages: true, but
its server takes the image out of a chat to glm-5.3-flash, glm-5.3 or
glm-5.2 and puts "[System reminder: the current model does not support
images. Content filtered. ...]" in its place. Its other models read
images, and WorkBuddy (China)'s glm-5.3-flash does too, so China and the
other families are left as the config says. A user's own answer in
Settings (ModelImages) still wins: entryFor applies it over the list.
Run:
- go test ./internal/provider (full, ok); go test ./internal/gateway
-run 'WorkBuddy|WB|Vision|Describ|Image' (ok).
- TestWorkBuddyAIGLMIsTextOnly fails with textOnly turned off by hand;
TestWorkBuddyAISavedGLMIsTextOnly fails without the models.go case.
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows.
- Sandbox gateway (own HOME, port 3486, built-in WorkBuddy AI login from
the owner's migration backup, nothing live written): /v1/models lists
glm-5.3-flash, glm-5.3, glm-5.2 as text, deepseek, kimi, gemini, gpt,
grok with image. A blue|yellow split PNG sent to glm-5.3-flash was
described by workbuddy-ai/deepseek-v4.1-flash (Routing kind "vision"),
and glm-5.3-flash answered "left: blue, right: yellow". With
modelImages {"workbuddy-ai/glm-5.3": true} in the sandbox settings,
glm-5.3 listed image again and glm-5.3-flash stayed text.
Not run: the moved (plugin) path through a sandbox app; the plugin's own
bun tests cover its list, and magpie maps its input.image as ImageInput.
What changed: every sign-in started in magpie now leaves through the
account's own proxy (ProxyOfLogin: the account's, else the
subscription's, else the global one). Before, the sign-in's token
exchange and checks went through the global proxy while the account's
later refresh and usage calls went through its own (ViaLogin), so the
vendor saw one account come from two exits.
- signin.go: SignInOptions{Site, Proxy, User}, StartSignInWith; the flow
picks its proxy (pickProxy, validated with settings.CheckProxy) and
every request goes through s.via. Each built-in sign-in (Claude,
Codex/ChatGPT, Grok, Zed, WorkBuddy, Copilot, ZCode, Factory, MiMo,
Qoder, Command Code, Kiro) uses s.via; Claude Code's own login gets the
proxy as *_PROXY (netproxy.EnvWith).
- proxy.go keepSignInProxy: a proxy picked for the sign-in is kept as
the subscription's when the account is its only one, else as that
account's own entry. "" (global) is refused while the subscription has
a proxy and other accounts, since nothing could keep it.
- plugin host: authorize and callback run under via.run(proxy), so a
plugin's sign-in fetches go through the same proxy; plugins_cli.go
does the same for `magpie plugins login`. PluginAPIKey goes through Via.
- gui: POST /api/signin and /api/plugin-signin take proxy and user.
What was run:
- go test -tags nogui ./... (sandbox HOME), all packages ok.
- gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui on the
touched packages.
- Red without the change (each broken by hand, then restored):
TestSignInGoesThroughItsProxy, TestDeviceSignInGoesThroughItsProxy,
TestPluginSignInGoesThroughItsProxy, TestClaudeSignInGoesThroughItsProxy
(internal/provider) and TestPluginSignInProxy (internal/plugin) each
fail with the s.via / EnvWith / via.run / keepSignInProxy removed.
Not tried: a real vendor account through a real proxy. The browser's own
leg of an OAuth sign-in goes through the browser's network, not magpie's.
Devin's CLI probes still use the global proxy.
8c0ffcc6 dropped a plugin account's kept usage reading when it signs in
again. The built-ins had the same bug: every sign-in and import keeps its
account through addLogin (Claude, Codex), addSideLogin (Copilot,
Gemini/Antigravity, Kiro, Devin, Grok, ZCode, Zed, Factory, MiMo, Command
Code, ChatGPT API), wbKeepSignIn (WorkBuddy, WorkBuddy AI) or qoderSave
(Qoder, Qoder CN), and none of them touched loginUsageCache.
forgetAccountCaches drops only the Usage page's cards, which are read
again through the same per-account cache, so for up to a minute both
LoginUsage and the Usage page showed the old sign-in's refusal for the
renewed account.
Those four store points now call StaleAllowance for the account under the
name it is kept by (codexName's, WorkBuddy's uid-suffixed name), after
loginsMu is let go, so every sign-in path and import is covered.
Tests, each red on origin/main and each red again with only its own store
point reverted:
- TestCodexSignInAgainReadsUsageAfresh: the browser sign-in twice,
/wham/usage 401 then 200 ("signed in again, but the usage is the old
sign-in's: ... Error:Unauthorized")
- TestFactoryKeyAgainReadsUsageAfresh: a key import, then a new key for
the same account ("... Error:Factory: Invalid API key")
- TestOwnStoreSignInAgainDropsTheReading/{workbuddy,qoder}
Run: the new tests at -count=3 and -race -count=3; go test -tags nogui
./... under a temp HOME with pinned caches, all ok; go vet and
GOOS=linux/windows go vet -tags nogui ./internal/provider.
The check-in only took the built-in's sign-ins, or the plugin's once WorkBuddy was moved onto it. A user who installed @magpie-community/opencode-workbuddy-auth while also signed in to the built-in (or who moved back) keeps the plugin under "workbuddy-plugin", which HandOver leaves as it is. Those accounts were never checked in, and their Usage card ("workbuddy-plugin") never got a check-in row, because withCheckins answered only for the card "workbuddy".
wbCheckinAccounts now adds the accounts of a plugin signed in under its own id, and each one remembers its card. withCheckins labels any card whose accounts it holds, by account name, or an unnamed card when it holds just one. An account signed in through both the built-in and the plugin (same uid) is checked in once and listed once.
Qoder has no check-in in magpie. It is a moved plugin subscription, so a check-in would have to come from the plugin, not the built-in.
TestWorkBuddyCheckinPluginUnderItsOwnID fails on the old code (only the built-in's Cat is checked in) and passes. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. Not tried with real WorkBuddy accounts.
Moody-Sin: the Routing page showed a WorkBuddy account as "已用 71%" only, which for a plan counted in credits says little. A quota window now carries its own count when the vendor counts in amounts — amount of limit, in unit (QuotaWindow, QuotaSpan for quota --json and /v1/magpie/quotas, and the routing trace's Weighed, from the window its share is of: Allowance.Count). WorkBuddy's built-in fills it from the resource summary, and @magpie-community/opencode-workbuddy-auth 0.1.8 tells it from auth.usage (amount / limit / unit, passed through host.js); the workbuddy mover's min is 0.1.8. The Routing page's stage and its list of what each account did, the Usage page's meter, the menu bar's tooltip and the TUI say "3,550 / 5,000 credits · 71% used", or "1,450 / 5,000 credits · 29% left" with Left on (积分 in Chinese); a window counted in shares alone reads as before.
quota-credits.test.cjs (WebKit, en/zh, used/left, Routing and Usage pages) fails on the old assets and passes; TestQuotaWindowCount, TestAllowanceCount, TestTraceTellsTheCount, TestPluginUsage (the count through the host) and TestWorkBuddyAccounts cover the Go side. Tried with the real WorkBuddy and WorkBuddy AI accounts in a sandbox magpie: moved onto the local plugin, /api/usage/quotas gives 33.29 / 3900 and 13.47 / 2250 credits and the Usage page reads "33.29 / 3,900 积分 · 已用 0.9%", "3,866.71 / 3,900 积分 · 剩余 99.1%" after a click on the count; not moved, the built-in gives the same for WorkBuddy. The Routing page with two real accounts of one provider wasn't tried (one account each). go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass.
copilot.tencent.com's gateway answers 10085 '请求不合法' to a request whose
User-Agent it doesn't know, so the resource-summary meter came back rejected
and the credits window stayed empty; every call to it — chat sign included,
not only billing — now goes out as WorkBuddy/<version>. And the meter sends
its capacities as JSON strings ('3300', '438.88000002'), which wouldn't
unmarshal into float64, so a wbNum type parses either a string or a number.
Verified against the live API (GET /console/accounts + POST
/billing/meter/get-user-resource-summary both 200 with the account's real
credits) from app.asar 5.5.6.
The get-user-resource-summary meter, unlike the older /v2/billing meters,
has no /v2 gateway prefix; WorkBuddy's own client asks it at
/billing/meter/get-user-resource-summary on both desktop and web. magpie
was asking under /v2 and would have gotten nothing, so no credits showed.
WorkBuddy (CodeBuddy Code's desktop app) keeps its signed-in session in
<shared data>/auth/workbuddy-desktop.info, plain JSON while credential
protection is off (its default); magpie reads that account, never writes
it, and skips it when the tokens are encrypted at rest. Further accounts
are signed in with WorkBuddy's own external-link flow (auth/state, then
auth/token polled until ready, then login/account) and kept in
logins.json. The plan is served OpenAI-compatibly at copilot.tencent.com
/v2 under the account's access token, with its id and domain in headers
(X-User-Id, X-Domain), exactly as WorkBuddy sends them; a near-expired
JWT is refreshed as WorkBuddy does, and a magpie-signed-in one's refresh
is written back beside it while WorkBuddy's own file is left untouched.
The models are its CLI agent's coding picks, and the credits come from
its resource summary as one window.
A card in Providers' subscription list signs in and shows the accounts;
the Provider is one of the account ids and joins the usage rollup.