4794de398ea8337d223a91e207181c56fcf4ad76
957
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ab1006bb80 |
gui: each WorkBuddy, Trae CN, MiniMax, Qoder or plugin account's daily check-in can be turned off on its own (#1902, magicLaLa)
settings.CheckinOff lists the accounts left out, by their entry in the
vendor's check-in file ("workbuddy|<uid>", "trae-cn|<uid>", a plugin's
"<provider>|<account>"). checkinNow skips them, both in the loop and on
Check in now. provider.CheckinAccounts() lists every account a check-in
reaches; /api/settings carries it as checkinAccounts, and
POST /api/settings/checkin-account {key,on} turns one off or on. A full
/api/settings save keeps the list. Settings shows an Off/On switch per
account under each vendor's Daily check-in row when it has 2 or more
accounts; the Usage card says "Auto check-in is off for this account" and
offers no Check in now for it. en, zh, zh-TW, ja, de.
Run (on 63a361b5f's tree, then targeted again on
|
||
|
|
d6fd9b3a36 |
provider, agent, gui, cli: Codex can switch only its own sign-in between accounts, never through the gateway (#1907, foobra)
foobra wants Codex Desktop and the CLI kept on their own ChatGPT subscription, moved to the next saved account when the signed-in one is used up and back when it resets, without magpie's gateway in the way. magpie already did the switch (codex_switch.go: 98%, 100% In order, back under 90%, unknown usage never switches), but with more than one Codex account on it also wrote openai_base_url into config.toml so a refused request fails over through the gateway (codexFailover). There was no way to have the first without the second. Now Codex's subscription has SwitchOnly (providers.json "switchOnly", opt-in, off by default so nothing changes for anyone who doesn't tick it): - provider.SetSwitchOnly / provider.SwitchOnly; only Codex's own subscription takes it. An unreadable providers.json reads as on, so magpie's own failover is never written on a guess. - agent.codexFailover is false when it is on: no openai_base_url, no failover note, no magpie models in Codex's list. A base URL the user wrote stays. - The account Save copy keeps it. - GUI: "Only switch Codex's sign-in" tick under Providers > Codex's accounts (with more than one on), posting provider/switchonly; the Agents row's failover title points at it. zh, zh-TW, ja, de. - CLI: magpie accounts switch-only codex [on|off]. - docs/reference.md and providers-accounts.md say what it does and that an open Codex app or app-server stays on its account until reopened. Run (darwin, sandbox HOME, -tags nogui): - go test ./internal/provider -run 'TestCodexSwitchOnly|TestCodexSwitchedWhenUsedUp|KeepLogin' - go test ./internal/agent -run 'TestCodexSwitchOnly|TestCodexFailover|TestCodexOwnModelThroughMagpie|TestCodexHandWritten' - Broken by hand, each red: codexFailover guard removed (agent test), SwitchOnly dropped from the Save copy, SwitchOnly reading false on an unreadable file (provider test), the tick drawn unticked (GUI, 16/16). - GUI: switch-only (new), keep-login, agent-failover, gui-ja, gui-de, gui-zh-tw in Chromium and WebKit, en/zh/ja/de at 1100 and 420: 77 pass. - The built binary's `accounts switch-only` in an empty sandbox HOME: reads off, refuses on with no Codex provider, refuses claude. - gofmt -l clean; darwin go vet. Reviewed and rerun after rebasing onto |
||
|
|
b68377dae7 |
provider: Antigravity's retired 2.5 Flash models are named for themselves, not "Gemini 3.5 Flash Lite" (#1918, kchen0x)
What changed: Antigravity's fetchAvailableModels gives gemini-2.5-flash, gemini-2.5-flash-lite and gemini-2.5-flash-thinking the displayName "Gemini 3.5 Flash Lite" and the tagDescription gemini-3.5-flash-lite (checked on the owner's account, 2026-10-13). magpie showed three buttons of that name and the same name in /v1/models and the quota windows. When several models share a name, one whose tagDescription names another family is now named from the catalog, or by its id. A model tagged with its own family (the effort levels of one model) keeps the shared name. Run: go test ./internal/provider/ (ok). TestAntigravityRetiredModelNamedForItself is built from the reporter's JSON plus two effort levels of one model; with the renaming removed it fails (both 2.5 models "Gemini 3.5 Flash Lite", two models read the same). gofmt -l clean; go vet -tags nogui on darwin, linux and windows. |
||
|
|
8e6354714f |
provider: OpenCode Zen's free models answer again, with a session id OpenCode itself could have made (c9cu on Discord)
c9cu (v0.1.1222, Pi, a group routed to OpenCode Zen's muse-spark-1.3-contributor-free on /v1/responses) got 403 FreeTierError "OpenCode's free tier can only be used from within OpenCode" on a setup that worked the day before. Zen now reads x-opencode-session as OpenCode's identifier.ts lays an id out (12 hex of ~(Date.now()*0x1000 + counter), then 14 base62) and refuses one whose counter isn't small. magpie's built-in sent a sha256 of the conversation cut to that shape, so its counter was anything. The zen-free plugin hit the same (#100 on magpie-community/plugins, 0.1.5); the built-in had the same code. Header diff against the real upstream, same request with curl: - magpie's ses_e9283da055b15JwOAra76bwUx4 (hash): 403 on /v1/responses and /v1/chat/completions. - ses_ecc5d8f28ffe9Cy14V8Em7lI2u from a real OpenCode 1.19.0 run, the old opencode/1.18.34 UA unchanged: 200 on /v1/responses. So it is the session, not the UA or the endpoint; muse-spark is still served on Responses (Chat answers 400 ModelProtocolUnsupported, as before). Now (opencode_client.go): - openCodeSession makes a real descending id from the current time and a per-millisecond counter, kept per conversation (the last 1000) so a conversation's turns share one session; one OpenCode could have made is passed on unchanged, a hash-shaped one is not. - x-opencode-request is an ascending msg_ id the same way. - the session also goes in x-opencode-session-id, x-session-affinity and X-Session-Id, as OpenCode's packages/core/src/session/ model-request.ts sends it, and the User-Agent is OpenCode 1.19.0's (opencode/1.19.0 ai-sdk/provider-utils/4.0.23 runtime/bun/1.3.14, the latest on npm, as the plugin captured it). - Kilo's task/session id goes through the same openCodeSession (the Kilo CLI is OpenCode's fork and makes ids the same way). Run: - Through an in-process gateway under a sandbox HOME against the real opencode.ai/zen with the public key: muse-spark-1.3-contributor-free on /v1/responses with reasoning xhigh, streamed and not, big-pickle streamed on Chat, mimo-v2.6-flash-free on Chat: all 200 "pong". The same file on origin/main's code: all 403 FreeTierError, the reporter's message word for word. - TestOpenCodeSessionIsOpenCodes, TestOpenCodeSessionsKeptBounded and TestOpenCodeClientHeaders (now with a real 1.19.0 session) fail with the hash put back by hand. - gofmt -l, go vet (darwin, GOOS=linux, GOOS=windows -tags nogui) on internal/provider and internal/gateway. - go test -tags nogui -count=1 ./... under a temp HOME on base |
||
|
|
488569227e |
zhipu: a GLM Coding Plan key at the pay-as-you-go endpoint is asked again at the plan's, and the provider moves there
@cleverpigo on X: "glm coding plan放在codex/chatgpt里显示余额不足没法用". The editor
showed OpenAI https://open.bigmodel.cn/... red with 429 · 余额不足或无可用资源包,
请充值。 next to a green Anthropic https://open.bigmodel.cn/api/anthropic.
Root cause: the zhipu and zai presets start on their first region, Pay as
you go, whose OpenAI URL is /api/paas/v4. The Anthropic URL is the same in
both regions, and it bills the Coding Plan when the account has one. So a
Coding Plan key left at the default works in Claude Code, while Codex goes
to /api/paas/v4 and Zhipu answers 429 code 1113 (no balance). A provider
made by pasting the paas/v4 URL hits the same wall. Nothing in the key
says which kind it is. LESSONS.md's
|
||
|
|
26465bc017 |
provider, gui: oMLX's decision API moves with its Server address (#1165, #1641)
Since #1641 main fills an oMLX provider's empty Decide with its Chat URL in Normalize, so a provider saved before #1165 has a localhost Decide. #1165 moved Chat, Responses and Anthropic to the new Server address but left Decide behind: System One's decisions kept going to the old localhost port after the address changed. atAddress now moves Decide too, in the provider package (local_address.go) and in the editor (addressFrom/movedURLs in app.js), and the decide-url field follows the address while the user hasn't typed their own; a Decide the user typed is kept. Tests: provider TestProviderAtAddress asserts Decide moves; gui TestProviderSaveLocalPresetAtItsURLs expects oMLX's Decide moved and the others empty; local-address.test.cjs checks the saved decide, that the decide field moves, and that a typed https://jev.example/v1 survives a second address change. Run at this commit's tree on origin/main: gofmt; go vet darwin, GOOS=linux -tags nogui, GOOS=windows; builds for all three; go test -tags nogui -p 4 ./... green. GUI: local-address 11/11 in chromium and in webkit; local-address, azure-endpoint, gui-zh-tw, gui-ja, gui-de and system-one together 43/43. Broken by hand: without Decide in local_address.go the provider test goes red; without decide in addressFrom local-address goes 0/11. Not tried: a real oMLX server. |
||
|
|
79099d6adb |
provider, gui, tui: Ollama, LM Studio and oMLX take an address, so a server on another port or computer is the preset's provider (#1165)
The three On this machine presets were pinned to localhost and their default port: one started on another port, or on another computer on the LAN, had to be rebuilt as a custom provider or typed URL by URL in the CLI. They now take an Address (scheme, host and port), and each of their URLs keeps its own path there (provider.AtAddress, AddressOf; no scheme means http, only http/https, port 1-65535, a pasted path is dropped, anything else refused with nothing changed). - GUI: the add and edit editors have a Server address section under the key, folded unless the saved address isn't the preset's, opened and focused on a refused one. The Endpoints, Test and Refresh follow what is typed; URLs are sent only when the address changed, so ones set apart (an import, the CLI) are left alone. zh, zh-TW, ja, de. - TUI: adding a local preset asks for its address before the key (Enter keeps the default), and w edits it. - CLI: the usage shows provider add ollama url=... anthropic=.... - LM Studio's and oMLX's notes say "port N by default". timonwong's PR head e63cf18e, merged onto main, which had given oMLX a decision API (#1641) since: presets.go keeps main's oMLX Decide; app.js keeps both the Vertex block and the address one; the docs row and -run list take both. Run: see the next commit. |
||
|
|
12d823211e |
provider: a multi-protocol provider's model catalog keeps every endpoint's models (#1006)
* provider: a multi-protocol provider's catalog is the union of every endpoint's models A provider whose protocols sit at bases of their own kept only the first list that answered, so the models of every other endpoint were nowhere in the product: not in the agents' model lists, not in the catalog the routing and the per-model preferences read, and not fixable by pinning a model's protocol, which setModelAPI refuses for a model the provider does not list. nyownm reported it as #904 and worked around it with one provider per protocol. fetchOne now asks every endpoint the provider speaks and merges the lists by model id, the way fetchPerKey merges the lists of a vendor's keys: the first list's fields stand, and an image capability both lists answer is merged. The base kept is still the first protocol's, the one the drawer list is fetched beside and the models are saved with. A models URL is still asked alone, one base two protocols share is still asked once, and a provider with no endpoint answering still fails with every URL it asked named in the error. Verified with go test -tags nogui ./internal/provider ./internal/catalog and ./internal/gateway ./internal/agent, all green. TestFetchUnionsProtocolLists and TestFetchUnionsProtocolListsWithoutChat fail on the base commit with the single list the first protocol answered. * provider: an endpoint that can't be asked keeps the models it listed A provider whose protocols sit at bases of their own is asked every base and the lists are merged, so one read that failed saved the union of the rest as the whole list: the models of the failed base read as gone, dropGonePicks took them out of the user's picks and stored that, and nothing brought them back when the endpoint recovered (yetone's review of #1006, on nyownm's #904). A read that failed says nothing about what the vendor serves today, the rule fetchPerKey's keys already follow. fetchOne keeps what each base listed and saves it beside the merged list, in a new "sides" part of the catalog's live file, and a base it could not ask takes its own part back for that fetch. What is kept is that base's own models alone: a model the bases that answered have dropped is dropped here too, however many of them dropped it and however many bases are down. Keeping the whole list saved before would bring such a model back, which is the same fault the other way round. A list saved before this kept no parts, so a base whose part is missing keeps what no answering base lists, until the next fetch with every base answering says which they are. The parts are kept only where more than one base was asked: a single one that fails is the fetch that fails, and its list is kept as it is, so a provider of one protocol's cache is the file it was. fetchOne answers one fetched list now — the models, the base kept for routing, the parts — rather than three values. fetchPerKey marks the parts with the keys that saw them, and keeps a plan's own models out of them. Verified with go test ./internal/provider ./internal/catalog, all green, and ./internal/gateway ./internal/agent. TestFetchKeepsTheModelsAFailedProtocolListed, TestFetchDropsAGoneModelWhileAnotherProtocolFails and TestFetchKeepsTheModelsAFailedProtocolListedPerKey fail on 952d0b00 with the model of the failed protocol taken out of the picks. Co-authored-by: multica-agent <github@multica.ai> * provider: a base that never answered keeps nothing, and is not saved as one that listed nothing keepDeadSides read a part missing from the saved sides as the whole list saved before, and kept what no answering base lists from it. Two things were wrong with that, and both were reported on #1006 (nyownm's #904): A base in none of the saved parts is one that has never answered. The whole list is not its own, so a model its vendor had already dropped was kept for it, and the keepDeadSides result was saved as sides[base] — from then on that base had a part, and the model could never be dropped again. An Anthropic base answering 404 from the start of a provider's life was enough: one round after the Chat base dropped a model, that model stayed in the catalog, and dropGonePicks could not take it out of the user's picks. The saving is the other half of the same fault. A part is what a base listed, so one that never answered has none, and writing an empty one fixes the reading of "never answered" as "listed nothing" for good. Only a part read out of the file is written back; the list saved without any parts at all — before this kept them — is the one case where a base may stand in for a missing part, and what it stands in for is kept for that fetch alone, never saved as its own. So keepDeadSides answers two lists now: the models this fetch's list is made of, and the parts to write beside it. fetchPerKey keeps a model a key that could not be asked at all owns to the bases that listed it, read out of the parts saved beside the list: kept as a whole list with no part saying where it came from it belonged to no base, and was read as gone the first time that key answered half-way — the same permanent deletion of a picked model, one round later and needing no new base. Verified with go test ./internal/provider ./internal/catalog ./internal/gateway ./internal/agent, all green, and -race -count=3 over ./internal/provider with the four failures it already had. TestFetchDropsAModelWhileAnEndpointHasNeverAnswered and TestFetchKeepsAModelsBaseAfterItsKeyFailedWhole fail on 6621f73e. Co-authored-by: multica-agent <github@multica.ai> * provider: a base that answered without a model does not keep owning it fetchPerKey gave every model kept for a key that could not be asked at all to the bases that listed it last time, and a part there said what the bases listed when one of them had answered this round without it (yetone's review of #1006, nyownm's #904). With two keys where both were served a Claude model, and the Anthropic base stopping both of them in the round the second key was down, sides[anthropic] kept a model the base had plainly dropped, and the fetch after that read it as a base that couldn't be asked and held the model one round longer than it should have. It is self-healing — the next round with the base answering settles it — and it is the same fault c8fabd70 was written to undo, read from the other side. sides may only say what the bases listed. A model kept for a failed key belongs to a base that was not asked this round for any of the model's own keys: one that was, and answered without the model, has said what it serves today and no longer owns it. Which is per key, not per provider: fetchOne answers which of its bases replied, which a model of the second key alone never saw an answer from, so the base's saying nothing about it for the first key leaves it that base's. The keys a model is kept under are read from the list saved before, since add clears the ones of the model it is adding. TestFetchDropsAModelABaseStoppedServingWhileAKeyIsDown fails on c8fabd70 with the part holding claude-b, and TestFetchKeepsAModelsBaseAfterItsKeyFailedWhole goes on passing: the same two keys, a model only one of them sees. Co-authored-by: multica-agent <github@multica.ai> * provider, catalog: a page of a model list is not the list (#904) A /v1/models that answers with has_more is one page of the vendor's catalog. Read as the whole list, every model of a later page reads as one the vendor has dropped, and the user's pick of it goes for good, on a list that never said so. Such a reply is no answer: the base is treated as one that could not be asked, which keeps what it listed last time (#904's review of #1006). OpenRouter's Anthropic base is not asked for the list at all. With the Anthropic version header its /models answers with the catalog again, twenty newest first, every id namespaced under `anthropic/`, and the cursors of the pages after. None of those twenty is an id in OpenRouter's own catalog, so merged they are entries of the model picker that name no model: the long, cluttered list #904's reporter wrote of. Its Chat base is that catalog, whole, and the fetch is one request where it was two. The rule is OpenRouter's, by host, as the ones after it are scoped to their vendors. Co-authored-by: multica-agent <github@multica.ai> * provider: the OpenRouter rule reads the base being asked (0fb16990) It read the Chat base's host, so a provider with a Chat base of OpenRouter's and an Anthropic base of another vendor's had that other base skipped: its models were in neither the union nor the sides nor the bases that could not be asked, so no keepDeadSides path found them and the user's picks of them went for good. `magpie provider set <id> anthropic=<url>` reaches that shape from the CLI. The rule is about the vendor whose base is being asked, so that is what it now reads, together with whether the provider asks at a base of its own besides it: an OpenRouter Anthropic base alone is still asked, its reply being the only catalog there would otherwise be, and catalog.fetchOne is what keeps a page of it from being read as the whole. Five combinations of the two bases and openrouter.ai, one assertion each; three of them fail on 0fb16990. Co-authored-by: multica-agent <github@multica.ai> * catalog, provider: a model list is followed to its last page, not read as a page (#1006) A reply with has_more was refused as no answer at all, which is right for a provider with several bases and wrong for one with a single base: Anthropic's own preset has no other base to fall back on, so once its list passes twenty models — about sixteen today — the fetch answered an error and no models, where main listed the twenty of the first page, and a pick of a model on a later page went with them. catalog.fetchOne now reads a list to its end: the first page as the URL stands, and every page after it with limit=1000 and the after_id the page before ended at, up to twenty pages. Half a list is still no answer, and that is what the following ends on: a page that fails, a list that pages without naming the id to carry on from, one that answers the page just asked again under the same id, and one still paging at the cap all leave the base as one that could not be asked, which keeps what it listed last time. The rule lives in catalog.Paged, and the Kilo gateway's list — OpenRouter's shape, which pages the same way — is paged by it instead of refused by a guard of its own; the comment on that guard claimed OpenRouter's /models pages, which neither api.kilo.ai nor openrouter.ai was answering with on 2026-10-06, and now says so. One assertion of TestFetchOpenRouterRuleOverTheFourBaseCombinations follows the rule rather than the old count: OpenRouter's Anthropic base alone is asked for its first page and the page after it, which is the same page again, where before it was asked once and refused. Tests: TestFetchFollowsThePagesOfAList, TestFetchFollowsAPageAListAnswersItsOwnWay, TestFetchTakesAPagedListAsNoAnswerWhenAPageFails, TestFetchTakesAPagedListWithoutAnIdAsNoAnswer, TestFetchTakesAListThatPagesWithoutEndAsNoAnswer (catalog); TestFetchFollowsThePagesOfASingleAnthropicBase (provider, the Anthropic preset's one base, 25 models 20 to a page) and TestKiloModelsFollowThePagesOfTheList. Co-authored-by: multica-agent <github@multica.ai> * provider: OpenRouter's Anthropic base alone is asked, and refused (#1006) The fake that stands for openrouter.ai answered every cursor with the same twenty ids under the same last_id, so following the pages of a list stopped where the rule of catalog.Paged says a list stops being readable, and the single-base case looked covered: the twenty were refused and the fetch failed. The endpoint does not answer that way. Asked with the Anthropic version header on 2026-10-06, /api/v1/models gave those twenty with has_more and a cursor, and under the cursor 413 more ids with has_more false — a different set, and the end of the list. The two pages share nothing, and following them lands deeper in the `anthropic/` namespace rather than back at the catalog it was namespaced from: of the 433 ids, 4 are in the 466 OpenRouter serves without that header. So the twenty were not a page to be refused but the first half of a list that reads to the end, and the end is still not a catalog of models to serve. The base is still asked — it is the only base there is, and refusing to ask would leave the provider with nothing at all — and the list it answers with is now refused as a whole, which is what the old rule did with one page of it. It fails the fetch like any other base that could not be asked, so the provider keeps the models it listed last time (#904). The two replies are kept as they came, under testdata, and a test reads them back: twenty, then 413, the cursor the first ends at, has_more true and then false, and not one id of either page in the catalog OpenRouter serves. The fake pages with after_id, as the endpoint does. Tests: TestOpenRouterNamespacedPagesAreTheEndpointShape (new), TestFetchOpenRouterRuleOverTheFourBaseCombinations (the single-base case now asks exactly the two pages it answers with, keeps no list, and fails), TestFetchKeepsPicksWhenAModelListIsPaginated, TestFetchDoesNotMergeOpenRouter's NamespacedList, TestFetchOpenRouterAddsNoNamespacedModelAndKeepsPicks, TestFetchKeepsAnotherVendorsAnthropicList. Co-authored-by: multica-agent <github@multica.ai> * provider: the message for a namespaced list counts nothing (#1006) The reason a provider whose only base is OpenRouter's Anthropic one is refused is still the one it was, and the base is still asked and refused exactly as before: what changed is the sentence the user is left with, and the comments around it. That sentence counted the list it refused — "433 of them, of which 4 are ids OpenRouter serves" — and those counts are of whatever OpenRouter's catalog was that day, so the number a user reads is wrong tomorrow without anyone touching it. It now says why the answer is no good and what to do instead: give this provider OpenRouter's Chat base, which lists those models under the ids OpenRouter serves, or type the model ids in by hand, which is what the caller already appends to every base it could not ask. The comments said the same counts as fact, and cited a probe file that is not in the repository. The counts stay, marked as what was observed on 2026-10-06, and what does not move is now the point: following the pages of the list lands deeper in the namespace, not back at the catalog it was namespaced from. The dead file references are gone, and one test checks that the message counts nothing at all, so a count cannot creep back in. Tests: TestFetchOpenRouterRuleOverTheFourBaseCombinations (the message names the Chat base and the ids to type, and holds no number but the version in that base's path). Co-authored-by: multica-agent <github@multica.ai> * provider: a multi-protocol provider's catalog is the union of every endpoint's models A provider whose protocols sit at bases of their own kept only the first list that answered, so the models of every other endpoint were nowhere in the product: not in the agents' model lists, not in the catalog the routing and the per-model preferences read, and not fixable by pinning a model's protocol, which setModelAPI refuses for a model the provider does not list. nyownm reported it as #904 and worked around it with one provider per protocol. fetchOne now asks every endpoint the provider speaks and merges the lists by model id, the way fetchPerKey merges the lists of a vendor's keys: the first list's fields stand, and an image capability both lists answer is merged. The base kept is still the first protocol's, the one the drawer list is fetched beside and the models are saved with. A models URL is still asked alone, one base two protocols share is still asked once, and a provider with no endpoint answering still fails with every URL it asked named in the error. Verified with go test -tags nogui ./internal/provider ./internal/catalog and ./internal/gateway ./internal/agent, all green. TestFetchUnionsProtocolLists and TestFetchUnionsProtocolListsWithoutChat fail on the base commit with the single list the first protocol answered. Co-authored-by: multica-agent <github@multica.ai> * provider: an endpoint that can't be asked keeps the models it listed A provider whose protocols sit at bases of their own is asked every base and the lists are merged, so one read that failed saved the union of the rest as the whole list: the models of the failed base read as gone, dropGonePicks took them out of the user's picks and stored that, and nothing brought them back when the endpoint recovered (yetone's review of vendor serves today, the rule fetchPerKey's keys already follow. fetchOne keeps what each base listed and saves it beside the merged list, in a new "sides" part of the catalog's live file, and a base it could not ask takes its own part back for that fetch. What is kept is that base's own models alone: a model the bases that answered have dropped is dropped here too, however many of them dropped it and however many bases are down. Keeping the whole list saved before would bring such a model back, which is the same fault the other way round. A list saved before this kept no parts, so a base whose part is missing keeps what no answering base lists, until the next fetch with every base answering says which they are. The parts are kept only where more than one base was asked: a single one that fails is the fetch that fails, and its list is kept as it is, so a provider of one protocol's cache is the file it was. fetchOne answers one fetched list now — the models, the base kept for routing, the parts — rather than three values. fetchPerKey marks the parts with the keys that saw them, and keeps a plan's own models out of them. Verified with go test ./internal/provider ./internal/catalog, all green, and ./internal/gateway ./internal/agent. TestFetchKeepsTheModelsAFailedProtocolListed, TestFetchDropsAGoneModelWhileAnotherProtocolFails and TestFetchKeepsTheModelsAFailedProtocolListedPerKey fail on 952d0b00 with the model of the failed protocol taken out of the picks. Co-authored-by: multica-agent <github@multica.ai> * provider: a base that never answered keeps nothing, and is not saved as one that listed nothing keepDeadSides read a part missing from the saved sides as the whole list saved before, and kept what no answering base lists from it. Two things were wrong with that, and both were reported on #1006 (nyownm's #904): A base in none of the saved parts is one that has never answered. The whole list is not its own, so a model its vendor had already dropped was kept for it, and the keepDeadSides result was saved as sides[base] — from then on that base had a part, and the model could never be dropped again. An Anthropic base answering 404 from the start of a provider's life was enough: one round after the Chat base dropped a model, that model stayed in the catalog, and dropGonePicks could not take it out of the user's picks. The saving is the other half of the same fault. A part is what a base listed, so one that never answered has none, and writing an empty one fixes the reading of "never answered" as "listed nothing" for good. Only a part read out of the file is written back; the list saved without any parts at all — before this kept them — is the one case where a base may stand in for a missing part, and what it stands in for is kept for that fetch alone, never saved as its own. So keepDeadSides answers two lists now: the models this fetch's list is made of, and the parts to write beside it. fetchPerKey keeps a model a key that could not be asked at all owns to the bases that listed it, read out of the parts saved beside the list: kept as a whole list with no part saying where it came from it belonged to no base, and was read as gone the first time that key answered half-way — the same permanent deletion of a picked model, one round later and needing no new base. Verified with go test ./internal/provider ./internal/catalog ./internal/gateway ./internal/agent, all green, and -race -count=3 over ./internal/provider with the four failures it already had. TestFetchDropsAModelWhileAnEndpointHasNeverAnswered and TestFetchKeepsAModelsBaseAfterItsKeyFailedWhole fail on 6621f73e. Co-authored-by: multica-agent <github@multica.ai> * provider: a base that answered without a model does not keep owning it fetchPerKey gave every model kept for a key that could not be asked at all to the bases that listed it last time, and a part there said what the bases listed when one of them had answered this round without it (yetone's review of #1006, nyownm's #904). With two keys where both were served a Claude model, and the Anthropic base stopping both of them in the round the second key was down, sides[anthropic] kept a model the base had plainly dropped, and the fetch after that read it as a base that couldn't be asked and held the model one round longer than it should have. It is self-healing — the next round with the base answering settles it — and it is the same fault c8fabd70 was written to undo, read from the other side. sides may only say what the bases listed. A model kept for a failed key belongs to a base that was not asked this round for any of the model's own keys: one that was, and answered without the model, has said what it serves today and no longer owns it. Which is per key, not per provider: fetchOne answers which of its bases replied, which a model of the second key alone never saw an answer from, so the base's saying nothing about it for the first key leaves it that base's. The keys a model is kept under are read from the list saved before, since add clears the ones of the model it is adding. TestFetchDropsAModelABaseStoppedServingWhileAKeyIsDown fails on c8fabd70 with the part holding claude-b, and TestFetchKeepsAModelsBaseAfterItsKeyFailedWhole goes on passing: the same two keys, a model only one of them sees. Co-authored-by: multica-agent <github@multica.ai> * provider, catalog: a page of a model list is not the list (#904) A /v1/models that answers with has_more is one page of the vendor's catalog. Read as the whole list, every model of a later page reads as one the vendor has dropped, and the user's pick of it goes for good, on a list that never said so. Such a reply is no answer: the base is treated as one that could not be asked, which keeps what it listed last time (#904's review of #1006). OpenRouter's Anthropic base is not asked for the list at all. With the Anthropic version header its /models answers with the catalog again, twenty newest first, every id namespaced under `anthropic/`, and the cursors of the pages after. None of those twenty is an id in OpenRouter's own catalog, so merged they are entries of the model picker that name no model: the long, cluttered list #904's reporter wrote of. Its Chat base is that catalog, whole, and the fetch is one request where it was two. The rule is OpenRouter's, by host, as the ones after it are scoped to their vendors. Co-authored-by: multica-agent <github@multica.ai> * provider: the OpenRouter rule reads the base being asked (0fb16990) It read the Chat base's host, so a provider with a Chat base of OpenRouter's and an Anthropic base of another vendor's had that other base skipped: its models were in neither the union nor the sides nor the bases that could not be asked, so no keepDeadSides path found them and the user's picks of them went for good. `magpie provider set <id> anthropic=<url>` reaches that shape from the CLI. The rule is about the vendor whose base is being asked, so that is what it now reads, together with whether the provider asks at a base of its own besides it: an OpenRouter Anthropic base alone is still asked, its reply being the only catalog there would otherwise be, and catalog.fetchOne is what keeps a page of it from being read as the whole. Five combinations of the two bases and openrouter.ai, one assertion each; three of them fail on 0fb16990. Co-authored-by: multica-agent <github@multica.ai> * catalog, provider: a model list is followed to its last page, not read as a page (#1006) A reply with has_more was refused as no answer at all, which is right for a provider with several bases and wrong for one with a single base: Anthropic's own preset has no other base to fall back on, so once its list passes twenty models — about sixteen today — the fetch answered an error and no models, where main listed the twenty of the first page, and a pick of a model on a later page went with them. catalog.fetchOne now reads a list to its end: the first page as the URL stands, and every page after it with limit=1000 and the after_id the page before ended at, up to twenty pages. Half a list is still no answer, and that is what the following ends on: a page that fails, a list that pages without naming the id to carry on from, one that answers the page just asked again under the same id, and one still paging at the cap all leave the base as one that could not be asked, which keeps what it listed last time. The rule lives in catalog.Paged, and the Kilo gateway's list — OpenRouter's shape, which pages the same way — is paged by it instead of refused by a guard of its own; the comment on that guard claimed OpenRouter's /models pages, which neither api.kilo.ai nor openrouter.ai was answering with on 2026-10-06, and now says so. One assertion of TestFetchOpenRouterRuleOverTheFourBaseCombinations follows the rule rather than the old count: OpenRouter's Anthropic base alone is asked for its first page and the page after it, which is the same page again, where before it was asked once and refused. Tests: TestFetchFollowsThePagesOfAList, TestFetchFollowsAPageAListAnswersItsOwnWay, TestFetchTakesAPagedListAsNoAnswerWhenAPageFails, TestFetchTakesAPagedListWithoutAnIdAsNoAnswer, TestFetchTakesAListThatPagesWithoutEndAsNoAnswer (catalog); TestFetchFollowsThePagesOfASingleAnthropicBase (provider, the Anthropic preset's one base, 25 models 20 to a page) and TestKiloModelsFollowThePagesOfTheList. Co-authored-by: multica-agent <github@multica.ai> * provider: OpenRouter's Anthropic base alone is asked, and refused (#1006) The fake that stands for openrouter.ai answered every cursor with the same twenty ids under the same last_id, so following the pages of a list stopped where the rule of catalog.Paged says a list stops being readable, and the single-base case looked covered: the twenty were refused and the fetch failed. The endpoint does not answer that way. Asked with the Anthropic version header on 2026-10-06, /api/v1/models gave those twenty with has_more and a cursor, and under the cursor 413 more ids with has_more false — a different set, and the end of the list. The two pages share nothing, and following them lands deeper in the `anthropic/` namespace rather than back at the catalog it was namespaced from: of the 433 ids, 4 are in the 466 OpenRouter serves without that header. So the twenty were not a page to be refused but the first half of a list that reads to the end, and the end is still not a catalog of models to serve. The base is still asked — it is the only base there is, and refusing to ask would leave the provider with nothing at all — and the list it answers with is now refused as a whole, which is what the old rule did with one page of it. It fails the fetch like any other base that could not be asked, so the provider keeps the models it listed last time (#904). The two replies are kept as they came, under testdata, and a test reads them back: twenty, then 413, the cursor the first ends at, has_more true and then false, and not one id of either page in the catalog OpenRouter serves. The fake pages with after_id, as the endpoint does. Tests: TestOpenRouterNamespacedPagesAreTheEndpointShape (new), TestFetchOpenRouterRuleOverTheFourBaseCombinations (the single-base case now asks exactly the two pages it answers with, keeps no list, and fails), TestFetchKeepsPicksWhenAModelListIsPaginated, TestFetchDoesNotMergeOpenRouter's NamespacedList, TestFetchOpenRouterAddsNoNamespacedModelAndKeepsPicks, TestFetchKeepsAnotherVendorsAnthropicList. Co-authored-by: multica-agent <github@multica.ai> * provider: the message for a namespaced list counts nothing (#1006) The reason a provider whose only base is OpenRouter's Anthropic one is refused is still the one it was, and the base is still asked and refused exactly as before: what changed is the sentence the user is left with, and the comments around it. That sentence counted the list it refused — "433 of them, of which 4 are ids OpenRouter serves" — and those counts are of whatever OpenRouter's catalog was that day, so the number a user reads is wrong tomorrow without anyone touching it. It now says why the answer is no good and what to do instead: give this provider OpenRouter's Chat base, which lists those models under the ids OpenRouter serves, or type the model ids in by hand, which is what the caller already appends to every base it could not ask. The comments said the same counts as fact, and cited a probe file that is not in the repository. The counts stay, marked as what was observed on 2026-10-06, and what does not move is now the point: following the pages of the list lands deeper in the namespace, not back at the catalog it was namespaced from. The dead file references are gone, and one test checks that the message counts nothing at all, so a count cannot creep back in. Tests: TestFetchOpenRouterRuleOverTheFourBaseCombinations (the message names the Chat base and the ids to type, and holds no number but the version in that base's path). Co-authored-by: multica-agent <github@multica.ai> * provider: the list of a multi-protocol vendor is asked once (#1006) The dedup added in 952d0b00 is keyed by the base URL as it is configured, which is neither of the two things that decide whether a list is asked again: which list URL the request goes to, and what it authenticates with. Both of a vendor's ends were lost to it. A Chat base and the Anthropic base of the same remote magpie are two strings, one list — GET /v1/models — and it was fetched twice, which #1282 says a remote's test does not do. And one base string serving Chat, Anthropic and Gemini is three requests: the Chat request refused a 401 took the other two for lists already had, so a vendor whose models were all there was reported as serving none. The key is now the list URL and the authentication, in catalog.Listed, and it gives two rules. A list URL this key has listed is not asked again by any protocol — the answer is the answer, so …/v1 and the bare host beside it are one request. And a request already made is not made again, but a URL refused under one authentication is not refused under the next, so the Gemini and Anthropic lists of a base whose Chat request was refused are asked, each with its own. The base string is left out of the key on purpose: Chat and Responses at one base are one request because both send Bearer at the same URL, not because the strings match. A base whose every list was asked already and none answered says so with catalog.ErrAsked, which the caller reads as "nothing new here" rather than as a second refusal to put in the message the user reads. Tests: TestFetchAsksEachAuthenticationAtOneBase, TestFetchAsksOneListOnce ForTwoBasesOfIt, TestFetchReportsOneRefusalForOneBaseAskedTwice. Co-authored-by: multica-agent <github@multica.ai> * provider: a Gemini base that fails once no longer deletes the picked model it listed The union fetch merges a Gemini base's list like any other protocol's, but it kept none of the fetch's bookkeeping for it: what it listed was in no `side`, so the parts saved beside the catalog said no base listed it, and a base that could not be asked was in no `dead` either, so `keepDeadSides` never saw it. A picked Gemini model was therefore dropped from the user's provider for good the first time the Gemini endpoint answered 502 or timed out — the fault the Anthropic base of the same fetch was fixed for in #904. A Gemini base also went uncounted in `asked`, so a two-base provider's parts were saved on the strength of one base asked. A Gemini base now joins `asked` before it is asked, joins `sides` and `answered` with what it listed, and joins `dead` when it cannot be asked. What a failed Gemini base keeps is its own models alone, so a model its list has really dropped is still dropped from the picks. Verified at 20ee273aaedc10ab0baf06cffbd826ddc367be3c + this commit, Go 1.26.8, darwin/arm64, under a temporary HOME with GOPATH, GOMODCACHE and GOCACHE pinned. Without the change (internal/provider/models.go put back): go test ./internal/provider -run 'TestFetchKeepsTheModelsAFailedGeminiBaseListed|TestFetchDropsAGoneGeminiModelWhileAnotherProtocolFails' multiproto_models_test.go:713: picks after the Gemini base failed: [gpt-a], want [gpt-a claude-b] multiproto_models_test.go:824: picks after the Gemini list dropped a model: [gpt-a gpt-b claude-b claude-c], want [gpt-a gpt-b claude-b] FAIL (exit 1) With it: go test ./internal/provider -run 'TestFetchKeepsTheModelsAFailedGeminiBaseListed|TestFetchDropsAGoneGeminiModelWhileAnotherProtocolFails' ok (exit 0) go test -tags nogui ./internal/provider -count=1 ok github.com/yetone/magpie/internal/provider 109.187s (exit 0) gofmt -l internal/provider/models.go internal/provider/multiproto_models_test.go (prints nothing) go vet ./internal/provider (exit 0) GOOS=linux go vet -tags nogui ./... (exit 0) GOOS=windows go vet ./... (exit 0) go build ./... (exit 0) GOOS=linux go build -tags nogui ./... (exit 0) GOOS=windows go build ./... (exit 0) The maintainer's own reproduction of the first failure, run on 20ee273a before anything was changed, is the same one line and exits 1: --- FAIL: TestZZGeminiSideKept (0.04s) zz_gem_test.go:81: picks after a protocol failed: [gpt-a], want [gpt-a claude-b] The whole-repository `go test -tags nogui ./...` was not run: the change touches only internal/provider, and that package's full suite is green. Co-authored-by: multica-agent <github@multica.ai> --------- Co-authored-by: multica-agent <github@multica.ai> |
||
|
|
eba7187368 |
gateway, provider, cli, gui: a group can route By weight, each member's share set beside it (#1910, DD on Discord)
DD asked for weighted round robin as a group routing, next to In turn.
A provider's keys could already route by weight (#841). Groups could not.
What changes:
- provider: Group.Weights maps a member's spelling to its weight, 1 to
1000. A member left out, or set to 0, weighs 1. SaveGroup accepts
routing "weight". It also cleans weights the way it cleans fast and
off: it strips :fast, drops weights of members that are gone and of
members weighing 1, and refuses a weight below 0 or above 1000.
Weights follow a member when it is renamed (RenameMember, Rename,
RenameGroup) and survive Share/Import.
- gateway: planLevel treats each member of a weight-routed group as one
unit: a model with its keys in its provider's order, or a nested group
routed its own way. weightedUnits orders the units by smooth WRR on a
round per group ("group/<id>"), sharing wrrPick with the keys. The
round's pick goes first and the rest stay in member order for
failover. A unit whose head is resting leaves the round. When a
conversation is kept on another member (session/turn/cache/strict),
the charge moves to that member (wrrSeat, wrrMove).
- cli: routing=weight (also weighted, wrr). weight=<model>=<n>[,...]
sets weights and keeps the rest; weight= on its own clears them. The
group view shows "· weight N" for each member.
- tui: By weight is in the group routing list.
- gui: the group editor offers By weight. Each member then shows
"Weight N · S%", its share among the members that are on. Clicking it
edits the number in place: Enter or blur keeps it, Escape cancels,
and a value outside 1 to 1000 shows a warning. The trace header uses
group wording for a weight-routed group. Strings are added in zh,
zh-TW, ja and de.
- docs: reference.md, gateway-routing.md, and site start pages in en,
zh and ja.
Run:
- go test -tags nogui ./internal/provider ./internal/cli ./internal/tui:
ok.
- ./internal/gateway: ok in 988s with -timeout 45m. The first run hit
the default 10m timeout at load average ~170. The test running at
that moment had been running for 2s; it was not a hang.
- go vet -tags nogui on those packages, for darwin, GOOS=linux and
GOOS=windows: clean. gofmt -l: clean.
- New group-member-weight.test.cjs: 8/8 in Chromium and WebKit, en and
zh at 1100, en and de at 420. The WebKit de 420 case also passed six
runs at once.
- gui-zh-tw, gui-ja, gui-de, i18n-keys, routing-*, group-*,
panel-routing*, settings-groups and agent-model-groups: all green
except two.
- routing-steady (WebKit) is #1804. It is red 2/3 alone on origin/main
|
||
|
|
c651c2ffd4 |
provider: an Ollama Cloud legacy plan shows its session and weekly limits on its plan card (#1888, yangmingyuan380)
What changed:
|
||
|
|
7565d93c8b |
provider: an enterprise WorkBuddy account's card shows its credits, from the enterprise meter WorkBuddy's usage page reads (#1904, CnsMaple)
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
|
||
|
|
5e5b6a5ac3 |
provider: every account of a provider keeps its queue, limits and routing, not only the first (#1899)
A second WorkBuddy AI account queued requests for 62s with the provider's queue wait set to 1s. The gateway takes each candidate's QueueLimit, QueueWait, LaneLimit (MaxConcurrency) and Routing from the Provider value it is handed. The account the agent is signed in to comes from All, which lays the user's saved picks from providers.json over it. The other accounts on beside it come from AlsoOn. For Claude and Codex, AlsoOn copies p, so they had the picks. Every other sign-in builds its extra accounts afresh: all plugin accounts (pluginAlsoOn) and the built-in extras (WorkBuddy, Grok, Copilot, ZCode, Kiro, Devin, Command Code, Qoder, Zed, Factory, MiMo, the Gemini sign-ins). They had none of the picks. A few getters (LaneLimit, RPMLimit, AccountCap, proxy) already fell back to providers.json. The queue, the provider-wide concurrency and routing did not, so an extra account waited forever on a full lane. The overlay All does is now withPicks. AlsoOn calls it on every account it returns, from p as All has it. This one choke point covers every sign-in's extra accounts, plugin and built-in, moved or not. The LaneLimit, RPMLimit and AccountCap comments now say what still reads providers.json, and so does gateway-routing.md's Limits row. Tests: - TestPluginSecondAccountKeepsTheQueue (gateway, fake plugin under bun): two accounts, one at once each, a queue of 1 and a wait of 1s, every request pinned to the second account. The third request gets 429 "queue is full" at once, and the queued one gets 429 "waited" after its second. The vendor sees only the second key. - TestWorkBuddyAI: the second account from AlsoOn has the provider's queue 1/1s, MaxRPM 7, Routing ordered and LaneLimit 2. Broken by hand (AlsoOn returning alsoOn's accounts as they are): - The gateway test fails at its AlsoOn check. With that check off, it fails on "no reply in 10s", which is the reporter's symptom. - TestWorkBuddyAI fails with "queue 0, wait 0s, rpm 0, routing "", at once 0". Run (sandbox HOME, private GOCACHE, worktree): gofmt -l; go test -tags nogui on ./internal/provider, ./internal/gateway, ./internal/gui, ./internal/cli and ./internal/agent; GOOS=linux and GOOS=windows go vet -tags nogui on internal/provider and internal/gateway. Not tried with a real WorkBuddy AI account. |
||
|
|
8c661279f2 |
zcode: a bucket counted in amounts says its count as used or as left, as the share beside it is (#659) — the Start Plan's buckets and a Coding Plan's limits told only the vendor's used-first text, "28746939 / 100000000", so the card froze that count beside a "71.3% left" figure. A window whose whole is told now carries the count as amount of limit, as WorkBuddy's credits do. TestZCodeStartBucketsCarryTheirCount, TestZCodeWindowsCarryTheirCount and the amount/limit assertions in TestZCodeAccounts fail without the change; go vet, gofmt (byte-exact, the repo's CRLF aside) and go test ./internal/provider/ pass, its one failure (TestLoginUsageClaudeAskedMeanwhile) the same on a clean origin/main. (#1137)
Co-authored-by: wizzy-yang <wizzy-yang@users.noreply.github.com> |
||
|
|
7df0a5bf32 |
catalog: a vendor's own model name is kept ahead of the catalog's, and fallback names never collide (#1188, fixes #1119)
Command Code's Flash Fast showed the catalog's "Flash", the same name as plain Flash, so the picker had two "Flash" rows. An unprefixed `name` from a vendor's /models now wins over the catalog fallback (magpie_label and display_name still come first). A `Vendor: Model` name such as OpenRouter's falls through to the catalog as before, so OpenRouter's names don't change. A catalog fallback that would give two ids one name keeps the id instead. Exposed fills names only for unlisted picks and checks every available name and id for a collision; listed picks keep exactly what Available returned, Antigravity's id-only names among them. TestNameOf's case-variant expectation changes on purpose: glm-5-turbo and GLM-5-Turbo together keep their own ids. Kenoia's PR head f538b19e, which conflicted with main in internal/catalog/live.go and live_test.go; the conflict was resolved keeping both main's live-name changes and this one. Run on this tree (origin/main |
||
|
|
b0e3177d9d |
provider: Ollama Cloud shows its plan's included allowance and its bought credits in Usage and magpie quota (#1888)
What: an ollama-cloud key (any provider whose base is on ollama.com) is read at GET https://ollama.com/api/balance with Authorization: Bearer <key>. included.{balance_usd, allowance_usd, period} becomes a plan card (PlanQuotas, planQuotaSourceOf) with one window in USD: spent of the allowance, named Month when the period is a month long, resetting at period.until. purchased.balance_usd becomes the key's balance card (KeyBalances, balanceSourceOf). Routing weighs the key by that window as it does other plan keys (keyWindows), and the window is Aside while bought credits are left, since spending past the allowance draws on them. Absent fields are unknown, never $0: no included, no allowance, an allowance of 0 or no balance_usd gives no window (and, as for MiniMax and Command Code, no plan card); no purchased gives no balance card (new errNoBalance, which KeyBalances leaves out instead of showing an error); null period gives a window with no reset. A reply with neither object says its shape. A refused key's balance card says Ollama's reason. Why: #1888 asked for Ollama Cloud's balance and plan quota beside the other key-bought plans. Run: - go test ./internal/provider -run 'Ollama|TestPlanQuotaSource|TestBalanceSourceByHost|TestKeyBalances' in a sandbox HOME: pass. Broken by hand five ways, each red: no ollama.com plan source (TestOllamaCloudCards, TestPlanQuotaSource), missing purchased read as $0.00 (TestReadOllamaBalanceMissing, TestOllamaCloudCards), KeyBalances not skipping errNoBalance (TestOllamaCloudCards), missing included.balance_usd read as 0 (TestReadOllamaBalanceMissing: a $20 allowance shown 100% used), Aside dropped (TestReadOllamaBalance). - The built binary in a sandbox HOME with an ollama-cloud provider and a fake key: `magpie quota` asked the real ollama.com and showed `ollama-cloud balance 401 Unauthorized: {"error":"invalid credentials"}`, no plan card. - gofmt -l, go vet (darwin), GOOS=linux go vet -tags nogui, GOOS=windows go vet, go build for darwin, linux (nogui) and windows: clean. - go test -tags nogui ./... in a sandbox HOME at load ~27: 48 packages ok; internal/agent and internal/gateway hit the 10m timeout, and in gateway TestIntentClassifierGroup (#1813, 3.63s against its 3s bound) and TestHistoryKeepsDaysAndDropsOld (filed #1892) failed. Rerun with -timeout 40m both packages pass (1032s, 1138s). Neither package reads ollama.com or these readers. Not tried against the real API with a real key: the owner's magpie has no ollama-cloud provider, so the fixtures are the issue's literal JSON and the free-plan and missing-field shapes are guesses from it. Whether a spent allowance really falls through to bought credits (Aside) is not verified either. Reported-by: yangmingyuan380 |
||
|
|
fa44fde461 |
netproxy: a proxy's user and password stay out of every log line, error and status that names it (#1886)
What: netproxy.Redact is the one place a proxy address is made fit to show. It is the rule |
||
|
|
a069f224c0 |
provider: moved Grok users get grok-auth 0.1.14, which asks for a window offered without a k as that window (#1679)
#1679's fix (df4ea0ff6) reaches only the built-in. A moved Grok user's requests go through @magpie-community/opencode-grok-auth, whose modelOf read only <id>@<N>k, so grok-4.7@131072 went to Grok as a model of that name. plugins f980265 (grok 0.1.14) reads the bare-digit window as the built-in now does; this raises the mover's min so keepMovedCurrent updates every moved user to it. Run: plugin bun test 41 pass, the new modelOf test FAILs with modelOf put back; scripts/check.mjs grok ok; npm view @magpie-community/opencode-grok-auth@0.1.14 version on registry.npmjs.org gives 0.1.14. Here: gofmt -l clean; go test -tags nogui -count=1 ./internal/provider -run 'Mover|Moved|Migrat|Grok|Adopt|HandOver|KeepMoved' ok. |
||
|
|
30f7ad0462 |
provider: a Grok window the id names without a k is signed and priced as its model
grokContextModels offers each window Grok lists beside the default as <id>@<N>k, and grokWindowLabel writes a window that is no multiple of 1000 as bare digits (131072). grokWindowed took any size without the k for no window at all: such an id went to Grok verbatim, as x-grok-model-override "grok-4.7@131072" with no x-grok-context-window — a model id Grok doesn't list — and pricedNames's grokWindow gave it no price either. What changed - grokWindowed reads a bare-digit size as the window itself, as the label writes it; a k still means thousands. - grokWindow (pricedNames) takes the window without the k too, so the id is priced as its model, as grok-4.7@500k is. What was run - New TestGrokSignsWindowWithoutK and TestGrokWindowWithoutKListPrice fail on the old code (the id sent verbatim as the override, no window header; ListPrice and MakerPrice give nothing) and pass with the change. - go test -tags nogui -count=1 ./internal/provider ok; -race -count=5 on the Grok tests ok. - gofmt -l internal/ clean; go vet ./..., GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./... clean but the known trayimage_darwin.go cgo -Wenum-conversion warning; go build, GOOS=linux go build -tags nogui and GOOS=windows go build ok; go test -tags nogui -count=1 ./... green under a temp HOME (TestPluginListSaysMiddleware once hit its 60s bound under the full run and passes alone and on a second full run; unrelated to this). |
||
|
|
efa25c7777 |
provider: a held group's folder rules are the caller's own too, as #1124 made its other lists
#1124's Group.own gives a group read from the held providers.json lists of
its own, so a caller changing it in place changes nobody else's. It was
written before
|
||
|
|
920d96af55 |
tests: provider, plugin, gateway, codexcat, gui and tui tests pass in any order and on any -count (#1146)
Squashed from wei's #1146, onto main. Each test now starts from state of its own instead of what an earlier test (or an earlier -count run) left: - plugin: changed() counts the OnChange hooks still running; Told waits for them, and Settle ends with Told and UseCached(nil), so a change one test made isn't told in the next and the next test's plugin list isn't read as changed. Only tests call Settle/Told; in production changed() only counts. New TestSettleWaitsForTheHooksItTold and TestSettleForgetsTheFoldersPlugins. - provider: isolate forgets Copilot's state, the plans' quota cards and balances; the warm-up, Cursor sign-in, hold and moved-plugin tests wait for what they started. - gateway: fresh() forgets refused seals, and TestRouting, TestSmartRouting and TestQuotaRestsUntilItsReset start from forgetRouting; codexSignedIn and TestForeignReasoningIsLeftOut start from fresh. - codexcat: XDG_CONFIG_HOME under the test's home. tui: costAt reset. gui: the fake Cursor account no longer outlives its test. cli: Settle. Left out as already on main: the cli_identity keepIdentities switch ( |
||
|
|
0dd821c130 |
provider: a forget, a TUI group edit or a failed group save no longer changes the record or groups every other reader holds (#1124)
* provider: forgetting a moved subscription's account no longer changes the record every other reader holds, so a forget whose write fails can't leave moving back an account with no key
setMigration copied only the outer map of migrations.json as filememo
had parsed it. The record handed to its callback still shared its
Accounts and Backup with that parse, which every MigrationOf reader gets
too. forgetPluginAccounts' callback deletes from both lists in place
(slices.DeleteFunc), which shifts the entries and zeroes the tail of the
shared arrays. putBack and moveBack read those lists without
migrationsMu, so that was a data race. When the write then failed, the
file was unchanged and filememo kept serving the changed parse: the same
length, the forgotten account replaced by the next and a last entry with
no key, which a move back would hand back. setMigration now gives the
callback its own copy of both lists (and of each account's Was).
Other readers of shared parses were checked (migrations, logins, credits,
quota history, settings, catalog and plugin caches): none changes what
it reads. TUI group editing changes heldOf("file")'s groups in place
while a Hold is open; that is a different cache and goes in its own
change.
Tested: TestFailedMigrationWriteLeavesItAsRead fails without the fix
(read as accounts ["zed:b" ""], backup ["b@example.com" ""]) and passes
with it. TestMigrationReadWhileForgotten fails with DATA RACE in 9 of 10
separate -race runs without the fix and passes 20 of 20 with it.
go test -race -tags nogui ./internal/provider, go vet ./..., go build,
GOOS=linux go build -tags nogui and GOOS=windows go build pass.
* provider: a group edit the TUI makes, or a save that fails, no longer changes the groups every other reader holds
While any goroutine holds provider.Hold() (SyncCatalog after every store,
the in-process gateway's /models and model routes), groupsIn hands every
caller the same providers.json, and each Group copied out of it still
shared its Members, Match, Matched, Off, Levels, Fast and Rules (with each
rule's Agents and Time) with that file; withMatches cloned Members only
for a group with patterns. The TUI's saveGroup changes the group it read
in place before saving it (slices.Delete/DeleteFunc/Insert on Rules and
Members, swaps, RenameMember), and SaveGroup itself wrote Rules[i].Use and
appended to Fast in the caller's lists. That raced with SyncCatalog's and
the gateway's group reads, and a save that failed ("every model in X is
switched off") left the held groups shifted with an empty member or rule
at the end for up to a second, where SyncCatalog could write agents'
model files from them.
groupsIn now gives each group lists of its own (Group.own), and SaveGroup
cleans its own copy, so the caller's group is as it gave it, saved or not.
RenameGroup and SetAutoGroups read through groupsIn and are covered too.
The CLI's in-place edits (groups_cli.go, groups_rules_cli.go) run with no
hold and read a fresh file; they are covered all the same.
Found by the sibling sweep for #1124.
Verified: TestHeldGroupsAreTheCallers (internal/provider) and
TestGroupTakeOutRefusedWhileHeld (internal/tui) hold the catalog, take a
model out of a group whose other one is off, as the TUI's d does, and
read the groups again. Without the change both fail: members
[b/big ""] / [b/gpt-5.5 ""] and a zeroed rule in the held groups. With
only SaveGroup's copy removed, the first fails with "SaveGroup changed the
caller's rule". go test -tags nogui -race ./internal/provider
./internal/tui, go test -tags nogui ./..., go vet ./..., go build,
GOOS=linux go build -tags nogui and GOOS=windows go build pass.
|
||
|
|
b74167e4a6 |
providers: reading Claude Code's sign-in no longer hangs on a Mac whose keychain item an older magpie wrote on several lines (#1126, waitingsnow)
claudeCredential reads under claudeCacheMu, and the hex item (#70) was written again through saveClaudeCredential, which caches under the same lock. sync.Mutex isn't reentrant, so the read held the lock for good and every later read of the Claude sign-in (the account, its usage, the gateway's account reads) waited on it. The rewrite now only writes (writeClaudeCredential); the read caches what it read as before. Taken from #1126 at 834f2b9e and resolved onto main: since |
||
|
|
1d8134605a |
plugin: a plugin pinned to a version, or turned off, keeps both throu… (#1076)
* plugin: a mover installs the version its user pinned, not @latest
plugin.Add installs the spec it is given and appends @latest to a bare
package name, so installPlugin — the mover's installer, for
keepMovedCurrent, Move and HandOver — handing it a bare name quietly
replaced <pkg>@1.2.3 with <pkg>@latest in plugins.json. The pin was the
user's choice, and it was destroyed behind their back every time the
mover's min was raised.
installPlugin now hands Add the entry's own spec when the user has one.
A pin older than the move needs is left pinned and reported by the check
that was already there below it ("%s %s is installed; moving needs %s
or newer"), whose remedy is to unpin it; a pin that satisfies min still
returns early and is not reinstalled. A user with no entry for the
package keeps the bare name, which is a first install and there is no
pin to keep. A plugin the user turned off is still refused before any of
this, as it was.
TestInstallPluginKeepsTheUsersPin pins fake@0.1.5 with the move needing
0.2.0 and writes the version plugin.Version reads into the plugins folder
it is read from. It asks Add for fake@0.1.5 — against installPlugin as it
handed over the bare name it fails with "asked Add for [fake], want the
pinned fake@0.1.5" — and gets "needs 0.2.0 or newer" back rather than a
silent install of @latest. It also checks that a plugin the user turned
off is refused and not asked for at all. addPlugin is a var beside
pluginProviders and removePlugin so the test can read the spec handed
over without the Bun that Add runs.
Rebased on main as of
|
||
|
|
5353c15246 |
provider: a Grok per-home read keeps the newer reading on disk (#1078)
grokLoginUsage read each home with keepLast, so its reading carried no
readSeq: when the Usage page's whole-page read of the same account began
first and answered later, its older figure replaced what the per-home
read had just left in quotas.json, and the Usage page then showed that
older share as the "last read" fallback on the vendor's next hiccup.
grokLoginUsage now orders its read (quotaReading) and keeps it with
keepReading, as loginReading already does; loginReading's give-up branch
goes through the same helper. Built-in Grok only: a Grok moved to its
plugin is read as plugin:grok through loginReading, which was ordered
already.
Rebased onto main by the reviewer: main's grokLoginUsage now reads with
gctx (unheld for an account StaleAllowance marked), so the kept line is
keepReading(gctx, grokUsageAt(gctx, ...)); gctx carries the same order.
Run at
|
||
|
|
ab4a778951 |
provider: a moved Factory asks for its plugin 0.1.24 (plugins #66)
factory 0.1.24 (magpie-community/plugins #66, guoqchen1001) is on npm: a session continued after Claude Code compaction, whose restored context opens with the invoked-skills reminder, is adapted so Factory takes it. Raising the mover's min lets keepMovedCurrent bring every moved user to it. Run: npm registry dist-tags latest = 0.1.24; go test -tags nogui -run 'Mov|Migrat|Plugin|Factory|Mover' ./internal/provider ok; gofmt clean. |
||
|
|
043e0cfc7b |
provider tests: the allowance tests end only once their own reading and renewal tell are done, and each sub2api key test reads its key under an id of its own (#1058)
TestKeyAllowanceStaleMidRead waits until its own OnRenewed hook has been told, and puts back the hooks it found. TestAllowancesBeforeFirstReading's cleanup waits for the reading it held before the reset. sub2apiKey takes the test and names the key sub2api-<test>, so a renewal told late by one test is not counted by the next, and TestKeyAllowanceRenewed counts only its own key's renewals. Only test code changes. Squashed from #1058 (waitingsnow, head 42fe2c7b). The reviewer changed one thing: quota_asked_test.go's TestKeyReadsOnlyWhenAsked, added on main by |
||
|
|
1502433978 |
gui: a key's value can be changed in place, keeping its name, place and settings, and its rest is lifted (#1869)
A key rotated at its vendor had to be removed and added again, which lost its name, its place in the order, its weight, protocol, models, proxy and concurrency, and any gateway key restricted to it. As decided on #1869, in multi-key mode the row now has a Change key action, with a double-click on the row as a shortcut. - provider.ReplaceKey(id, ref, key) sets the key's new value and moves what providers.json keys by the key's fingerprint (AccountModels, AccountProxies, AccountConcurrency) to the new one. An empty value, an unknown key and a value another key of the provider already holds are refused. The same value is a no-op. - access.ReplaceAccount moves gateway keys' Accounts entries from provider/old to provider/new, under the caller-keys lock. - gateway.Server.UnrestAll lifts a rest key and every per-model rest under it. The GUI's keys/replace lifts the key's rest (provider#key, and the provider's own rest key when it is the only key on), so the new value is asked from the next request. - app.js: a pencil beside the key's copy button opens a password field in place of the masked value. Enter saves, Escape leaves it, and a double-click on the row away from its controls opens it too. The button has its own class (.key-edit) with the copy button's look. - i18n: four strings in zh, zh-TW, ja and de. - providers-accounts.md: ReplaceKey in the Keys table. Past requests keep the old fingerprint in history, under the same name. A rest is lifted only in the gateway this magpie serves. Run: - go test ./internal/gateway ./internal/provider ./internal/access ./internal/gui -count=1: ok. New TestReplaceKeyKeepsItsPlace, TestKeysReplaceKeepsTheKeyAndLiftsItsRest and TestUnrestAllLiftsAKeysModels each fail with their change taken out. - gofmt -l clean; go vet darwin, linux -tags nogui, windows. - key-replace.test.cjs (new): en/zh/zh-TW/ja/de, chromium and webkit, 1100 and 420px. Checks the post, order, note, no sideways scroll, and no scroll on change or on double-click plus Escape. - With key-copy, rest-try-now and key-import: 96/96. - 72 key*/routing*/rest* GUI files at concurrency 6: 863/871. The 8 reds were key-copy, whose button.copy locator matched the pencil; that's why it has its own class now, and key-copy passes. - Under load, about one run in 300 saw the editor body go back to the top after the copy button's double-click, with no script scrolling it. That is #1504 (findings added there). The test checks scroll before that step. |
||
|
|
861c2da147 |
provider: tests that a Claude usage ask on a read's own clock tick is answered (#1228)
What changed: three tests for c56eccab's generation counter, one per
place a Claude reading is kept against an ask: loginReading (LoginUsage),
SubscriptionUsage's whole-page cache, and claudeWindows' /usage run.
Each asks while the reading is under way and stores the ask's time as of
before the reading began, as Windows' ~15ms clock or a clock set back
reads it. TestLoginUsageClaudeAskedMeanwhile only failed on Windows, 3 in
5, because on macOS the two times never tie; these fail every time on the
old code. The claudeWindows test also ages the answered run past the 30s
floor and checks no run follows unasked.
Why: the patch came with no test of its own that fails on the old code
outside Windows.
Run (sandbox HOME, private GOCACHE, go1.26.8 darwin/arm64):
- with the three product files put back to origin/main: all three FAIL
("a reading from before the ask was kept", "cards read before the ask
were kept as fresh", "the ask wasn't answered: <nil>, 1 runs").
- broken by hand, one at a time: loginReading's check made always true
(login test red); SubscriptionUsage's reset dropped (page test red);
the successful run's entry without asked (claudeWindows "ran again
unasked: 3 runs"); markClaudeUsageAsked's Add removed (all three red);
RefreshUsage's markClaudeUsageAsked removed (existing
TestRefreshSavedClaudeUsage red).
- go test -tags nogui -count=3 -run 'AskedOnThe|AskedMeanwhile' passes.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
|
||
|
|
44b5b2b96b |
provider: a Claude usage ask invalidates an older read even in the same clock tick
Refs #1228. The original test fails with "a reading from before the ask
was kept". A temporary diagnostic measured identical UnixNano values for
the read's start and the later ask; that diagnostic is not shipped.
What changed:
- Count both whole-page and manual-card Claude asks with a generation.
Advance it under subscription then login cache locks, so publication
cannot check the old generation and then commit after the ask.
- Capture the generation before launching LoginUsage/SubscriptionUsage;
reject an older account read or leave the cards due for another read.
- Record each Claude /usage run's ask generation. Keep timestamps, the
zero sentinel, floor, idle behavior, saved-account scope and fallbacks.
- Document ordering and lock ownership in the providers/accounts design.
No tests, routing.go, account files or dependency versions changed.
Run on upstream
|
||
|
|
abdc4b113d |
netproxy, provider, gateway: every request to the ChatGPT backend goes over HTTP/1.1, magpie's own too, not only the gateway's turns (#1700)
|
||
|
|
751e05d824 |
provider: moved Cursor users get plugin 0.2.10, which counts a Team's org-wide on-demand pool as the limit (#1868)
@magpie-community/opencode-cursor-auth 0.2.10 (magpie-community/plugins a885a16) gives a team member with no limit of their own a fixed On-demand window on the team's pool (pooledUsed / pooledLimit, the member's own spend beside it) instead of unlimited, the same change as the built-in's in the previous commit. keepMovedCurrent updates every moved user's plugin to it. Run: 0.2.10 checked on registry.npmjs.org (latest, its tarball holds the fix); go test -tags nogui ./internal/provider/ under a sandbox HOME (ok, TestMovedBuiltinsSayTheirPlugin included); gofmt -l and go vet on darwin, linux (nogui) and windows clean. |
||
|
|
9ddcee10ac |
provider: a Cursor Team member with no limit of their own spends the team's on-demand pool, shown and counted as the limit, not as unlimited (#1868)
PaSSw0rds' Team account (#1476) has on-demand turned on for the whole organization: spendLimitUsage has no individualLimit, pooledLimit "45120000" and pooledRemaining "38785730" are int64 strings, pooledUsed 6334270 a number, and GetHardLimit answers {"hardLimit": 451200} with or without a team id. cursorOnDemandOf read that as unlimited, as cursor-agent's own usage view does, so On-demand showed only the member's $198.55 at 0%, aside, and a spent team pool never counted the account used up; magpie would keep routing to it until Cursor refused. Now a team member with no individualLimit and a pooledLimit > 0 gets a fixed On-demand window on the pool: used = pooledUsed / pooledLimit, display "$63,342.70 / $451,200.00 (you: $198.55)", not aside. A hard limit that forbids on-demand still reads as disabled, and a team with no pool and a hard limit still as unlimited. Dollar figures group thousands (cursorDollars), as plugin 0.2.10 does. This is the built-in, for users who haven't moved to the plugin; moved users get the same from @magpie-community/opencode-cursor-auth 0.2.10 (next commit raises the mover's min). Run, under a sandbox HOME with pinned caches: go test -tags nogui ./internal/provider/ (ok); gofmt -l; go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows (clean). Broken by hand: with the old cursor_usage.go, TestCursorOnDemandKeepsTheAccount/a_team's_org-wide_on-demand_pool_is_the_allowance fails (On-demand "$198.55", used 0, aside; the spent pool "used up false"); with a fix that puts the member's spend against the pool, it fails too. Built from the payloads quoted in #1476. Not tried against a real Team account. |
||
|
|
f31ae38aeb |
provider: Xiaomi MiMo is priced at xiaomi's list price, not its Token Plans' $0, and pay as you go looks only in xiaomi (#1873)
mengyianx found every pay-as-you-go MiMo call counted at $0.000: models.dev's xiaomi-token-plan-cn, -sgp and -ams list all nine models at cost 0 (the plan's per-token charge, not the model's price), the preset's catalog was "xiaomi-token-plan-cn, xiaomi" at every region, and catalog.PricedBy takes the first catalog with a cost field. makerCatalogs puts the plan catalog ahead of xiaomi too, so the maker fallback gave $0 as well. What changed: - membershipCatalogs (never read for a price) gains the three xiaomi-token-plan catalogs, as #1370 did for Kimi Code. That covers ListPrice, MakerPrice and PricedName through makerPriceCatalogs. kimiCodeMember now checks a list of Kimi Code's plans of its own (kimiCodePlans), so a Xiaomi provider isn't taken for Kimi Code and its ids aren't mapped to Kimi's. - Each Xiaomi region names its own catalog: plan-cn/sgp/ams "xiaomi-token-plan-<r>, xiaomi", pay as you go "xiaomi" alone. A plan user is priced at the API-equivalent price, the same meaning as #1370. - PricedBy is unchanged: a catalog that lists a model at $0 still prices it at $0 (nvidia, modelscope have truly free models). - docs/subsystems/providers-accounts.md says so. Providers saved before this: the preset's own catalog stays "xiaomi-token-plan-cn, xiaomi", the same string an existing provider saved with the old default holds. normalize already lets a catalog that equals the preset's or one of its regions' follow the region the provider is at (the Tencent Cloud mechanism), on every read, so an old default at pay-as-you-go reads as "xiaomi" and at Singapore as "xiaomi-token-plan-sgp, xiaomi"; nothing is written to providers.json until the user next saves it. Any other catalog the user typed is kept as typed, and is priced right anyway because the plan catalogs are out of pricing. The one value that can't be told apart is a bare "xiaomi" typed at a plan region (the issue's workaround, which was for pay as you go): it equals the pay-as-you-go region's catalog, so it reads as that plan's "xiaomi-token-plan-<r>, xiaomi". Its prices are identical either way; only the model-metadata lookup order differs. That is the existing rule for every preset with region catalogs, kept rather than special-cased. Siblings: scanned the models.dev cache (read only) for catalogs whose priced models are all or mostly $0. Of those, only kimi-code-plan-* and xiaomi-token-plan-* are named by any preset or region. stepfun's *-step-plan catalogs carry no cost at all, so they never shadowed a price. alibaba/minimax/zai/zhipuai/volcengine/tencent coding and token plan catalogs are all-$0 on models.dev but no preset uses them. Tests (internal/provider/xiaomi_price_test.go, fixture testdata/xiaomi_catalog.json cut from models.dev's real entries): - TestXiaomiListPrice: every region, the old default, a user's own catalogs: mimo-v2.6-flash $0.14/$0.28/$0.0028, mimo-v2.6-pro $0.435/$0.87/$0.0036; MakerPrice; EffectivePrice of a saved provider; a relay's own $0 model ahead of xiaomi stays $0; a Xiaomi provider is not a Kimi Code member. - TestXiaomiRegionCatalogs: each region resolves to its catalogs from the preset's, the old default and another region's; import links at each region; FromPreset; a user's catalog kept at two regions. Broken by hand, each red, then restored: - membershipCatalogs back to Kimi only: TestXiaomiListPrice FAIL, plan regions and MakerPrice at $0. - region catalogs removed: TestXiaomiRegionCatalogs FAIL (api with the old default stays [xiaomi-token-plan-cn xiaomi], imports at sgp/ams get cn's). - both: TestXiaomiListPrice FAIL, api with the old default at $0 (the reported bug). - kimiCodeMember on membershipCatalogs: FAIL "a Xiaomi Token Plan provider counts as a Kimi Code membership". - PricedBy's exact match skipping all-zero costs: FAIL "relay mimo-v2.6-flash: ... want its own $0". Run: gofmt -l (nothing); go vet ./... on darwin, GOOS=linux -tags nogui, GOOS=windows; go build on all three; go test -tags nogui -count=1 ./internal/provider ./internal/catalog ./internal/cli ./internal/gui ./internal/usage, all ok, in a sandbox HOME with pinned caches. Real use: built binaries before and after, sandbox HOME with a copy of the real models.dev cache and a providers.json holding the reporter's saved state. `magpie model price xiaomi/mimo-v2.6-flash` printed $0/$0 before and $0.14/$0.28 after; an old-default provider at Singapore went $0 -> $0.14/$0.28 and shows catalog "xiaomi-token-plan-sgp, xiaomi"; one with the user's "openrouter, xiaomi" kept it; providers.json was byte-identical afterwards. Not tried: a real MiMo key or call, the GUI editor's region switch, the full go test ./... suite. Co-authored-by: mengyianx <106875577+mengyianx@users.noreply.github.com> |
||
|
|
841af36bfc |
gateway: models the user disabled are refused on every route, and leave every list (#1867)
oxsean asked for one place to turn a model (claude-fable-5) off for good:
not reached by a direct request, an old session, a routing group member,
a fallback, a sub-agent, count_tokens or a decision model.
What changed:
- settings.DisabledModels: patterns, an exact id or a glob (* any run, /
included; ? one), matched ignoring case against provider/model, the
bare id and its last segment (provider/disabled.go). Empty by default,
so nothing changes for anyone who doesn't set it.
- Lists: buildEntries (entriesOff) leaves a disabled model out of the
catalog, so /v1/models, agents' model files and pickers, Codex's list
and every group go without it; membersIn skips it as a member, Deciders
as a decision model; codexModels drops Codex's own disabled slugs and
codexListTag changes so Codex refetches.
- Requests (gateway/disabled.go): 403 "model <id> is disabled in magpie"
in each API's error shape, at #882's choke points: serve (idOff),
perKeyBarred (no candidate: group next member, provider Fallback),
count_tokens and Gemini :countTokens, serveSystemOne,
serveDecisionGroup and postDecide, draw/video/embeddings, and
codexBackend for Codex's own bare models. A group with a member left
goes on without it; one with none left is refused naming them. A bare
id the catalog no longer has is refused as disabled, not 404. A Codex
sub-agent pick onto a disabled model stays on its lead's model.
- An unreadable settings.json is never "none disabled": the list read
last stays; with none read, every request is refused; nothing is
written over the file.
- CLI: magpie model disable <model|glob>..., enable ..., disabled
(list-disabled).
- GUI: Settings > Models > Disabled models: each pattern with the models
it matches now and Enable; Disable... opens the model picker, which
also takes a typed glob. Says only requests through magpie are covered.
POST /api/settings/disabled-models; POST /api/settings keeps the list.
Strings in zh, zh-TW, ja, de.
- docs/subsystems/gateway-routing.md: Disabled models section.
What was run (worktree at origin/main
|
||
|
|
f94809d23e |
agent: Claude Code isn't handed 272000 for a routing group made only of Claude models (#1741, yanjieee)
writeCompact gives a Claude model its own window (no
CLAUDE_CODE_AUTO_COMPACT_WINDOW unless the user set a threshold), but
claudeModel looks only at the id's last part, so group/auto-claude-opus-5-5
or any group of Claude [1m] models was told magpie's default 272000.
provider.ClaudeGroup is true when every member of a group (nested groups
flattened, by the listed name or the wire name, Bedrock names included)
is a Claude model; writeCompact now treats such a group as it treats a
Claude model. A group with another vendor's model keeps 272000. A
threshold set on a member's provider still comes first (CompactSet), and
the user's own env, autoCompactWindow and modelSettings are untouched.
Siblings: only Claude Code has a Claude exemption. Codex (codexcat
work.Working, route.go/models.go CompactFor) applies the working window
to every model, so has no group misread. claudeOutput's claudeModel uses
are about output tokens and are left as they are. Part (b), per-model
modelSettings windows, is tracked separately.
Run: TestClaudeGroupCompactWindow (new) fails on the old writeCompact
("a group of Claude models: 272000"), passes now, with a user-owned env
500000 and autoCompactWindow 900000 kept; go test ./internal/agent
./internal/provider; gofmt -l; go vet darwin, linux -tags nogui, windows.
Not tried in a real Claude Code session.
|
||
|
|
b3805203d8 |
gateway: drawing reads a relay's whole model list for which key serves an image model, and a key's 404 about the model asks the next key (#1657)
What: Provider.Serves now reads a new catalog.LiveAll (the fetched list
with image and video models kept) instead of live(), which drops Draws and
Films models. The draw key loop and the custom video path move on to the
next key when a key answers 404 whose body says the model isn't served
(keyLacksModel = 404 + modelRefused's wording); any other 404 still stops.
Why: wangru8080's analysis on #1657. A relay whose per-key lists name
gpt-image-2 under one key only still had drawing try a key that lacks it:
Serves read a list with the image model filtered out, so every key looked
unlisted, and that key's 404 "Model ... is not supported by any configured
account in this group" ended the loop instead of asking the next key.
Embeddings already move on any error short of the last key.
Run (sandbox HOME, private GOCACHE, worktree at origin/main
|
||
|
|
125dad5cbb |
gateway: a codex provider used only through routing groups keeps the ChatGPT account's own models out of Codex's list (#1602)
With Codex signed in to ChatGPT, Codex asks magpie's /backend-api/codex/models
for its list, and codexModels passes the backend's own models through,
narrowed only by the codex provider's picks (CodexNativePicked) and the
Agents page's hides (CodexNativeHidden, built from Catalog()). A provider
set to "Only through routing groups" (Provider.Unlisted) has none of its
models in Catalog(), so neither filter saw them: all of the account's
models stayed in Codex's picker, and the Agents page had no Codex group to
hide. Every other agent's list is Catalog-based and already left them out.
provider.CodexNativeUnlisted says which of the account's models are kept
out of agents' lists: every one when the codex provider is Unlisted, and by
slug those a group with Unlists names. codexModels drops them (hidden
entries such as codex-auto-review stay, as with picks; a Codex reached for
failover alone keeps them, as it is handed no groups), spawnChoices drops
the same ones from spawn_agent's list, and CodexListTag carries them so
Codex refetches. gateway-routing.md says so.
Test: TestCodexModelListUnlistedForGroups (a group unlisting gpt-5.5 takes
gpt-5.5 alone; the provider Unlisted takes gpt-6-sol and gpt-5.5 and keeps
codex-auto-review; ETag changes; spawn_agent offers neither; own-only keeps
them). With codex_backend.go and codex_spawn_models.go reverted it fails on
all three checks. Not tried with a real ChatGPT sign-in and Codex app.
Run (sandbox HOME, private GOCACHE, worktree at origin/main
|
||
|
|
aa1b04c324 |
provider: moved Cursor users get plugin 0.2.9 and WorkBuddy users 0.1.18 (magpie-community/plugins#55, #18)
Cursor 0.2.9: a default model whose own branch stops short of the asked effort goes to its nearest effort, so the id and its parameters agree. WorkBuddy 0.1.18: WorkBuddy 5.6+ keeps its desktop sign-in encrypted; the plugin now says so and points to the browser sign-in, instead of "isn't signed in" and a 502. Both versions checked on registry.npmjs.org (dist-tags latest). Run: gofmt -l, go vet (darwin, linux -tags nogui, windows) and go test ./internal/provider -run 'Mov|Plugin|Migrat|Hand'. |
||
|
|
091593f7d3 |
gateway, gui: a WorkBuddy account the vendor restricted (403 11140) rests 2 hours as restricted, and Routing names the appeal as the way back (#1849)
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
|
||
|
|
285e17b061 |
provider: a moved Kiro shows the model a tool's images, Codex's view_image among them (#1861)
simonsmh (v0.1.1215) saw Codex's view_image and screenshot results come back empty on a Kiro subscription. magpie hands Kiro's plugin an Anthropic body whose tool_result holds the image as a base64 image block, but the plugin (@magpie-community/opencode-kiro-auth up to 0.1.8) read only a tool_result's text, so the image was dropped and the model was told "(no output)". #369 had fixed this in the built-in for Claude Code; the plugin never got it. Kiro plugin 0.1.9 (magpie-community/plugins 66facac) sends a tool's images with the userInputMessage that answers the call, latest images only, as the built-in does. This raises the mover's min to 0.1.9, so keepMovedCurrent updates every moved user. tool_images_1861_test.go builds the request from what codex-rs 0.162 sends (FunctionCallOutputContentItem, view_image's input_image data: URL with detail "high") and checks the handoff to the plugin (the image in the tool_result, bytes intact) and the built-in Kiro body. Both pass on the old code too: the bug was in the plugin, whose tool-images.test.mjs fails 3 of 4 on 0.1.8. gateway-routing.md says how a tool's images reach the model on each translation. Run: gofmt -l; go vet darwin, linux -tags nogui, windows on internal/gateway and internal/provider; go test -tags nogui ./internal/gateway ./internal/provider (sandbox HOME, ok); the plugin's bun test (1152 pass) and scripts/check.mjs; npm view on registry.npmjs.org shows 0.1.9. Not tried: a real Kiro account, or real Codex against it. |
||
|
|
248a68598c |
gateway, provider, gui, cli: a key+URL provider may be sent the agent's own User-Agent in place of magpie's (#1851)
Every forward went with User-Agent magpie/<version>. A coding plan that serves only the agents it names (pi, OpenCode, Claude Code…) knows them by their User-Agent, so it turned magpie away. What changed - provider: PassUserAgent (passUserAgent in providers.json), off by default. PassesUserAgent takes it only for a key+URL provider: never a signed-in account, a plugin's, or a vendor whose own client magpie goes as (OwnClient: OpenCode, Cline, Kilo, another magpie). A copy keeps it. - gateway: userAgentFor in forwardOnce (chat, Anthropic, Responses, Gemini, count_tokens) sends the inbound User-Agent unchanged where the provider passes it on. It sends magpie's where it doesn't, where the agent sent none, and on magpie's own requests (magpiesOwn: magpie/…, magpie-router/vision/search, the image tool's "<client> magpie-image/1", which is built from MCP clientInfo, not a User-Agent). magpie never invents another client's. The claude-cli/Codex header copies, the OpenCode/Cline/Kilo overrides and account signing run after it as before, and the user's header.User-Agent is put on at signing, so it wins. - gateway: embeddings, images and videos (retrieveFrom, sendWith, remoteVideoContent) now stamp the same for a key+URL provider through stampUA, from the caller's User-Agent kept on the request ctx (caller.ua, withCaller). Before, they went with Go's default (Go-http-client/1.1). Account and remote-magpie paths are untouched. - cli: `magpie provider set <id> user-agent=agent|magpie`, refused for a signed-in account; `magpie provider <id>` shows it. - gui: the provider editor's User-Agent row, "Send the agent's own User-Agent", with an explanation, for a provider with a key only (the JSON says ownClient for presets and providers); en/zh/zh-TW/ja/de. The TUI only adds presets, so it has no field for this. - docs: reference.md (provider set) and subsystems/gateway-routing.md. What was run - gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows. - go test -count=1 ./internal/gateway ./internal/provider ./internal/cli ./internal/gui: all ok (sandbox HOME, private GOCACHE). - TestUserAgentPassedOn covers 7 routes (messages, count_tokens, chat, responses, gemini, embeddings, images) x off / on / on with no UA / on with magpie-router/1 / on with the image tool's UA / the user's header with it on and off. TestUserAgentAccountUntouched: a Factory account with passUserAgent in providers.json is still asked as factory-cli/. Also TestUserAgentClaudeCodeAsBefore, TestUserAgentFor, TestPassesUserAgent, TestAddCopyPassUserAgent, TestProviderUserAgentPair. - Broken by hand, each went red: forwardOnce back to magpie's UA (5 routes red); stampUA removed from embeddings/draw (both red, seen as Go-http-client/1.1); PassesUserAgent ignoring accounts/OwnClient; magpiesOwn dropped (the internal UAs leaked on all 7 routes); the GUI row shown for OpenCode and Save not posting it. - provider-user-agent.test.cjs: 60/60 in chromium and webkit, en, zh, zh-TW, ja, de, at 900 and 440 wide. The provider/editor/add/i18n GUI tests in chromium: 244/244. Not run - Not tried against a real coding plan that checks User-Agent, nor with a real agent through a live gateway. Videos have no test of their own (they go through sendWith, which the images test covers). - The GUI suite was not run in full; the Windows box was not used. |
||
|
|
fd03592331 |
provider: WorkBuddy AI's GLM models are text-only, so magpie's image-describing model reads their images; the plugin to 0.1.16 (Yirasumi on Discord)
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.
|
||
|
|
d9bb0fbc84 |
provider: moved Command Code users get plugin 0.1.12, whose model list follows the account's plan (01huadalang on Discord)
Command Code 0.1.12 (magpie-community/plugins 49e9d89): Command Code's model list is the same for every plan, and the plugin filtered only Go's, by the CLI 1.73.0 table, which lacked Claude Haiku 5.5. So a Go account was shown a model only GOAT and above may use, and GOAT, Pro and Provider accounts every model, those their plan refuses included. Each plan's list now leaves out what the CLI 1.79.2's table refuses it; a plan that can't be read, or an account with bought or free credits, keeps the whole list, and a refused model still reaches the agent as Command Code's MODEL_NOT_IN_PLAN. Only the mover's min string and its note change. 0.1.12 was checked on npm with npm view. Ran: gofmt -l internal/provider, go vet ./internal/provider on darwin, linux and windows, and go test ./internal/provider -run 'Mov|Migrat' (ok, 8.6s). The full suite was not run, as this is a one-string change. |
||
|
|
58b6ad2e80 |
claude: with CLAUDE_CONFIG_DIR set, the keychain item read and written is the one Claude Code keeps there (#1842)
What changed: magpie read and wrote Claude Code's own sign-in under the service "Claude Code-credentials" whatever CLAUDE_CONFIG_DIR said. Claude Code 2.1.296 names its item "Claude Code-credentials-<sha256(dir)[:8]>" when CLAUDE_CONFIG_DIR is set (j$ in its secure storage: the suffix is dropped only when CLAUDE_CONFIG_DIR is unset), which is what claudeDirService already computes for saved accounts' directories. Now claudeHomeService gives that name for the read (both the account's item and by service alone) and for saveClaudeCredential. Why now: the previous commit asks the account's item before the file, so with CLAUDE_CONFIG_DIR set the plain "Claude Code-credentials" item — the default directory's sign-in, maybe another account — would have beaten the .credentials.json in CLAUDE_CONFIG_DIR. It was already wrong before that commit (a sign-in was written to an item Claude Code under that directory never reads), only less visible. Run (tip of both commits, sandbox HOME, fake `security` on PATH, private GOCACHE): TestClaudeConfigDirKeychainItem fails with claudeHomeService ignoring CLAUDE_CONFIG_DIR (it read "home-item") and passes with it. gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows pass; go test -count=1 ./internal/provider ok (116s); go test -race -count=5 on the keychain tests ok. Not run: no real Keychain, no real Claude Code run under CLAUDE_CONFIG_DIR (the name rule is read from the 2.1.296 binary), no other package's tests (only internal/provider changed). |
||
|
|
31956b92f0 |
claude: a fresh sign-in goes into the keychain item Claude Code reads, not beside it (#1742, #1842, iefnaf)
What changed: readClaudeCredential asked the Keychain only when the
credentials file held no sign-in. On a Mac whose "Claude Code-credentials"
item is there but emptied (what Claude Code leaves of a sign-in Anthropic
refused to refresh), an older, parseable ~/.claude/.credentials.json was
taken for the sign-in: a sign-in made in magpie was written into that file,
the dead item stayed, Claude Code stayed signed out, and a minute later
claudeIdentity's loggedIn: false lapsed the account and took the provider
out. Now the item under the account ($USER) is read first, emptied or not,
as Claude Code reads it: its own storage asks the Keychain first and reads
the file only when the item is absent, empty or no JSON — the rule
readClaudeDir already applies, with its own test, to the item in a saved
account's config directory. putClaudeLogin, reusing what was found, puts a
fresh sign-in into the item. The item is asked by service alone only after
the file has no sign-in, as before (an earlier sign-in's leftover,
|
||
|
|
4c1e6db0fa |
gateway, provider: an image model the vendor turns away in chat, naming its images API, draws there (#1837)
What: when a drawing asked on chat completions comes back 400/422 with the vendor's message naming images/generations, magpie asks the images API with it (and the other way round: an images-API refusal naming chat/completions goes to chat), and tells that second answer. Before, only a 404/405 moved a drawing to the other API. The model test in the provider editor does the same for an image model (DrawsID) refused in chat that way, so it is tested where the gateway draws with it. catalog.PointsToImagesAPI / PointsToChat are the one shared check. Why: #1837, omp's generate_image with Settings > Image generation on agnes-image-2.5-flash got 400 "Model agnes-image-2.5-flash is an image model. Use /v1/images/generations". catalog.ImagesAPI goes by name, and agnes-image-2.5-flash reads like gemini-*-flash-image, which chat, so it went to chat completions and the vendor's 400 was passed on. The vendor's own words are the rule now, not one more name in the list. Run: TestDrawGoesWhereTheVendorPointsIt (gateway; the reporter's exact 400 body) and TestTestModelsGoesWhereTheVendorPointsIt (provider) both fail on the old draw.go / test.go and pass now. gofmt -l clean; go vet ./... on darwin, linux (-tags nogui) and windows clean; go test ./internal/catalog ./internal/provider ./internal/gateway green. Not run: against Agnes's real API (no account); the 400 text is the one in the reporter's screenshot. Image models stay out of chat agents' model lists as before (catalog.Chat / LiveDrawers): the omp error came from magpie's image tool, not from omp's chat model list. |
||
|
|
2221b63f93 |
agent, provider: tests no longer read the machine's /Applications or Program Files, so a Mac with DeepSeek Harness.app installed keeps TestAsideOfflineDisconnectRestoresWithoutDaemon green (#1823)
What: every place magpie looks for installed apps outside the home folder now goes through proc.SystemDirs, which in a test binary testenv isolated puts the path under the test's home (as it already does for Homebrew's bin, #1525): - agent: a new macAppFolders(home) (/Applications via SystemDirs, plus ~/Applications) is used by appFolders (desktop apps: Codex, dsh), pencilApp, t3App and reasonixDetected; - cursorLocalRoots: macOS through macAppFolders, Windows' ProgramFiles and Linux's /opt, /usr/share, /usr/lib through SystemDirs; - zedAppPath's /Applications/Zed*.app, npmGlobalPrefix's ProgramFiles npm fallback, and provider's /Applications/ZCode.app builtin config. Production behaviour is unchanged: SystemDirs returns paths as they are outside a sandboxed test. Why: HasApp/AppVersion read the real /Applications, so on a Mac with DeepSeek Harness.app the dsh fixture's CLI was never "missing" and the test failed every time; CI has no such app, so nobody else saw it. The same shape was in five other readers. Test: TestAppFoldersStayInTheTestHome checks every app folder lies under testenv's home (all OSes), and on macOS that an app installed in the sandbox's /Applications is the one found. Run (go1.26.8, sandbox HOME, private GOCACHE): - repro on old code: appFolders pointed at a temp folder holding a fake "DeepSeek Harness.app/Contents/Info.plist" (com.deepseek.dsh) -> TestAsideOfflineDisconnectRestoresWithoutDaemon FAIL "native fixture must report missing CLI". - break check: macAppFolders put back to the literal /Applications -> TestAppFoldersStayInTheTestHome FAIL (appFolders, macAppFolders, cursorLocalRoots look in /Applications; sandbox app not found). Restored: pass. - gofmt -l clean; go vet ./... (darwin), GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: clean. - go test -tags nogui ./internal/agent ./internal/proc ./internal/provider: ok. - -race -count=5 on the touched agent tests: ok. Not run: the full go test ./...; Windows and Linux test runs (vet only); reasonix's Windows registry lookup and Zed's mdfind fallback still ask the machine (not folder paths) and are left as they are. Reported-by: mdwsk88 |
||
|
|
8792ee063d |
provider: a Volcengine or Tencent access key is kept through sync, restore, a stale editor and a copy, and a plan card without one says what to give (#1821, Edward4226)
The reporter's Volcengine Agent Plan card vanished: providers.json had
lost accessKeyID/secretAccessKey, and volcPlanQuotas skipped a provider
without them before building any card, so nothing said why.
Writers that dropped the access key, fixed at the cause:
- Sync and restore (Mirror, Restore, davsync take) kept this machine's
access key and balance token only when the incoming provider had no
key at all. A magpie before v0.1.1142 (
|
||
|
|
10d60b1899 |
provider: a provider saved with Select none serves no models, unlisted or not (#1818)
Select none saved `models: []`, which omitempty wrote as no models key at
all, so the provider read back as "no picks" and served the first 24 of
the vendor's list on /v1/models, in auto groups and on the card, while
the editor said none would be served.
What changed:
- Provider.NoModels (json noModels) records the choice; ServesNone() is
NoModels with no picks. A file with no models key still serves the
vendor's list as before.
- Exposed() is empty for it, so the catalog, /v1/models and auto groups
leave it out; resolveIn refuses an explicit pid/model to it; listedBy
and Deciders skip it (a decide-only provider is still a decider).
- SetModels and normalize clear NoModels once there are picks.
- GUI: the editor sends noModels on Save, an edit that omits it keeps it,
the card's exposed count is 0, the hint says nothing is served; with
unlisted the dashed chips explain they are only for groups. Strings in
en, zh, zh-TW, ja, de.
- CLI: `magpie provider models <id> none`.
- docs/subsystems/providers-accounts.md describes it.
Decision (owner delegated): Select none means none, whether or not
unlisted is on; unlisted keeps meaning "hide from the list, still
usable by groups that name it".
Run:
- go test ./internal/provider ./internal/gui ./internal/cli -count=1
(green; second pass ran too) with private GOCACHE and sandbox HOME.
- Broke Exposed's ServesNone check: TestSelectNoneServesNone red
("exposed 24"); broke resolveIn's: red ("watched/m0 resolved"); broke
the GUI keep line: TestProviderSaveSelectNone red ("exposed 24").
- GUI tests chromium + webkit, 5 languages: provider-none-picked 20/20,
provider-draft-picks 10/10 (red with noneChosen broken), plus 12
related model/group/editor tests green.
- gofmt -l clean; go vet darwin, linux -tags nogui, windows clean for the
three packages.
Not run: the gateway package; Codex native model narrowing is unchanged.
searcher-pick.test.cjs fails 3 webkit cases (hover timeout) identically
on the unmodified base
|
||
|
|
3a4df527f5 |
plugin, provider, gateway, upstream: a test whose check fails while its fake vendor holds a reply ends with a FAIL, not a package hung until -timeout (#1808)
TestNPMInfoDeadline's fake npm held slow-one's reply on <-release, closed only
on the happy path. A check firing first under load (on the issue's machine,
the quick ones missing at npmAll = 300ms) left the handler held, and
httptest.Server.Close, run in the test's cleanup, waited for it forever:
the whole internal/plugin package hung to -timeout and lost every result.
- TestNPMInfoDeadline: a t.Cleanup registered after fakeNPM (so it runs
before the fake's Close) lets the handler go once (sync.OnceFunc). Its
timing assumptions, all listed: the 2s wall-clock bound on Info is gone
(slow-one is held and npmEach is an hour, so Info coming back at all is
npmAll at work; a minute only turns a wait into a FAIL); npmAll is 5s,
the quick ones' time to answer on a loaded machine, not 300ms; the slow
one's kept answer is polled for 30s, not 3s.
- The same pattern in its siblings, each fake handler blocked on a channel
only the happy path closed, now let go by a cleanup/defer that runs
before the server's Close: TestRestartFinishesTheReply (plugin),
TestPastedAddressAndCallbackFinishOnce, TestPartnersFetchedLastIsHeld
(provider), TestBusy (before gw.Close too, whose request waits on it),
TestLaneReleasedOnFailure (gateway), TestReadOnceInFresh (upstream; its
100ms bound on Of goes the same way as the 2s one: the page is held, so
Of coming back is its not waiting, 10s being short of the read's 15s).
- Audited, already right: grok_accounts, quota_refresh_order,
quota_history_waiter, subscription_usage, sub2api_usage, qoder, routing,
github_test, session_route, request_encoding, key_limits, vertex (quit),
plugin_usage (r.Context).
Run, in a sandbox HOME with pinned caches:
- Old TestNPMInfoDeadline with its check forced (took > 0): "httptest.Server
blocked in Close", panic at -timeout 30s. With a 500ms delay injected into
the fake's answers (a loaded machine): FAIL at the quick-ones check, then
the same hang. New test: with the delay injected, PASS (5.55s); with the
check forced, FAIL in 5.5s and the package's other tests run; with
npmAll an hour (the deadline broken), "Info waited for the slow package"
and the package ends.
- Each sibling with t.Fatal injected while its handler is held: old code,
all five httptest siblings hang to -timeout 90s ("blocked in Close"),
upstream's stalls ~56s; new code, each ends at once with FAIL.
- go test -race -count=5 of every touched test: pass.
- gofmt -l (nothing), go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: clean, before and after rebasing onto
|