ac4af582301a4e8a29245dbba767eba31334ddf9
19
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ee7b8b0723 |
commandcode: a key's Credits window says GOAT/Go/Pro's month in credits, not dollars
jiezhengj on Discord (#feedback): Command Code GOAT says "$100 on
DeepSeek V4.1 Flash", but magpie's bar counts against $70. Command Code
counts Go, GOAT and Pro in usage-value credits
(docs/resources/usage-limits: "full-allowance models like GLM-5.2 get
$1 of usage per credit, and lower-allowance models draw proportionally
more credits per dollar"); GOAT's month is 70 of them, $100 of DeepSeek
V4.1 Flash or $70 of GLM-5.2 (pricing page, read 2026-11-01). The 70 is
right: command-code 1.88.2's getPlanInfo still has individual-goat 70,
and billing/credits' monthlyCredits counts down in the same units. The
signed-in subscription's card, served by the plugin, says "credits"
since 0.1.20 (plugins #556; mover min is 0.1.21). magpie's own card for
a Command Code key (cmdQuotaOf, via cmdKeyWindows) still said
"$28.80 / $70.00" and added bought dollars into the pool.
Now, as the plugin: on Go, GOAT and Pro the window is "28.80 / 70.00
credits", used of the month's credits alone, with bought and free
credits said beside it ("+ $5.00 extra"); Max, Ultra and Teams Pro keep
the CLI's dollar pool; Provider, pay as you go, has no month.
Run (mote): go test ./internal/provider -count=1 ok at this commit on
origin/main d1a94f579; at the same change on
|
||
|
|
ff7048dece |
provider: a Command Code plan key's Credits window renews at the plan's period end (#2454)
#2451 drew a plan key's month of credits as a Credits meter beside the 5-hour and weekly windows. Those two say when they start again; the Credits one said nothing, though cmdKeyPlanID already asks billing/subscriptions for the plan id and threw its currentPeriodEnd away. cmdKeyPlanID now keeps the period end beside the plan id (cached the same ten minutes, and the pair read before kept while the endpoint can't be read), and cmdQuotaOf puts it on the Credits window's ResetsAt. No new request. The signed-in subscription's card is the plugin's since be62bcf79; the plugin sets the same reset from commandcode-auth 0.1.13. Patch by ggbdpq (Discord gua2100), as rebased in #2454. Added in review: a period end already past is dropped, so a pair kept while the endpoint fails, or a renewal its reply doesn't show yet, never puts a reset in the past on the card; the test has a case for it. Run (sandbox HOME, at origin/main |
||
|
|
be62bcf79e |
provider: Command Code's built-in is retired; its plugin serves it
commandcode-plan joins retiredBuiltins (migrate.go): PluginServes is true
for it moved or not, and @magpie-community/opencode-commandcode-auth does
its sign-in, models, requests and usage.
Removed
- Sign-in: the StartSignIn case (startCommandCodeSignIn, the Studio
callback, cmdOrigins, cmdWhoamiWait, commandCodeCallback/Keep) and the
pasted-key branch (commandCodeKey, cmdSignedIn).
- Accounts: commandCodeAccount, cmdProvider, cmdSide, cmdLoginList,
switch/on/forget (switchCommandCodeLogin, setCommandCodeLoginOn,
forgetCommandCodeLogin, commandCodeAlsoOn), the Logins case, and the
per-login usage (cmdLoginQuota, cmdQuota, the perLogin fetch). The
Logins("") list keeps {CommandCodePlanID, nil} so its order holds.
- The Go plan's path: CommandCodeGenerate, cmdGoModels/cmdGoFetch/
cmdGoRefused, cmdModels, cmdFree/cmdMarkFree, cmdPlansSeen's built-in
users (cmdRemember, cmdPlanKnown, cmdPlanNow), CommandCodeOutputOf, and
the account's generate field.
- asksOwnBackend's Command Code case.
- Gateway: the cmdGenerate/serveCommandCode dispatch and countOn's
cmdGoing clause; internal/gateway/commandcode.go (the /alpha/generate
translator) deleted.
- Built-in-only tests: gateway commandcode_test.go and
commandcode_place_test.go, TestBillingLineLeftOutOnCommandCode;
provider commandcode_go_test.go, commandcode_go_models_test.go,
commandcode_free_test.go, TestCommandCodePlan,
TestCommandCodeSignInWhoamiDown, TestCommandCodeSignInAgainToRemovedOwn,
TestCommandCodeSignInPastedKey.
- Docs: Command Code out of gateway-routing.md's bridge lists (the
2xx check, structured output, tool images, the billing line).
Kept, and why
- The mover and what it reads: cmdAuth, cmdOwn, cmdWho, cmdLogin,
cmdSaved, cmdLogins (migrate_side.go, plugin_accounts.go).
- cmdAPI/cmdStudio (plugin_usage.go's moved card), cmdKeysURL
(pluginsignin_paste.go), the plan and credit readers (cmdPlans,
cmdPlanOf, cmdPlanName, cmdWindows, cmdLeft, cmdQuotaOf, cmdTime,
cmdSubscription, cmdKeyWindows, cmdKeyPlanID): the keyed preset
"commandcode", planquota.go, balance.go and qoder_usage.go use them.
- CommandCodeMaxOutput (models.go caps the plugin's "commandcode-plan"
models with it), estimatedMoved, chat.go's plugin host cases, the
gateway parity tests, and the PLUGIN-SERVED notice in
commandcode_plan.go, now in the retired wording.
Tests whose meaning changed
- TestLoopbackSignInsTakePastedAddress no longer starts Command Code's
built-in sign-in; the plugin's (TestLoopbackPorts) says its key is
posted, never pasted as an address.
- The Go plan's free-model marks (TestCommandCodeFreeModels) were the
built-in's alone; the keyed preset never marked them.
Run (worktree magpie-wt-rt-a, on top of 9a64c4025)
- gofmt -l internal: clean
- go vet -tags nogui ./... (darwin, GOOS=linux, GOOS=windows): clean
- staticcheck U1000 on ./internal/...: no declaration unused that wasn't
unused at HEAD
- go test -tags nogui -count=1 ./internal/provider/ -run
'CommandCode|commandcode|Migrat|Move|Moved|Retir|SignIn|AsksOwnBackend|
SideLogin|Logins|Unmoved|Paste|Loopback|Account|PlanQuota|Balance|
FetchNew|FetchingNew|LeftAlone|Identit|Order': ok (100s)
- same, -run 'Usage|Card|Quota|Discovery|Exposed|Models|Output': ok
- ./internal/gateway/ -run 'CommandCode|commandcode|Plugin|Parity|Moved|
BillingLine|Search|ShapeFallback|GroupFails|CountTokens|Count|Format|
ToolImage|Cursor|Connect': ok (117s)
- ./internal/cli/ ./internal/gui/ -run 'CommandCode|commandcode|Plugin|
Retired|Moved|SignIn|Login': ok
- Not run: whole packages, the full suite, the GUI node suite (the
machine is loaded; the parent runs those).
|
||
|
|
ba17c4f90d |
provider: a Command Code plan key's card shows the month's credits as a meter (#2451)
tianxia3111 runs Command Code on the keyed preset with a plan's key. Its
card showed the 5-hour and weekly windows as meters, but the month's
credits only as dollars left ($5.27), with no share of the month. The
cause: billing/credits leaves out the planId, so the key's card couldn't
know the plan's monthly pool. The signed-in subscription's card gets
that pool from billing/subscriptions.
The key's card (planKeyWindows -> cmdKeyWindows) now asks
billing/subscriptions with the same key for the plan. It then makes the
month a "Credits" window beside the other two, through the same
cmdQuotaOf the subscription's card uses ("$4.78 / $10.00" on a Go plan).
- The plan id is kept per key for ten minutes, since
billing/subscriptions takes 15-20 s at times.
- The id read before still counts while the plan can't be read.
- A key whose plan was never read keeps its two windows alone.
- A pay-as-you-go key, with no windows, still gets no card.
planWindows' request and status handling move into planBody, so that
cmdKeyWindows can decode the reply itself; other vendors are unchanged.
Run:
- New TestCommandCodeKeyCardHasCredits uses the reporter's own
billing/credits reply. Its billing/subscriptions reply has the shape
the other Command Code tests use (individual-go-monthly), because the
reporter's plan id isn't known.
- With the new branch disabled by hand, the test went red: two windows,
no plan. With it, green.
- TestKeyQuotasKeepLast now answers billing/subscriptions with 503 and
still sees its two windows.
- gofmt; go vet -tags nogui for darwin, linux and windows.
- Not tried against Command Code's real API: there is no plan key here.
- Full suite (go test -timeout 45m ./..., at
|
||
|
|
40df6dbd38 |
provider: a subscription sign-in canceled while its token is fetched adds no account (#2054)
A sign-in checked canceled/finished only when its callback was claimed. The token exchange after that went on to addLogin / addGoogleLogin / addSideLogin and only then called finish, a no-op after CancelSignIn, so a sign-in the user canceled while its token was in flight still added the account, or replaced an existing account's tokens. Sibling of #1750 (mcpauth's flow.keep, |
||
|
|
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> |
||
|
|
3a53d06d99 |
provider, plugin: a subscription's sign-in goes through the proxy its account's requests use, not always the global one (#1663, demystify0137)
What changed: every sign-in started in magpie now leaves through the
account's own proxy (ProxyOfLogin: the account's, else the
subscription's, else the global one). Before, the sign-in's token
exchange and checks went through the global proxy while the account's
later refresh and usage calls went through its own (ViaLogin), so the
vendor saw one account come from two exits.
- signin.go: SignInOptions{Site, Proxy, User}, StartSignInWith; the flow
picks its proxy (pickProxy, validated with settings.CheckProxy) and
every request goes through s.via. Each built-in sign-in (Claude,
Codex/ChatGPT, Grok, Zed, WorkBuddy, Copilot, ZCode, Factory, MiMo,
Qoder, Command Code, Kiro) uses s.via; Claude Code's own login gets the
proxy as *_PROXY (netproxy.EnvWith).
- proxy.go keepSignInProxy: a proxy picked for the sign-in is kept as
the subscription's when the account is its only one, else as that
account's own entry. "" (global) is refused while the subscription has
a proxy and other accounts, since nothing could keep it.
- plugin host: authorize and callback run under via.run(proxy), so a
plugin's sign-in fetches go through the same proxy; plugins_cli.go
does the same for `magpie plugins login`. PluginAPIKey goes through Via.
- gui: POST /api/signin and /api/plugin-signin take proxy and user.
What was run:
- go test -tags nogui ./... (sandbox HOME), all packages ok.
- gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui on the
touched packages.
- Red without the change (each broken by hand, then restored):
TestSignInGoesThroughItsProxy, TestDeviceSignInGoesThroughItsProxy,
TestPluginSignInGoesThroughItsProxy, TestClaudeSignInGoesThroughItsProxy
(internal/provider) and TestPluginSignInProxy (internal/plugin) each
fail with the s.via / EnvWith / via.run / keepSignInProxy removed.
Not tried: a real vendor account through a real proxy. The browser's own
leg of an OAuth sign-in goes through the browser's network, not magpie's.
Devin's CLI probes still use the global proxy.
|
||
|
|
fa9daa6945 | docs: every built-in subscription a plugin serves once moved says so in its code, and AGENTS.md says where a fix for it goes (user: 对内置的订阅 provider 在代码层面和文档层面加上注释,防止又有别的 agent 在改内置订阅 provider 的代码而不知道生效的其实是对应的插件代码) — a moved Cursor, Devin, Grok, Command Code plan, Kiro, Zed, Qoder, Factory, Xiaomi MiMo, ZCode or WorkBuddy (provider.Moved; since v0.1.642 also the default for a new sign-in, provider.Adopt) is signed in, listed, requested and metered by its @magpie-community plugin, and none of the built-in's code in internal/provider/<name>*.go, internal/gateway/<name>.go, internal/zed or internal/qoder serves it; a fix made there alone never reaches those users. Each of those files now opens with a PLUGIN-SERVED notice naming the subscription's id, its plugin package, where the plugin lives (magpie-community/plugins, packages/<name>) and the mover whose min to raise so moved users get the fixed plugin (keepMovedCurrent); Qoder's adds that Qoder CN isn't moved and still runs there. AGENTS.md (CLAUDE.md imports it) lists the moved built-ins with their packages and movers, how to tell whether a user's is moved (move.state "plugin", onPlugins), the order a fix goes in (the plugin, publish, raise min, the built-in only for those not moved), the magpie code that does run for a moved one (internal/plugin, plugins.go, plugin_usage.go, pluginsignin.go, migrate*.go, app.js's subOf/pluginSubs/startPluginSignIn), and the parity tests. movers in migrate.go and SUBS in app.js point there too. TestMovedBuiltinsSayTheirPlugin fails for a mover whose code carries no PLUGIN-SERVED notice naming its id and package (it failed while a wrapped package name was split). Comments and docs only, no behaviour changed. go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui -count=1 ./... under a temp HOME pass (TestProvidersAnswerWhileListsComeIn and TestClaudeSignedOut failed once on their timing under load, pass alone; untouched). | ||
|
|
cb761abdd1 | commandcode: a reply is asked for within Command Code's 200000 tokens, and the agents are told no more (Discord: every Command Code model, free or paid, failed with "Too big: expected number to be <=200000 at params.max_tokens") — magpie passed the client's max_tokens to /alpha/generate as it came, and told the agents each Command Code model's reply limit as models.dev gives it: DeepSeek V4's 384000, MiniMax M3's 512000, Space Bunny Alpha's 524288, Kimi K2.x's 262144, so an agent asking for what it was told had the whole request refused. params.max_tokens is now the asked number within the model's own limit as models.dev gives it and within 200000; less is sent as it was, and none asked is still the CLI's 64000. The Command Code subscription's models are listed to the agents (their configs, /v1/models) with a reply limit of at most 200000, a user's own limit included. Prompts and headers are unchanged. TestCommandCodeGoMaxTokens and TestCommandCodeOutputCapped fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass. | ||
|
|
38f184ae0e |
signin: Grok and Command Code sign in from magpie in Docker (xugui on Discord: docker版登不上grok和command code) — Grok's sign-in first installs Grok Build with its installer, curl … | bash, and the image has neither bash nor curl, so it stopped at "installing Grok Build failed (exec: "bash": executable file not found)"; the community Grok plugin, beside the built-in rather than moved onto, wasn't given the CLI at all and said "install Grok Build first". Where no shell and curl/wget can run, Grok Build is now installed as its installer does, from the same x.ai/cli (then its storage bucket) address: the stable version, its binary for the platform, checked with --version, linked as ~/.grok/bin/grok and agent, installer = "internal" noted in its config.toml; the plugin's sign-in installs it first too. The device sign-in itself needs nothing back from the browser and was fine. Command Code's Studio posts the key to magpie's 127.0.0.1 port in the background, which a browser outside the container can't reach and no address carries; while it waits, its sign-in now takes an API key made on commandcode.ai/settings/keys and pasted (as Command Code's own CLI offers), checked with whoami and its plan as Studio's was, and a plugin's browser sign-in offers "Use an API key instead", its own api way (the Command Code plugin has one). No identity, header or prompt changes. TestGrokInstallsWithoutShell, TestCommandCodeSignInPastedKey and TestGrokPluginSignInInstallsCLI fail without the change, signin-paste-key.test.cjs too. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; signin-paste-key, signin-paste-codex, plugin-signin, signin-callback, commandcode-risk, plugin-key-hint, signin-link, click-scroll, old-webkit pass.
|
||
|
|
4af01cd742 | providers: Command Code's free models are marked free, and providers switched off fold below the ones on (01huadalang on Discord: Space Bunny Alpha 在 Command Code 里是 FREE,magpie 只给 Ling 3.1 Flash 标了免费;已关闭的供应商还占着位置) — magpie marked a model free when the plan said so (m.free) or its id or name said "free"; Command Code's /provider/v1/models says nothing of it, so only ids like inclusionai/ling-3.1-flash:free got 免费. Its CLI (1.73.2) badges eleven models free in its own table (badge:"free"), Space Bunny Alpha and Pixel Canary among them; those are now marked Free on the Go table, on Go's fetched list and on a keyed plan's, so the chips say 免费 with "doesn't use the plan's credits". Neither the CLI nor the API says a discount (no "-99%" anywhere), so none is shown. On the Providers page the providers switched off now sit below the list under a "Turned off (N)" fold (已关闭的供应商), folded at first and remembered per viewer; a click on it moves nothing, and a provider switched off moves under it. TestCommandCodeFreeModels and providers-off-fold.test.cjs fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass (TestClaudeRunEndsWhenTheClientLeaves a load flake, passes alone); providers-off-fold, click-scroll, old-webkit, provider-search, provider-remove, add-sheet, nokey-editor, plain-names, model-test-one pass. | ||
|
|
b00387f9db | provider: a Command Code Go account lists the models Command Code has for Go, not ten (01huadalang on Discord: command 账号登录只有十个模型,正确的应该是几十个) — for Go, magpie never asked for a list and showed a table of 10, on the word that Command Code has none; its Provider API's list answers without a key (86 models), and its CLI (1.73.0) offers Go every model its picker shows but the premium ones and those it blocks for Go. A Go account now fetches that list without its key, less the 30 refused, and saves it (56 today); the table, the CLI's whole Go set (57), stands in until then or when the fetch fails. Requests still go to /alpha/generate. TestCommandCodeGoModels fails without the change (10 models). go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./internal/provider pass. | ||
|
|
f5f10bda4d | plugins: a plugin's accounts show their allowance as the built-ins' do (the user: 所有插件要完整支持显示额度!跟内置一模一样!) — a plugin's auth.usage now tells plan, user, until, renew, balance, resets (count, until, by window, five hours, weekly) and windows (used past 100 when overspent, resets at/in, display, span, the models a window counts or leaves out, aside), and magpie shows them on the usage page, in the menu bar, beside each account and to the gateway, which passes over an account used up for the model asked; a built-in moved onto its plugin keeps its card's name and icon. Also: Command Code's subscription endpoint answering 200 {"success":false} was read as "No plan" by the built-in (and the plugin), it is now unread; a moved Devin was listed twice, the built-in still finding the Devin CLI's own sign-in; and moving back left the plugin's rows in logins.json, listed as empty accounts. Checked in a sandbox HOME with real Command Code and Devin accounts moved onto the community plugins (0.1.1): GOAT, its period, 5 hours / Weekly / Credits for Command Code, Teams, balance and Daily/Weekly for Devin, the same on the built-in after moving back, no plugin rows left. TestPluginUsage, TestCommandCodeSubscriptionUnread and TestMove (the plugin's rows after moving back) fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass (TestClaudeSignedOut and TestUserPath timed out once at load 22, pass alone). | ||
|
|
a08b061b2f | commandcode: a Command Code Go-plan account is served through the gateway in the CLI's own format, at /alpha/generate (Discord #general, Mikan: 有计划支持command code的go plan吗,走他们的私有格式) — Go has no Provider API access, so magpie's Command Code Plan subscription, which asks api.commandcode.ai/provider, could not serve a Go account. Read from command-code 1.72.2's bundle: the CLI asks POST /alpha/generate for the models Command Code hosts, with {config, memory:null, taste:null, skills:null, permissionMode, params:{model, messages, tools, system, max_tokens, stream, temperature?, reasoning_effort?}} (createModelClient, toWireMessages: text / tool-call / reasoning parts, tool results as role "tool" tool-result parts, images as data URLs), the headers of buildCommandAuthHeaders (User-Agent cli, x-command-code-version, x-cli-environment production, x-project-slug, x-taste-learning, x-session-id, Bearer key), and reads newline-delimited JSON back (text-delta, reasoning-delta, tool-call, finish with totalUsage, error, abort). Its plan table lets individual-go / individual-go-v1 use the "opensource" models less a blocked list. Now: an account's plan is read from /alpha/billing/subscriptions and kept 10 minutes per key (the Usage page's read refreshes it; a failed read falls back to the sign-in's plan and is retried after a minute; GOAT is not taken for Go). A Go account is asked at /alpha/generate, translated to and from Anthropic Messages, OpenAI chat and Responses, streamed or not, tool calls included, and lists Go's models from the CLI's table (GPT-6 Luna, GPT-5.6 Luna, DeepSeek V4 Pro/Flash, Kimi K3, GLM-5.3, MiniMax M3, Qwen 3.8 Max/Flash, MiMo V2.6 Pro); MODEL_NOT_IN_PLAN is a 403 and exhausted credits a 402, so routing moves on; token counts are estimated locally. Pro, Max, Ultra, GOAT and Teams accounts go on the Provider API as before. Tested with internal/gateway/commandcode_test.go and internal/provider/commandcode_go_test.go against a fake Command Code in a temp HOME: a Go account routed to /alpha/generate and a Pro one to /provider/v1/messages, the request body and headers, streamed Anthropic, chat and Responses (streamed and not) with text, reasoning, a tool call and usage, MODEL_NOT_IN_PLAN over HTTP and in the stream, credits run out, a stream error, a reply cut short, the plan cached, re-read and falling back; also under -race. They fail with the routing off. go vet, go build -tags nogui (and GOOS=linux, GOOS=windows) and go test -tags nogui ./... pass. Not tried with a real Go account: which models Go allows today, whether the server checks config, project slug or session id, the usage arithmetic with cache tokens, real errors' codes, and pause_turn (ended rather than resent). | ||
|
|
6546033109 |
kiro: removing kiro-cli's or the Kiro IDE's own sign-in hides it in magpie, and it shows again when Kiro signs in anew (Discord 碳碳双键: 本机没安装 kiro,但旧的 Kiro 数据还在,magpie 列出一个"Kiro account"(登录已失效,请重新添加此账号),添加新账号并设为首位后,旧的数据无法移除) — magpie reads Kiro's own sign-in from kiro-cli's database or ~/.aws/sso/cache and lists it among the accounts it signed in; Remove on it said "that is kiro-cli's or the Kiro IDE's own sign-in; run kiro-cli logout or sign out in the IDE", which with neither installed left a dead account there for good. The same refusal was shared by every agent whose own sign-in magpie only reads (forgetSideLogin: Kiro, Devin, Grok, Copilot, ZCode, WorkBuddy and WorkBuddy AI, Command Code, Gemini CLI, Antigravity). Now Remove on the agent's own sign-in hides it: logins.json's entry for it keeps a Hidden mark, and it is left out of the account list and so of the gateway's tries (the first and the ones behind it both come from that list); the agent's files are never deleted or written. It shows again when that sign-in changes: for Kiro, by a mark that is a digest of where the sign-in is (kiro-cli's row or the IDE's file) and its refresh token (never the token itself), so a new kiro-cli login or IDE sign-in, to any account, brings it back; for the others, which have no such mark, when it is another account. Removing it while it is first is allowed now, the next account being put first (saved, so it stays first when the own one comes back); removed when it was the only one, the agent has no account left. One of magpie's own accounts is removed with its home as before, and still can't be while it is first. The error and its per-agent sign-out hints are gone. Logins carry own, and the accounts list shows Remove on the agent's own sign-in also while it is first, its title "magpie stops showing and using Kiro's own sign-in; its files are left as they are, and it shows again when Kiro signs in anew" (magpie 不再显示和使用 Kiro 自己的登录;它的文件保持原样,Kiro 重新登录后会再次出现). Tested with a new internal/provider/side_logins_hide_test.go in a sandbox HOME: an expired kiro-cli sign-in ("Kiro account") behind a Google one magpie signed in is removed, stays gone across reads, isn't the account used nor among AlsoOn, kiro-cli's database byte-for-byte and mtime as it was, the refresh token nowhere in magpie's files; a new kiro-cli sign-in brings it back behind the one first; put first and removed, the next is first; one of magpie's removed takes its home and leaves the other's; the only account removed leaves Kiro with none; Grok's CLI sign-in hidden with auth.json untouched, back once it is another account. The agents' tests that expected the refusal (Command Code, Copilot, Devin, Grok, WorkBuddy, ZCode) no longer do. A new internal/gui/tests/own-signin-remove.test.cjs in Chromium and WebKit, en and zh: kiro-cli's sign-in behind another and alone first both have Remove with that title and post login/forget, magpie's first account has none. go build -tags nogui (and GOOS=linux, GOOS=windows), go test -tags nogui ./... and the whole GUI suite (138) pass. Not tried with a real Kiro, kiro-cli or the Kiro IDE.
|
||
|
|
bdb1dfdd1b | providers: a Command Code sign-in goes through when whoami errs on the new key (tigger_ultra on X: Sign-in didn't finish · Command Code didn't take the new key: Internal Server Error) — magpie asked /alpha/whoami to name the account of the key Studio had just posted, and failed the sign-in on any answer but a 200; whoami answered that key with a 500. The CLI's own browser sign-in never asks whoami (it keeps the key and the name Studio posts; whoami is its check on a key typed in, and only a 401 there means a bad key). Now only whoami turning the key down (401, 403) fails it; any other error is asked again twice, a second apart, and then passed over for the name Studio sent, the plan still read from billing/subscriptions. With no name from Studio either, it fails saying so. Tested: TestCommandCodeSignInWhoamiDown, a fake Command Code whose whoami answers 500: signed in as the posted name with its plan after three asks, a 401 key refused, no name at all refused; go test -tags nogui ./... (TestClaudeSignedOut failed once under load, passes on its own with and without the change and in a rerun), GOOS=linux build | ||
|
|
b0c42d738e |
subscription: a Command Code plan's 5-hour and weekly windows show on the Usage page and the panel (ARNO: command code plan的五小时额度,周额度等订阅信息没有显示到用量面板里) — the plan's card was read right (billing/credits as command-code 1.66's /usage reads it: credits.{planId, monthlyCredits, purchasedCredits, freeCredits}, windowLimits.{limited, fiveHour, weekly}.{used, cap, resetAt in ms} beside it) but also carried the dollars left as its Balance, and a card's Balance is shown in place of its windows everywhere (the panel, the Usage page, the TUI): the windows were read and never drawn. The dollars are now a Credits window, used of the CLI's own pool (the plan's month — Go $10, Pro $30 or $80 for pro-v1, Provider $15, GOAT $70, Teams Pro $40, Max $150, Ultra $300 — or what is left of it if more, plus bought and free credits), "$spent / $pool"; only a reply with no windows and no known plan is a Balance still. A plan's key on the keyed commandcode preset gets the same windows as a plan card (api.commandcode.ai is a plan quota source; a pay-as-you-go key has none and no card), and its balance card is the dollars left alone rather than "5h 42% · week 18% · $12.30" squeezed into one amount. billing/credits carries no planId (4b21f62 found it so on a live account), so the pool's month is the plan billing/subscriptions names; an account with no plan and no windows shows what it bought as its Balance
|
||
|
|
4b21f62e89 | commandcode: a plan's usage says its plan (为什么Command Code Plan没有用量?) — billing/credits has no planId, so the plan (and the account's badge) came up empty; it's read from billing/subscriptions: planId, currentPeriodEnd as when it ends, cancelAtPeriodEnd as whether it renews, and an account with none is "No plan" (无订阅). The plan is said even when billing/credits fails — Command Code answers it 503, "Couldn't verify your credit balance just now", at times — and an account with a balance but no 5-hour or weekly window shows the balance instead of 暂无用量数据. Checked against a live GOAT account: GOAT, $70.00, both windows | ||
|
|
fa3ea3149a | subscription: Command Code Plan, signed in from magpie (Yetone 老师,CommandCode 也是有登录订阅额度的,并不是类似中转的那种哇 — @RookieRicardoR) — a Command Code plan (Pro, GOAT, Max, Ultra) is now a subscription under 订阅, not only the keyed relay preset: Add signs in with the CLI's own browser sign-in (commandcode.ai/studio/auth/cli posting the new key to a callback on 127.0.0.1, answered as the CLI does, 303 to its complete page; wrong state 403, access_denied fails), whoami names the account and billing/credits its plan; the CLI's own account is read from ~/.commandcode/auth.json, never changed, others kept in logins.json with switch/on/forget like ZCode's. Its models are served from the Provider API (/provider/v1 Chat and Responses, /provider Messages) with the plan's key, billed against the plan's credits; usage shows the 5-hour and weekly windows with their resets and the credits left. Its id is commandcode-plan, since commandcode is the keyed preset's |