ac4af582301a4e8a29245dbba767eba31334ddf9
1870
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f37de8cc4e |
provider: the saved Claude accounts' files are listed once per request
claudeCodePrice and claudeModelsOf listed claude-accounts/*/.claude.json with filepath.Glob on every call, and each Claude model's price asks. Building an agent's model list (the window's drift poll rebuilds it each minute, buildClaudeVia and Pi's list) read the folder once per model. The listing is now held while a request holds the catalog (heldOf, 1 s), so a build lists it once; outside a hold it is listed afresh, as before. Measured on mote, real-account copy, GUI page open in Playwright Chromium, network blocked, 115 s CPU profile (acgui.sh), v0.1.3425-era build vs this change: - filepath.Glob: 50 ms -> gone; agent.buildModels 90 ms -> 50 ms - total samples 320 ms -> 290 ms; footprint 197 MB -> 172 MB (one run each) Test: TestClaudeCodeFilesListedOncePerHold saves a folder during a hold and checks the hold's second listing is the first one (same array), and that after the hold the new folder is seen. Broken by hand (the old claudeCodeFiles): red, "listed again within one hold". Run (mote): go test ./internal/provider ./internal/agent ok; go vet native (provider, agent), GOOS=linux and GOOS=windows (provider) ok; gofmt clean. |
||
|
|
8f72f95304 |
provider: a group's lookup copies the group found, not every group
FindGroup, FindGroupAlso and GroupFinder built every routing group with groupsIn, which copies each group and its rules, to return one. The window's 15-second /api/drift poll asks GroupFinder for each Pi model on a group (piModelJSON), and the gateway asks once per request on a group. They now read the groups held (sharedGroupsIn, heldFrom while Hold is active) and copy only the group found and each group a member comes through (cloneGroup), so what a caller gets is still its own to change. Measured on mote with the real-account copy, GUI page open in Playwright Chromium, network blocked, 2 minutes (acgui.sh): - piModelJSON allocations: 10.6 MB -> 1.5 MB (v0.1.3420 vs this change) - process CPU 0.39 s vs 0.43 s, footprint 187 vs 197 MB: within the run noise of the once-a-minute catalog rebuilds; the drop is in the profile. Test: TestGroupFoundCopiesItselfAlone changes a found group, its member's Via and EffortMap, and checks FindGroup, GroupFinder and Groups still see the saved ones; then 50 looks must allocate less than 50 copies of every group (100 groups with rules). Broken by hand, each red: - A: sharedGroupsIn -> groupsIn: looks 5384832 B >= copies 4796000 B - B: no cloneGroup of the found group: index out of range (shared slice) - C: no clone of a member's sub-group: "a change to a found group reached the next look" Run (mote): go test ./internal/provider ./internal/agent ok; go test ./internal/gateway -timeout 45m ok; go vet native, GOOS=linux, GOOS=windows ok; gofmt -l clean. Not tried: a gateway request through a group with a real account (the path is the same FindGroup the test covers). |
||
|
|
88b541a25c |
images: every pointer names Settings › Models › Images, where the page is
The image models moved under Settings › Models, but the Library's Magpie
Image sheet, the MCP server's instructions to agents, the gateway's
"no image model" errors, the video tool's text and the docs still sent
users to "Settings › Images", a tab that no longer exists (the scattered
settings audit after netube99 on X). Every user-facing string now names
Settings › Models › Images in en, zh, zh-TW, ja and de, as do the site's
Qwen docs (en, zh, ja), llms-full.txt, the subsystem pages and comments.
Run in the tree with this change and the rest of the audit's fixes
(mote, base
|
||
|
|
cdd99c5578 |
routing: a re: pattern with a lookahead saves and matches as its preview showed
maer8824 on Discord wrote "re:(?!.*flash).*glm.*" (glm but not flash) in
a routing group. The GUI's preview, which reads patterns with JS's
RegExp, matched the right models, but saving failed: Go's regexp has no
lookaround ("invalid or unsupported Perl syntax: (?!").
compilePattern now reads with Go's regexp first, as before, and only a
pattern Go can't read goes to regexp2 (already in go.sum; now required
directly), with a 100ms bound on one match. A pattern Go reads keeps
exactly the matches it had; one neither reads is still refused with
Go's error. Groups' patterns and providers' auto-include rules both
compile here, so both take it.
Run on mote at this head: go mod verify ok; go vet ./... ok;
GOOS=linux and GOOS=windows go vet ./internal/provider/ ok;
go test -count=1 ./internal/provider/ ok (133s).
Broken by hand: with groupmatch.go/autolist.go/go.mod reverted,
TestRegexpPatternLookahead fails 5 ways (the reporter's error among them).
Not tried: a real group saved in the GUI; the full suite follows the push.
Reported-by: maer8824 (Discord)
|
||
|
|
1f1d210156 |
quotas: a wallet's counted spend goes out on /v1/magpie/quotas too (#5770)
|
||
|
|
a06872dec8 |
caps: a wallet window's spend is counted, so a cap holds it (#5770)
A window that tells only what is left (QuotaWindow.Balance: AStudio 0.2.0's 通用积分 and 星火积分, SuperMagic's points) read 0% used until it was empty, so an account cap never tripped on it. 9won capped an AStudio account at 4 and it spent over 1,000 credits past it. magpie now counts what such a wallet spends (wallet_spend.go). Each plugin reading's balance is set against the one before: a fall is spent, a rise (top-up, daily grant) is not. The count runs over the window's own period when it tells a reset, else the local day: a wallet never renews, and a cap reached for good would switch the account off with no time it comes back; the ask was "N a day". Spend before a period's first reading, or across a gap between periods, is unknown and not counted; spentSince says when counting began. The counts are kept in wallet-spend.json beside providers.json, so a restart doesn't lose them. Every wallet window carries spent and spentSince. On an account with a usage cap (WindowCaps.Holds) it also reads as amount spent of limit (spent plus what is left), and used that share. A cap by share then holds it in routing (allowanceOf takes the fields as they are) and on the GUI row (capHeldOf reads used). So does 40cbdaa7e's amount cap, which skipped a window with no total: 9won's "at most 300 a day" on a wallet now holds (magpie provider account-cap ... --window 通用积分 --amount 300). An uncapped wallet is unchanged: balance alone, routed by Allowance.Left. A cap just set is judged from the next reading. holdsBounds leaves wallets out: there is no whole to reckon "holds" from. Tests, each red on the old code (broken by hand where they compile): - TestPluginWalletCapHolds: real plugin host, fake plugin, wallet 10,000 -> 9,500 on an account capped at 4. Used 5, CapHeld set, the uncapped account untouched. Red with the plugin_usage.go hook removed (Used 0, Spent nil). - TestWalletSpendCounted: falls counted, top-ups not, a restart reads the count back, the next local day and a told reset start over (UTC+8 fixed zone), failed and share readings left alone. - TestWalletCapHolds: account cap 4, the window's own cap 4, and an amount cap of 700 (not held at 650 spent, held at 750). - TestWindowHoldsLeavesAWalletOut: red without the holdsBounds change (a wallet reckoned a 500-token whole). Run on mote at this tree on |
||
|
|
fc8e98ba47 |
edit: Codex's thousands of [projects] tables are left out of the reads that don't want them (#2278)
Codex writes a [projects."…"] table for every project it is trusted in;
the owner's config.toml has 10,933 of them in 1.5 MB. go-toml's decoder
checks each table against its siblings one at a time, so every decode
of the file cost ~0.3s of CPU, and six readers decoded it again each
time Codex wrote it, plus a whole-file check before each write magpie
made to it.
- edit.TOMLWithout drops [projects…] tables in a single unstable.Parser
pass. The agent's codexTopOf, sessions' readCodexConfig, provider's
readCodexStoreSetting, library's rtk sandbox, hooks rekey and MCP
entries read through it. None of them reads projects. A file that
doesn't parse is passed through unchanged, so it still fails.
- validateTOML checks definitions with the rest of the file and the
projects decoded apart, 128 projects to a decode. A bare [projects]
table, a dotted projects.… key outside the tables, or any error
decodes the whole file, so the error is the one it gives.
Run on mote (M5 Pro):
- BenchmarkCodexConfigDecode (10,933 projects): 283ms -> 7.6ms a decode.
- BenchmarkValidateCodexConfig: 52ms (the whole decode was 283ms).
- Startup CPU profile, first 70s, the real-account copy (the real
1,524,099-byte config.toml): 2.76s -> 2.26s of samples; go-toml
0.32s -> none sampled.
- go test ./internal/edit ./internal/sessions ./internal/provider
./internal/library ./internal/agent: all ok.
- go vet of the same five on darwin, GOOS=linux and GOOS=windows; gofmt -l clean.
Broken by hand:
- Decoding the batches into struct{} instead of a map:
TestValidateTOMLDefinitionsInGroups went red ("a key twice", "a
subtable then its key"), so the check keeps maps.
Not tried:
- the whole suite. Only the five packages that read the file were run.
- Now that projects is left out, a project table defined twice no longer
fails these readers' decode. Codex itself refuses such a file.
|
||
|
|
c056b7c8c3 |
provider: a Responses provider's turns may go over the Responses WebSocket (#5781)
A provider the user added with an http(s) Responses address can now send its Responses turns over the Responses WebSocket that magpie already speaks to chatgpt.com (codexSocket), with `socket=auto|on|off`: - off, or absent: today's behaviour exactly. Provider.Via hides any socket value an outer context carried, so such a provider never dials. - auto: tries the socket, falls back to HTTP when the handshake is refused or the socket ends before the reply, and speaks HTTP to a host for 10 minutes once it refused the handshake (codexShun). - on: the same fallback, but never shuns; the socket is tried each turn. Provider.Via puts the provider's Responses host and path in the request's context (withSocket); codexSocket's gate is provider.SocketTurn, which takes a ChatGPT turn as before, or a POST to that host at <Responses>/responses. The rest is the ChatGPT leg's: the kept socket and its delta (codexKeepKey now also hashes the scheme, X-Api-Key and Api-Key), the error frames, 1009 handling. A provider's reply with no Content-Type is marked text/event-stream, since it is read as one. Routing, keys, limits, usage and masking are unchanged: only the transport under the request differs. Set with `magpie provider set <id> socket=auto|on|off` (refused on a provider with an account, no http(s) Responses address, or Vertex, TakesSocket), saved in providers.json as "socket", shown by `provider show`, and in the editor's Advanced as a WebSocket tick beside HTTP version (ticked saves auto, keeps a CLI's on, unticked saves off; shown only while the Responses address is http(s) and there is no account). docs/subsystems/providers-accounts.md describes it. app.js pays for its rows by three long comments cut to one line (renderMove, the vendors' status pages, header rows): the core's scripts are 478 bytes smaller than on |
||
|
|
4da0aa0272 |
provider: Kiro's mover min is 0.1.35, its sign-in words in magpie's languages
Kiro plugin 0.1.35 (plugins 588b3611) gives each sign-in way, its first question, the question's choices and their hints in zh, zh-TW, ja and de, which magpie shows since the commit before last, and the API key field a ksk_… placeholder (mahiro233 on Discord). keepMovedCurrent brings every moved Kiro user to it. npm view @magpie-community/opencode-kiro-auth version --prefer-online --registry https://registry.npmjs.org: 0.1.35 (shasum 98618eda), at landing. The publish run 42600418987 is red for the known middleware-system-prompt and middleware-think-tags trust errors only; kiro itself published. A one-line min change; the Go checks of the two commits before ran at that tree on mote (internal/provider ok). |
||
|
|
40cbdaa7e8 |
provider: an account's window can be capped at a fixed amount of its unit
A window magpie reads with a total and a unit (a day's 1000 credits, a
plan's requests) can now be capped at an amount of that unit, not only
a share: 9won_25273 asked to stop an account at 300 of its day's credits.
- AccountWindowAmounts keeps it per account and window (capId). An
amount and a window's own share replace each other.
- WindowCaps.limitShare turns it into a share of the total for the mark
and NearCap. CapHeld and capReached hold the account once the window's
count reaches the amount (past), and rest it as the percentage cap
does: the next account takes the request. cappedError and the trace
say "has used 300 credits ... past its cap of 300".
- A reading with no total ignores the amount; the account's share
applies.
- GUI: the window meter's menu has one more item, Amount..., typed in
place (provider/windowcap with amount). It shows only on a window
with a unit and total. Strings in zh, zh-TW, ja, de.
- CLI: magpie provider account-cap <id> <account> --window <name>
--amount <n|off>.
Usage outside magpie counts: every cap reads the vendor's own count, so
what the account spent in the vendor's app or on another machine counts
from the next reading on. magpie can only hold back its own requests.
Run, at this head on Linux (wsl-run, magpie-desktop):
- gofmt -l: clean; go vet ./... for linux (-tags nogui) and windows: ok (darwin
vet needs cgo, so it runs with the full suite on mote afterwards)
- go test -run 'Lang|ToolLoop|LoopGuard|Cap|Amount' ./internal/gateway
./internal/provider ./internal/cli: ok (TestWindowAmountCapHeld,
TestSetWindowAmount, TestWindowAmountHoldsTheAccount, the CLI cases)
- GUI window-cap, window-cap-pool, account-cap in chromium and webkit,
420 and 1100 wide, en zh zh-TW ja de: 78 of 78 in each engine. An
earlier webkit run lost the amount test's page once ("Target page,
context or browser has been closed"); it passed in 2 more full-file
runs and 60 of 60 alone
- i18n-keys: only "a plugin's words are its own" red, words that aren't
this change's (#5332, #5426, #5482)
Broken by hand: limitShare ignoring amounts (of < 0): TestWindowAmountCapHeld
and TestWindowAmountHoldsTheAccount go red.
Not tried: the full go test ./... at this head (queued on mote, runs
after); a real account at an amount cap.
iFlytek: 9won's 讯飞 overshoot isn't covered. Loomy's daily window sends
used as a count and amount as what is left (plugins#889); AStudio's
wallets tell a balance only, which no cap can hold (#5770).
Reported-by: 9won_25273 (Discord)
|
||
|
|
2b8ff0fbeb |
routing: an account's model list older than the model is unknown, not a plan without it
wudao_85256 on Discord: two ChatGPT Plus accounts on the Codex subscription, each serving gpt-6.1-sol alone. With both on, Routing said of the second "its plan doesn't list gpt-6.1-sol", and once the first ran out of its allowance nothing failed over: an unlisted account is asked only after a listing one refuses the model as unserved, never after a 429. Re-adding the account and refreshing changed nothing. Cause: the second account's own list (models/codex@<user>.json) was the evidence, and it was stale. The ChatGPT backend lists gpt-6.1-sol only to Codex 0.161.0 and later ( |
||
|
|
40cfae5d3b |
provider: Kiro's mover needs opencode-kiro-auth 0.1.34, which gives each model Kiro's credit multiplier as its rate
01huadalang on Discord asked for Kiro's credit multiplier. 0.1.34 (plugins 1aab125b) reads each model's rateMultiplier (rateUnit "Credit") from ListAvailableModels and carries it as the model's rate, which magpie's plugin host reads as Model.Rate. Usage is not multiplied again: a meteringEvent's credits already include the rate. Raising min makes keepMovedCurrent update every moved user's plugin. Run: npm view --prefer-online --registry https://registry.npmjs.org @magpie-community/opencode-kiro-auth version = 0.1.34, checked again at landing. At base |
||
|
|
2d1b7c1b6c |
codex: a workspace sharing Codex's sign-in reads and sends as its own workspace
JdAZzzzzz (X) has a personal Pro and a Team seat of one ChatGPT login in
magpie, and switches workspace in the Codex app. Both cards read the
same plan ("Prolite"), week, reset time, pace and two reset cards; only
the token counts (local sessions) differed.
Cause: one ChatGPT sign-in reaches every workspace of its login with
one refresh token. Codex's workspace routing (codex-rs
login/src/auth/manager/workspace_routing.rs, /wham/accounts/check)
changes which one auth.json names in tokens.account_id. rememberLogins
saved each workspace as an account (codexWho goes by account_id), both
with that refresh token. renewSaved found the account not in use "held
by Codex" (heldByCodex: same refresh token), renewed through Codex's
store as it should, and returned that store's account id too: the
workspace Codex is on. So the other account's usage, plan, resets and
the gateway's requests for it named the workspace in use, and spent it.
- renewSaved returns the saved account's own workspace for a token read
where Codex holds the sign-in, in ~/.codex and in another Codex folder
(codexOwnWorkspace).
- A sign-in sync put Codex's auth.json on every record sharing its
refresh token, so the other workspace's record was carried as the one
in use. liveCodex and applyLogins no longer match by refresh token
when the workspaces are known apart (codexWorkspacesApart).
TestCodexAppWorkspaceSwitchReadsEachWorkspace: one sign-in (same
refresh token, the real token's claim layout), the app's switch with
only account_id rewritten or with the tokens naming the new workspace,
Codex left on either one. On the old code all 4 cases are red with the
report's picture ("jd@example.com · ws-team (ws-team) reads plan
"prolite" ... 2 resets; its workspace has "team" ... 0 resets"), the
account's requests signed for the other workspace, and CollectSignIns
carrying each record as the other workspace. Green with the change.
Run at
|
||
|
|
608c1543e8 |
gateway: a bare model name goes to the asking agent's own subscription first
freefcw on X: Codex, started by Mirasim, asked for gpt-6-astra by its bare
name. Its own ChatGPT subscription serves it, but magpie sent it to Devin
through the group it found (auto-gpt-6-astra, soonest renewal first).
With found groups off it still went to another vendor: Resolve takes the
first provider in the Providers order, AutoStandIn and agent.Reseat did
the same.
Now:
- A bare model id the asking agent's own subscription in magpie serves (a
provider whose Account.Agent is the agent: Codex's ChatGPT accounts,
Claude's for Claude Code, Copilot's) goes there, found groups on or off
(gateway ownFirst, provider.OwnRoute). count_tokens counts it there too.
- Kept as they were: a group the user made or changed by that name; a found
group magpie set one of the agent's fields to (agent.SetToGroup over the
applied record, #750's bare spelling included, wired as
gateway.SetToGroup); a gateway key held to some models; ids with a
provider in them and group refs; clients magpie doesn't know as an agent.
- Found groups off: a bare id several providers serve, none of them the
agent's own, is refused for an agent that has a subscription of its own
in magpie, with a 400 naming the provider/model ids and
"magpie group auto on" (provider.OffSpread). Off, magpie picks no vendor.
- AutoStandInFor and Reseat's sameModel prefer the agent's own
subscription for a found group that is gone.
Docs: gateway-routing.md's Model resolution row and the bare-ids section.
Run (mote, at this tree on
|
||
|
|
c81065ca72 |
providers: System One for a custom provider and Ark's pay as you go
A user on Discord (#feedback) found no System One endpoint under a custom provider's More endpoints (OpenAI Responses), no System One choice in its Model settings, and on the Volcengine Ark page neither an endpoint nor any model a routing group could ask as its classifier. System One is asked at POST …/systemone under a provider's Decide base; a model is offered as a group's classifier only when its provider has one. Two causes: - A custom provider kept a Decide URL only when its API was "System One base URL". With a Responses or chat URL there was no field for it, and Save sent "" for one the provider didn't have yet. More endpoints now has "System One URL" for any API, saved as typed. - Ark's pay as you go answers System One on the same key at ark.<region>.volces.com/api/v1, but a provider asked at …/api/v3 (the preset's or a custom one, chat completions or Responses) had no Decide unless the user knew to type it. normalize now sets it (arkSystemOne); a URL the user gave is kept. The Coding and Agent Plans answer System One 404, so they get none, and decideKeys leaves out a key whose plan has none (a Coding Plan key beside a pay-as-you-go one). Ark's one decision model is offered whatever chat models are picked, as Bailian's is (OfferedDeciders). Run on mote at this head's tree (65aacb8f8, on |
||
|
|
77076eef47 |
agent: an npm update on Windows lets go of magpie's own claude and codex first
CLJY (Discord) had %APPDATA%\npm with only the 308-byte sh shim of claude: no claude.cmd, no claude.ps1 and no codex at all, and `npm i -g @anthropic-ai/claude-code` ended in "npm warn cleanup ... EPERM ... unlink ...\.claude-code-<rand>\...\claude-code-win32-x64\claude.exe". On Windows a running program's file can't be removed. npm moves the old package aside, takes the old shims away, and stops partway when a claude.exe of that package is still running; the sh shim is what is left. magpie keeps such processes running itself: - the Claude subscription bridge keeps up to 6 Claude Code runs waiting for their conversations' next turns, for up to an hour; - Codex's app-server daemon has no idle exit, and magpie restarts it. Its Update button ran npm with both still up. - agent.UpdateCLI, on Windows through npm, bun or pnpm, first lets go of them: gateway.LetGoIdleClaudeCode ends every waiting run (its session shelved for the next turn, as a run let go past idleMost is) and returns once each has exited; provider.StopIdleCodexDaemon stops the daemon when no codex session is on it. Runs in a turn and sessions are left. - An update on Windows that leaves the CLI's file gone fails, saying to quit it and reinstall, instead of "updated". - proc's toolIn (FindTool) and codexExecutable no longer take the bare extensionless file on Windows, which CreateProcess can't run. Beside name.exe and name.cmd, the sh shim alone stands for the .exe it runs (Claude Code's bin\claude.exe), read from cmd-shim's exec line and kept inside its folder; a node shim (codex) or any other script is skipped. The testdata shims are cmd-shim 7's bytes, made with cmd-shim@7 on the Windows box. Run at this head (rebased on origin/main; after the rebase, vet on all three systems and the changed tests again: ok on Windows and macOS): - gofmt -l internal/: clean. go vet of proc, agent, provider and gateway on macOS (mote), Windows (win-run) and Linux (wsl-run): ok. - Windows (win-run): internal/proc ok; TestToolInNPMShShimAlone, TestLetGoIdleClaudeCodeFreesTheExe and the TestClaudeIdle* tests pass. internal/agent, internal/provider and internal/gateway (-run "Claude|LetGo|Codex") have Windows reds, and the same run at origin/main |
||
|
|
08a42c40ff |
provider: a Remote magpie's cards are passed on down a chain of magpies
yuyong_id (Discord) chains three magpies through Remote: magpie1 has a Codex subscription, magpie2 uses magpie1, magpie3 uses magpie2. magpie2 showed magpie1's Codex card; magpie3 showed none. Cause: since |
||
|
|
e0f6eda641 |
gateway: a probe's reply that thinks its 16 tokens and ends unsaid is answered (plugins#827)
Through a Remote magpie, the plain model test of Open Design's
glm-5.3-flash was red. The model always thinks. It spent the test's 16
tokens on that and ended after content_block_stop, with no message_delta
or message_stop. So:
- translate made it a 502 "ended before it was complete";
- the 502 is busy, so the remote retried it and waited out its 60s
patience;
- the asking magpie had given the remote only 20s (testWait), and said
no answer came.
Each step is now fixed for the class, not for this model:
- A reply whose request was capped at a short probe's worth
(cutVoidTokens, 1024) and that spent some of it, then ended cleanly
with nothing saying it ended, ended at its length (endsAtProbeCap).
- This holds in translate, in streamTranslated and in gathered (a
Responses plugin's stream asked whole becomes response.incomplete at
max_output_tokens).
- It covers Anthropic and Responses upstreams only. Gemini always
ends with a finishReason, so a Gemini stream without one stays a cut
(TestGeminiUpstreamEndedShort, asked for 256, caught a wider first
draft).
- A reply asked for more than 1024, or one that spent nothing, is
still the 502.
- A client may say how long it waits (provider.WaitHeader,
X-Magpie-Wait, in seconds). The gateway then takes no same-one retry
pause and no patience round that would end within clientRoom (10s) of
that wait (keptAlive.outlives), so the client gets the error while it
still waits. Like every X-Magpie- header, it is not sent upstream.
- A model test through a remote magpie waits pluginTestWait (60s), as a
plugin's test does here, and sends that wait as X-Magpie-Wait.
Not changed: a stream relayed as it came (passthrough to an agent of the
same protocol) still gets no end added. That is filed as #5736 and named
in gateway-routing.md.
Run, through mote-run:
- At the pushed tree, rebased on origin/main
|
||
|
|
44d6dd75d1 |
gateway: a subscription's capped or spent turn goes on to the user's group with it in
adorable_piglet on Discord (v0.1.3354): a Codex subscription with a usage
cap set in magpie, first in a routing group with two APIs after it. Past
the cap the Codex app's turns were answered 429 "usage cap reached" and
never reached the APIs; only switching the subscription off in Providers
moved them.
Cause: the Codex app signed in to ChatGPT asks Codex's own model
("gpt-5.5"), never "group/<id>". With a cap on the account,
codexAccounts routes the turn as codex/gpt-5.5, and serve plans the
codex provider and its own Fallback list only. A group that merely has
codex/gpt-5.5 in it was never planned, so with every account held the
answer was cappedError's 429. A request for the group itself was already
routed on past the cap (TestCappedSubscriptionGivesWayInGroup, green on
the old code too). The same gap was on Codex's own sign-in out of its
allowance at OpenAI: codexFallsBack counted the subscription's Fallback
only, so the backend's usage_limit_reached reached Codex.
Fix:
- provider.GroupsAfter(id): the routing groups the user built that have
the model in them and another member to go on to, in the user's order;
auto groups, hidden or switched-off ones are none.
- serve: when every account is held at its cap (pl.capped, no candidate
left, CapStop off), or for a turn codexFallBack handed on, the provider
is planned again with those groups after its own fallbacks
(groupsAfter), each group routed as a request to it is. One place, so
it holds on every protocol (chat, responses, messages, Codex's backend
path), streaming or not, and for plugin-served subscriptions.
- codexFallsBack counts those groups as fallbacks too.
- Stop at the caps (CapStop) still answers 429 (planPaused returns
before any fallback, the groups included).
Tests:
- TestCappedCodexOwnModelGoesToItsGroup: backend path with "gpt-5.5" and
/v1/responses with "codex/gpt-5.5", stream and not; red on origin/main
|
||
|
|
8a7f77cb71 |
provider, plugin: a sign-in whose refresh token rotates is never carried (#5583)
With Sign-ins ticked in Sync, a MiniMax Code sign-in went to both of the
reporter's computers. MiniMax spends a refresh token once: each computer
renewed it as it came due, the loser got invalid_grant 400 and was
signed out for good, with no newer generation anywhere in the sync path
to come back from. Qoder spends its refresh tokens once too.
The safest rule is that such a credential has one owner: it is never
carried. The auth hook declares `rotating` beside keepAlive and
refreshLead; the host passes it in the providers' row (Provider.Rotating),
and the carry path honours it: CollectSignIns leaves such sign-ins out of
what a backup or sync carries, and records() leaves out one an older file
carried, so MergeSignIns neither takes one in nor sends one up, and
RestoreSignIns writes none. Since the plugins don't declare it yet, and
the plugin host's list may not be read when a sync runs at start, magpie
also knows MiniMax Code (minimax-code, minimax-code-global) and Qoder
(qoder, qoder-cn) as rotating (rotatesKnown, read from their sources).
Nothing is deleted: local sign-ins stay, and a copy already on the server
falls out of the carried set by the usual removal.
The tradeoff, on purpose: each computer signs in to these itself. The
reporter's "relay" (carry one generation chain, re-read the store before
declaring a sign-in dead) would keep cross-computer sync for them; it is
a design of its own, not this fix, and stays open on the issue.
Ported from ggbdpq's patch on the issue, with rotatesKnown added so the
rule holds now and before the host lists its providers.
Run:
- TestCollectSignInsLeavesARotatingSignInOut,
TestMergeSignInsDoesNotTakeARotatingSignInIn,
TestRestoreSignInsLeavesARotatingSignInOut and
TestKnownRotatingSignInsStayWithNoPluginListed (new): all four red on
the old signins_carry.go ("a rotating sign-in is carried", "put in
here", Added:1, "minimax-code's rotating sign-in is carried"), green
after.
- go test -tags nogui ./internal/provider/ -run 'SignIns|Rotating' on mote.
- gofmt -l on the changed files: nothing.
Not tried: the two-computer race with real MiniMax Code or Qoder accounts.
Reported-by: skalitz-wolf (yetone/magpie#5583)
Reported-by: gua2100 (Discord)
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
|
||
|
|
64ecd0f693 |
provider: Qoder's mover min is 0.2.64 (plugins#880, #879)
qoder 0.2.64 answers a model the account's listing has off, while its usage says no credits are left, with 429 "usage limit reached: the account's credits are used up (800 / 800 credits), …" instead of the 400 "unknown or disabled model" that a routing group on /v1/chat/completions neither failed over on nor rested the account for (yetone/magpie#5726). An id Qoder never served keeps the 400. Its Windows check-in also finds the runtime qodercli 1.21.2 caches as one file, runtime-info-win32-<arch>-<hash>.exe. Raising the min lets keepMovedCurrent update every moved Qoder and Qoder CN user. npm checked first: `npm view --prefer-online --registry https://registry.npmjs.org @magpie-community/opencode-qoder-auth version` gives 0.2.64. Plugins commit e2d15ba6. Run on mote: `go test -count=1 -timeout 45m ./internal/provider` ok (262s). `gofmt -l internal/provider` is clean. Not tried: a real out-of-credit Qoder account; Windows itself. Reported-by: zane668 (#880) Reported-by: ArmedHelicopter (#879) |
||
|
|
6b0b7a96e9 |
claude: a Max 20x account reads Claude Ultra, apart from Max 5x
Anthropic renamed Max 20x to Claude Ultra, but Claude Code still says subscriptionType "max" for both Max plans; only rateLimitTier (default_claude_max_20x / _5x) tells them apart. Every account chip read "Claude Max", so a 20x account looked like a 5x one (owner's report). claudePlan names "max" with a max_20x tier "ultra". Every place a Claude plan is written uses it (sign-in, Claude Code's own login, a saved directory taken back, the live account, `claude auth status`), and parseLogins reads an account saved as "max" before by its tier, so no one signs in again. claudeRenewedHeld compared the raw "max" with the held account's plan; it now compares the same name, or a renewed Ultra account would no longer find the held one. Run: TestClaudeMax20xIsUltra on mote at |
||
|
|
aa3d11d5b7 |
kimi: a key's booster wallet is read, and a key spending it isn't rested to the month (#5721)
apple_test_src on X (#5721): a Kimi Code key at 98.85% of its month was rested until the month renews, while Kimi still served it from its booster wallet. magpie never read the wallet. readKimiCode now reads booster_wallet (or boosterWallet). A BOOSTER wallet with an amount over 0 adds an "Extra usage" row: amountLeft, in cents x 1e6, in the currency of monthlyChargeLimit, else monthlyUsed, else USD. When something is left, the plan windows are marked Credits. The gateway's full() then doesn't count a key on its booster as full at the month's 98%. A 429 quota refusal rests it as any refusal does, not until the month renews. A wallet that is empty, of another type or missing changes nothing. Tests: TestReadKimiCodeBooster runs on the reporter's literal body (testdata/kimi-booster-5721.json, where 0 is left: no Credits) and on the same body with amountLeft injected (snake and camel case). A GIFT wallet and amount 0 add nothing. TestKimiKeyOnItsBoosterIsNotRestedToTheMonth: a key with booster left isn't full and its 429 rests it under 24h; a spent key is still rested by its window. Run on mote: gofmt -l clean; GOOS=linux and GOOS=windows go vet of internal/provider and internal/gateway; go test ./internal/provider ./internal/gateway -count=1 -timeout 45m: both ok (154.9s, 951.7s). Broken by hand: routing.go reverted turns the gateway test red ("a key on its booster counts as full at the month's 98%"); dropping the Credits marking turns the provider test red. Not tried: a real Kimi key with booster balance left (the reporter's body has 0 left). |
||
|
|
ed0ab567cb |
usage: a key's balance card carries its curve again
nf1qaz2w on Discord: Usage -> Overview showed the subscriptions' curves and no "Balance over time" for any API key. |
||
|
|
b684308c61 |
provider: an allowance or usage read a test leaves running ends with it (#3174)
TestClaudeAccountServesModelsListedSinceItsFetch went red in full internal/provider runs under load (macOS CI at |
||
|
|
c6bdc172a0 |
netguard: a fake-IP resolver's own AAAA beside its fake A is left out, not refused
jiezhengj (Discord, 11-08): under Clash Verge Rev's TUN (mihomo
1.19.33, enhanced-mode fake-ip, fake-ip-range 198.18.0.1/16) every
web_fetch of `magpie mcp search` answered "it is at a private address".
#2593 already lets a name whose every answer is in 198.18.0.0/15 through,
so that wasn't it. Clash Verge Rev writes dns.ipv6: true and
fake-ip-range6: fdfe:dcba:9876::1/64 into its default config (and fills
in 2001:2::/64 when IPv6 is on without one), and mihomo then answers
AAAA from that pool too (dns/middleware.go withFakeIP, read at
v1.19.33). The resolver's answer was 198.18.x.y beside fdfe:dcba:9876::z,
the ULA is private, a fake answer beside a private one is refused, so
every name failed.
netguard.FakePaired names that AAAA: an IPv6 address in fc00::/7 or
2001:2::/48 while the same answer holds an IPv4 one in 198.18.0.0/15.
It is dropped where Loon's paired AAAA is dropped (dropLoon in the
gateway's publicTransport, iconIPs for a provider's icon, the two
places that share netguard), and the fake A is judged and pinned in its
place. 2001:2::/48 (RFC 5180 benchmarking) joins Public's special ranges;
it wasn't covered by 2001::/32 and passed as public.
Why this opens nothing new: the AAAA is never dialled. What is dialled
is the fake A, exactly as when the resolver answered the A alone, which
#2593 already allows: an address in 198.18.0.0/15, which no host on a
normal network uses, so without a TUN it goes to the default route and
reaches the internet or nothing. A hostile DNS that pairs 198.18.0.9
with fd00::<a LAN host> gets the 198.18 address dialled, never the LAN
one. Through a proxy on this computer the proxy gets the name, as for a
pure fake answer; a hostile resolver could already give a proxy another
answer for that name than it gave magpie, so the pairing adds no route.
What stays refused (tests below): a ULA or 2001:2:: alone or beside a
real A, a fake pair beside 10.0.0.1 or ::1, a fake A beside a public
address, and ULA / 2001:2:: / 198.18 address literals.
Ran (on mote; whole packages at base
|
||
|
|
2c31815c59 |
provider: Kiro's mover needs opencode-kiro-auth 0.1.33, which asks an account in the IDE's CreateResponse experiment at /v1/responses
ThirdTimes (plugins#842, plugins#848): on one Builder ID account the
plugin's generateAssistantResponse got 429 USER_REQUEST_RATE_EXCEEDED,
and Kiro IDE 1.4.121 was answered 11s later on CreateResponse ("api=
CreateResponse armSource=experiment"). 0.1.33 (plugins 9b41df15) reads
Kiro's feature configuration as the IDE does. An account in the
create_response_api arm is asked at /v1/responses with the IDE's body and
headers, and any other account is unchanged. Raising min makes
keepMovedCurrent update every moved user's plugin.
Run: npm view --prefer-online --registry https://registry.npmjs.org
@magpie-community/opencode-kiro-auth version = 0.1.33 at landing.
mote-run go test -run 'Kiro|Mover|Moved' ./internal/provider/ ok. gofmt -l
clean. The plugin's own record is in its commit (package 168 pass, plugins
root 6892 pass 0 fail). Not tried: a real Kiro account in the arm.
|
||
|
|
0f04dca6e3 |
provider: WorkBuddy's plugin is at least 0.2.26, where deepseek-v4.1-flash replies 128000
sayagoodbyeplz on Discord: WorkBuddy's deepseek-v4.1-flash was told to agents as replying 384000 tokens (models.dev's), but WorkBuddy serves 128000. Plugin 0.2.26 (magpie-community/plugins 7e01fa81) gives each model it declares before the account's list is read its reply limit, with the China build's deepseek-v4.1-flash at 128000. keepMovedCurrent now brings every moved user's plugin up to it. npm view --prefer-online --registry https://registry.npmjs.org @magpie-community/opencode-workbuddy-auth version: 0.2.26, at landing. Run (WSL magpie-desktop, Go 1.26.8, at this tree, since mote is down): go test -tags nogui -run 'Mover|Moved|Migrat|ModelOutput|Output' ./internal/provider/: ok Not tried: a real moved WorkBuddy account updating to 0.2.26. Full suite not run at push. Reported-by: sayagoodbyeplz (Discord) |
||
|
|
b0926e81a2 |
import: a link can say where its key's balance is read (balance=, balance_path=, balance_method=)
A relay's "Add to magpie" link can now name the URL that tells a key its balance, where the amount sits in the reply, and GET or POST. magpie takes it only on the host of one of the link's own base URLs, over https, with no userinfo or fragment, so a link can't send the key anywhere its requests don't already go; anything else refuses the whole link. balance_path or balance_method without balance is an error. No header or token is taken from a link: an account-wide token is worth more than a key, and a URL stays in browser history. - provider.ParseImport: linkBalance checks and sets BalanceURL, BalancePath and BalanceMethod. - CLI: the import preview shows the balance URL and doesn't ask it before yes (showProviderAsking). - GUI: the import dialog shows method, URL and field (.imp-bal). - Docs: docs/import in en, zh and ja (table rows, a note on headers, the builder's three fields with the same host check, a security bullet); docs/reference.md's parameter table. Run on mote at this tree (rebased on |
||
|
|
1aabc66fd1 |
gateway: /v1/models answers its ETag, and 304 to a client that has the list already
clyzhicore (Discord) runs a server magpie as the gateway and a local magpie that takes its /v1/models and writes the models into dsh. They asked for an ETag or a list you can wait on, so the local side knows a change at once and a dead connection costs little. The wait is there since |
||
|
|
15918265e3 |
zcode mover: min 0.1.57, the busy hold's answer arms no quota rest
plugins#859 (zxy20250120) merged as 93dacd738: an in-flight Start Plan request answered by the busy hold's own 429 was counted as a spent gift, so a -Trial model (or free first) rested in `blocked` for a minute with quota left. 0.1.57 marks that answer and both gift paths skip it. npm view --prefer-online --registry https://registry.npmjs.org @magpie-community/opencode-zcode-auth version: 0.1.57 at landing. Run on mote: go test -run 'Mover|Moved|Migrat|ZCode|Zcode' ./internal/provider ok; gofmt -l clean. Full suite: not run at push. The plugin change itself was run in the PR review (bun test packages/zcode 236/0, red on main's index.mjs). |
||
|
|
37df73b1bb |
balance: a key holds several credits that expire, each added and removed on its own
tenacious_eagle_96548 (Discord, 11-08) has two promotional credits on one
key, one ending tomorrow and one the day after. v0.1.3305 kept one grant
per key, and its form showed the date only after Enter or a blur, with no
button to confirm.
- OwnBalance.Expiring is now a list (`expirings`, up to 20). Spending
goes to the grant that ends soonest first (ties by when it was typed),
and each grant drops out at its day. A write prunes ended grants.
- The pill and the menu say "Expires in N days" per grant, amber from 7
days. The menu has a Remove item per grant, "Add credit that
expires…" and "No credit that expires" to clear them all.
- The form shows the amount and the last day together, the day filled in
30 days ahead, with an Add button; Enter adds, Escape cancels, a bad
amount or a past day is refused in place. The app's own menu, no
native select, no stripes. A pill with two or more grants wraps at a
grant on a narrow row (a class, not :has(), for Safari before 15.4).
- CLI: `--expiring amount@day` can be given several times, `--expiring
off` clears all, `--expiring-remove [amount@]day` removes one. --help
prints usage; a day that isn't a date, or is past, is refused.
- /api/provider/keyexpiring adds `{expiring:{amount,until}}`, removes
`{expiring:{at,until},remove:true}`, clears `{expiring:null}`.
Old data: a v0.1.3305 single `expiring` grant is read as the first grant
and saved as `expirings` on the next write, for every user. An older
magpie reading the new file sees no grants (the balance itself stays).
Run on mote at
|
||
|
|
8f6298fb5e |
providers: a notification when an account in use has to be signed in again, and before a Claude sign-in ends
steven_4422 asked on Discord whether magpie warns when a Claude Code login is close to expiring or has expired. It didn't, outside the app: a sign-in that Anthropic, OpenAI, GitHub or a plugin's vendor refused showed only on the account's row (Sign-in required, Sign in again) and on the provider row's Signed out pill, and nothing warned before a Claude sign-in ended. The system notifications covered only usage, balance, reset, masking and task-done alerts. What Claude's tokens carry (read from Claude Code 2.1.316): the access token refreshes itself, but claudeAiOauth.refreshTokenExpiresAt ends the sign-in. Claude Code sets it from refresh_token_expires_in, or to 30 days from the sign-in, keeps it over a refresh that sends none, says "Your login expires in N days · run /login to renew" from 3 days before, and treats a sign-in past it as none. It skips the warning when the access token outlasts that end by more than the 3 days. - provider.WatchSignIns looks a minute after start and then every two minutes. It reads only magpie's own files and asks no vendor. It covers every account in use of every subscription that is on. - An account is told of when its row says Sign in again, by the Providers page's own test (needsSignIn mirrors renderAccounts): any mark on a Claude, Copilot or plugin account, and on another built-in (Codex revoked, a refresh that failed, ChatGPT API) a mark that signInGone matches. - A Claude account is also told of 3 days before refreshTokenExpiresAt, by Claude Code's rule (claudeSignInEnds). - Each alert goes out once: a lapse until the account is usable again, an end until it moves. The marks are kept in signin-alerts.json, so a restart doesn't repeat them, and an unreadable file tells nothing. - The GUI sends the alert as "<Name> · <user>" with "Signed out — click to sign in again" or "Sign-in ends in N days — click to sign in again", in en, zh, zh-TW, ja and de. A click opens that provider's editor (?view=providers&edit=<id>), where the account's Sign in again is. A Linux dismissal still opens nothing (#2513). Run on mote in a sandbox HOME, on this change over |
||
|
|
04ed05733e |
codex: a refresh of Codex's sign-in never writes its account back over a switch
darwish4021 on Discord (macOS, Codex app, 11-08): after
|
||
|
|
c736906b17 |
providers: part of a key's typed balance may expire on a day
tenacious_eagle_96548 (Discord, #general): some vendors split a balance
into money that stays and credit good until a date. A key's balance typed
by hand can now carry that part (`expiring`: {amount, until, at}, in the
balance's currency, until = the last day it counts).
- Spending order: the expiring part is spent first, as DeepSeek spends
its granted balance before money topped up. It takes the spend from its
`at` up to its end (midnight after `until`, local time) or now; only
what it took after `From` comes off the rest, so a refill or typing the
balance again doesn't count it twice.
- Left is the whole balance. From its end the remainder counts no more,
and unspent credit is gone.
- Typing the balance again keeps the part in the same currency and drops
it in the other, where its amount would mean another sum.
- A balance saved before has no part and reads exactly as it did
(TestTypedBalanceSavedBeforeExpiring).
- Set from the pill's menu: "Credit that expires…" asks the amount, then
the last day (a day gone by, or the other currency's sign, refused);
"No credit that expires" takes it off. GUI route provider/keyexpiring;
CLI `magpie provider key-balance <id> <key> --expiring amount@yyyy-mm-dd|off`.
- Shown: the pill "≈$100.00 left · $30.00 expires in 30 days", the Usage
page and panel line "Expires in 30 days ≈$30.00", amber from 7 days;
TUI and `magpie quota` "($30.00 until Dec 7)". New strings in zh,
zh-TW, ja and de.
Run (mote):
- go test of internal/provider, internal/gui, internal/cli (with
TestCoreScriptBudget: the days' lines in app.js are paid for by five
balance comments cut there, no raise; core 1,533,559 of 1,533,802); the new tests
again with TZ=UTC and TZ=Pacific/Kiritimati (every clock held);
gofmt -l clean; GOOS=linux and GOOS=windows go vet of those packages.
- GUI: key-balance-expiring.test.cjs 20/20 (chromium and webkit, 400px,
en/zh/zh-TW/ja/de), with every balance-*, key-*, i18n-* file: 768
pass, 6 red, each red the same alone on origin/main
|
||
|
|
5849b47ca0 |
provider: Grok's mover min is 0.2.6 (plugins#852)
opencode-grok-auth 0.2.6 (plugins ae5188363, lxyer) asks Grok again when a Responses stream is cut before its first byte. It tries up to three times, before the answer is returned, so a 429 or 401 on a retry comes back as itself. Once a byte has arrived, the stream goes on as it comes, reasoning included. A later cut just ends the stream, and magpie closes it as a whole response.failed ( |
||
|
|
7880a00ac6 |
models: a model of a key's provider can be asked on System One
axelburks on Discord: a relay serves its decision model under a name of its own (an Ark endpoint id). A key's provider with a System One URL beside a conversation URL can set a model's API to decide (System One in Model settings' API row, its chip's right-click, or `magpie model api <pid/model> decide`). The model is then a decision model there: asked on System One by its own name, offered to routing groups, kept out of the conversation models, and a turn for it is refused with 400 before the vendor is asked. Auto gives it back. A provider with no System One URL, with that URL alone, an account, a remote magpie and Vertex refuse it, saying why. Chat routing (apisAmong) ignores decide. Broken by hand: removing the decideSet check in DecidesModel turns TestModelSetToSystemOneIsADecisionModel and TestModelSetToSystemOneAskedThere red. Run, on this stack over origin/main |
||
|
|
7a6211d047 |
providers: a model's own headers, in Model settings
axelburks on Discord: a vendor routes one model by a header of its own. A key's provider (built-in or custom) can give each model headers (settings.ModelHeaders["pid/model"]). They go on that provider's requests for that model alone, after the provider's headers and after auth: a name both have is sent once, as the model's, so a user's value is never overridden by the provider's or magpie's key header. The gateway names the model (provider.WithModel) on every route that asks one: chat on each API, translated and streamed, count_tokens, System One's decision, embeddings, images, videos and the model test. A fallback provider serving the same model id gets its own headers only. Accounts and plugins carry their sign-in's headers and take none. The editor's "Name, price and reasoning level" panel is now "Model settings" (every language), with + Add header per model, staged and made with the Save; Restore default takes them away. The rows being typed are kept out of the draft's compare, so an untouched editor still closes without asking. Broken by hand: dropping WithModel from gateway.go turns TestModelHeadersReachTheirModelOnEveryRoute red; dropping the provider id check in modelOf turns TestModelHeadersStayWithTheirProvider red. Run, on this stack over origin/main |
||
|
|
ae58ec9b44 |
providers: a key's provider can have its model list off
axelburks on Discord: Ark's pay-as-you-go list names models that can't be asked for, and each one is asked by an endpoint id the user made. A key's provider can now have its list off (Provider.ListOff): nothing asks its vendor for a list (Fetch, Refetch, List, RefreshLists, a test, a new key's prefill, a resting key's probe), a list fetched before and models.dev's are not read, and only the ids added by hand are served. The editor shows it as "Fetch the model list", ticked by default; unticked, Fetch models and Forget go. A save that doesn't name listOff keeps it. CLI: `magpie provider set <id> list=off`. Accounts and plugins list as their sign-in does, so they don't take it. Broken by hand: ListAsks returning false for a list-off provider turns TestListOffAsksNoListAndServesTheIDsAdded red; dropping the keep in the save turns TestProviderSaveListOff red. Run, on this stack over origin/main |
||
|
|
0fc3455e2a |
providers: a key's typed balance may be in yuan and refill each month or week
tenacious_eagle_96548 asked, after v0.1.3281's typed balance, to type it
in RMB and to have it refill (e.g. $10 a month, on the 1st).
- A balance may be typed in yuan ("¥100", "100元", or a bare number while
Settings shows costs in CNY). What magpie counts spent stays in USD and
is turned into yuan at fx.Known(): the rate internal/fx last fetched
(cached 12h, fetched again in the background, never on a request).
fx.Known never returns fx.Fallback, so with no rate fetched and
something spent, what is left is unknown (left null; the card says
why), not a guess.
- An optional refill: monthly on day 1-31 (past a month's end, its last
day) or weekly on a weekday, at midnight in the user's local time.
Nothing is stored on a refill: the spend counts from the last boundary
after the balance was typed. Typing the amount again keeps the refill.
- GUI: the pill's menu gains Refills each month… (a day, in place),
Refills each week… (the app's menu of weekdays) and Never refills;
provider/keybalancerefill; keyownbalance takes currency cny. CLI:
magpie provider key-balance <id> <key> [usd|¥cny|off]
[--refill monthly[:day]|weekly[:mon…sun]|off]. Strings in zh, zh-TW,
ja, de. docs/subsystems/providers-accounts.md updated.
Run on mote at this tree (base origin/main
|
||
|
|
778b8e0753 |
provider: Kiro's mover needs opencode-kiro-auth 0.1.32, which waits out a 429 throttle as the Kiro IDE does
onemezao on Discord: a "hi" answered, and the next message straight after was Kiro's 429 USER_REQUEST_RATE_EXCEEDED, while the Kiro IDE on the same account took two in a row (plugins#842, plugins#848). The IDE gets the same throttles but tries again, 3 tries after 1s and 2s or Kiro's retryAfterMilliseconds; the plugin sent the first 429 straight back with Retry-After 30s. 0.1.32 (plugins 966cf717) retries the way the IDE does. Raising min makes keepMovedCurrent update every moved user's plugin. Run: npm view --prefer-online --registry https://registry.npmjs.org @magpie-community/opencode-kiro-auth version = 0.1.32 at landing; mote-run go test -run 'Kiro|Mover|Moved' ./internal/provider/ ok; gofmt -l clean. The plugin's own record is in its commit (package 157 pass, plugins root 6867 pass 0 fail). Broken by hand: in the plugin (5 tests red with the retry off); nothing here beyond the version string. Not tried: a real throttled Kiro account; none was at hand. Reported-by: onemezao (Discord) |
||
|
|
d32a7a70cb |
remote magpie: once magpie updates, the Remote magpies it uses update too
nnlrl_75403 on Discord: a magpie used as another's Remote magpie stayed on
its old version after the local one updated, and had to be updated by
hand on the other computer. Now nothing needs setting up:
- provider.KeepRemotesUpdated (started by the app's updater and by
magpie serve) runs UpdateRemotes 30 s after start and hourly. A
released build with automatic updates on reads each Remote magpie's
version (GET /v1) and, when it is older, asks it through
POST /v1/magpie/update?version=<v> with the provider's key, at most
once in six hours per version. Off here, or a dev build: nothing asked.
- The remote updates as its own automatic update would: the app
downloads and restarts once idle (updater.updateAsked → download,
waitIdle); magpie serve puts the latest in where it runs from, one at
a time, never elevated, and serveFollow restarts into it. Automatic
updates or downloads off there: it answers "off" and stays.
- A copy that can't replace itself says why: a container (docker pull
ghcr.io/yetone/magpie:latest), a package manager's (its command), a
folder it can't write, a build from source. A magpie from before the
route answers 404 ("too old"), a read-only or held key is "refused".
The provider's row on the Providers page adds a short status to its
line ("updating to v…" for 30 min, or "can't update itself" etc.),
with the reason and the command in its tooltip. en/zh/zh-TW/ja/de.
- The route replaces the program, so it takes the Codex reset's
admission: another machine only while shared, never a browser page,
an enabled key with full access from loopback too (401 without one),
read-only 403 gateway_key_read_only, held 403 gateway_key_held. It is
in readOnlyRefused and the CORS route list.
App.js stays under TestCoreScriptBudget by cutting two comments; the
budget is not raised.
Run (on mote, at the tree committed here):
- gofmt -l internal/: clean. go vet of gateway, gui, cli, provider for
darwin, GOOS=linux and GOOS=windows: ok.
- go test -count=1 ./internal/gui ./internal/cli ./internal/provider
./internal/gateway: gui and cli ok but for #5644's two settings tests
(red on main since
|
||
|
|
f8525323dd |
providers: a key with no balance URL takes a balance typed by hand, counted down by magpie's own usage
Some API-key providers tell no balance magpie can read (no Balance URL, no relay query found), so their keys showed none. Now the user types what the vendor's page says is left, on the key's row in the provider editor (Set balance) or with `magpie provider key-balance <id> [key [usd|off]]`. The key's card shows that less what magpie's usage priced the calls it sent on the key since it was typed (usage.KeySpent, the spend caps' count), marked as an estimate: "≈$12.50", the pill "≈$12.50 left", its title saying what was typed, when, and what was counted since. Typing it again counts from then; No balance takes it off. A balance the vendor tells always wins: a provider with a Balance URL, a plan source, Cline's or OpenCode Zen's card takes none typed, and a relay whose query is found shows its own; when the probe finds none (errNoBalance) the typed one is shown. A typed balance stays saved as the user left it: the editor's save keeps it, a key's replaced value carries it. An estimate is never kept in the balance history and tells routing nothing (the routing allowances cache is left alone). keybalance.js is loaded by keyspend.js (itself loaded when the editor draws a key) for a provider that takes one, so app.js and the core's script budget are unchanged. Words in zh, zh-TW, ja and de. Run at this tree (mote): - go vet ./... (darwin), GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... at base 46b10af87; at this tree go vet of gui, provider, cli and usage; - go test -tags nogui -count=1 ./internal/gui ./internal/provider ./internal/cli ./internal/usage: provider and usage ok; gui and cli red only on #5644 below; TestCoreScriptBudget ok (1,533,747, as main) - the provider tests under -race -count=3; - GUI: key-own-balance (new: Chromium and WebKit, en zh zh-TW ja de, 900 and 400px, 20/20), key-spend-cap, old-webkit, i18n-keys, gui-de, gui-ja, gui-zh-tw, balance-found, key-balance-card, i18n-en-no-cjk: 104 pass, 1 fail, i18n-keys "a plugin's words are its own", red the same on origin/main |
||
|
|
30b7a17326 |
codex: a relay's dated or renamed GPT id keeps its xhigh, max and Ultra levels
Found while looking into maomao_00001's report on Discord: the Windows Codex app offered no xhigh or Ultra for a relay's model. Their relay (vip.aipro.love, ids from its public /api/pricing) names its 31 models plainly, and every one already got its full levels in magpie-models.json before this change and gets the same after it, so this is not their fix. Exact ids (gpt-6.1-sol, openai/gpt-6.1-sol) were fine; two spellings other relays use were not: - OpenAI's dated snapshot id (gpt-6.1-sol-2026-09-29) was unknown to the catalog, so it got the low/medium/high fallback. borrowedEfforts now drops a dated suffix and takes the base model's levels. - A relay's rename (codex-gpt-6.1-sol, "[A] gpt-6.1-sol", an id the user marked the same as gpt-6.1-sol) got the levels up to max but no Ultra, because OffersUltra matched exact ids only. It now matches through catalog.IsOneOf, the lookup ContextOf and EffortsOf use. Only known models change: a dated id whose base is unknown (model-x-2026-01-01) keeps low/medium/high, a dated Luna gets its own levels without Ultra, and glm-5.3-flash keeps [low high max]. Not changed: a dashed-date id's window and price are still unknown, because catalog.SameModel doesn't strip that date form (#5643). Run: - TestCodexCatalogRelaysKnownModelsLevels red on the old code (the dated Sol and Luna at [low medium high], three renames without ultra), green with the fix. - gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... and builds on mote. - go test -tags nogui ./internal/catalog ./internal/provider ./internal/agent ./internal/codexcat on mote: all ok. - The relay's 31 ids put through codex's Set with the real models.dev file (a probe, not committed): the same levels on origin/main and with this change. - Full suite: not finished. My probe runs reused the suite's copy on mote, so it was stopped; it runs again after the push. Refs: maomao_00001 (Discord) |
||
|
|
6b7ee4a984 |
routing: every group follows a default for rate limits, slow starts and busy members unless it sets its own
jiezhengj on Discord asked to set the per-group policies once instead of
in each group. The Routing groups page's Settings card, under the list,
now has three rows: Rate limited (keeps its place / goes to the back),
Slow to start (wait / 30 s ... 4 min) and Every member busy (off / 1 min
... 4 min). They are saved in settings.json as groupSink, groupFirstToken
and groupPatience (settings.SetGroupDefaults, POST /api/groups/defaults).
A group follows the default for each value it leaves unset, and its own
value always wins:
- Sinks() is the group's Sink, or else the default unless NoSink, a new
field for an explicit "Keeps its place".
- FirstTokenOr() is the group's own FirstToken (-1, FirstTokenWait, is an
explicit Wait), or else the default. The gateway reads it where it
reads a group's first-token time.
- Waits() reads the default when Patience is 0. 60 is an explicit 1 min.
Groups saved before have 0 and no NoSink, so they follow the default,
which starts at magpie's own (keep its place, wait, 60s). Nothing a user
set changes. The group editor's three rows gain a Default option, on for
a group that sets none, and its hint names the value it follows. Segments
only, with no native select.
Run on mote, at 06b2daeff rebased on origin/main
|
||
|
|
3b541a7f36 |
routing: Smart ranks an account by its week once its month can't be used up before it renews (#5639)
Smart ranked a Volcengine Agent Plan (5 hours 2,000, week 7,000, month
20,000) by its month, the biggest window, so it always stood behind
accounts renewing weekly, and its month could reach a point where it
could no longer be used up before it renewed.
The rule keeps #1778's reasoning: a month holding less than its weeks add
up to is the real cap while the weeks can still carry it. Once what the
biggest window has left is more than the next window (a day or longer,
same unit, counts known) can let through between its own reset and the
biggest one's (Of x time between / Span), what the week leaves at its
reset is lost, and the week ranks the account.
- provider: Allowance.Unreached counts the biggest windows to pass over.
Renewal and Seat.Soon are unchanged for other strategies and plugins.
- routes: Seat.Unreached; Smart compares Soon past it.
- gateway: weighRouted fills it; the trace's Weighed carries `unreached`.
- GUI Routing: renewsBy skips those windows, and a new story line says the
shorter window decides. The Smart header and the group hint say so in
en, zh, zh-TW, ja and de.
- docs: reference.md (How magpie picks an account) and
subsystems/gateway-routing.md.
With the issue's numbers as reported (month 696 h away, 18,372 left),
four weeks carry 28,017, so the order is unchanged. Two weeks before the
month renews, 14,017 < 18,372, and the plan goes first, ahead of the
point where a week's leftover is lost.
Run on mote at this tree (base 2dac9b84e; origin/main
|
||
|
|
cde3bc9fad |
provider: WorkBuddy's mover min is 0.2.25, which leaves "DSH" in a user's path alone (liby233)
liby233 on Discord: on every WorkBuddy model, from DeepSeek Harness, a
path the user asked to have repeated word for word,
"/root/DSH/Work/OC-182.92.66.95/", came back as
"/root/the agent harness/Work/OC-182.92.66.95/". The plugin's "Hide
DeepSeek Harness's name" (0.2.23, on by default) replaced every bare
DSH in user and assistant text. Plugin 0.2.25 (magpie-community/plugins
49d4042e) takes the bare name out of the system prompt and tools'
descriptions only, never out of a path or file name, and lets the
user's and assistant's words go as written; dsh's own runtime lines are
still reworded. keepMovedCurrent updates every moved user to it.
Run on mote at this tree (mote-run, base
|
||
|
|
578053d6aa |
gui: the menu bar's picker leaves out a card of text alone (Google AI Studio)
LuckymanJC on Discord ticked Google AI Studio in Settings › Allowances in the menu bar, and the macOS menu bar never showed it. The card comes from the magpie-gemini-web plugin's ai-studio provider (AIStudio2API). Its usage reports no allowance: Google AI Studio gives none to read, and the plugin only knows which models its accounts are cooling down on. With nothing cooling, the card holds just two text lines (代理出口, 管理页). quotaOfPlugin marks those Text and Aside, trayWindows has no window left, and trayCardText gives no label, so the menu bar draws nothing. The picker still offered the card because it asked only q.windows?.length. The picker now offers a card with a window that isn't text, or with a balance. That is what trayCardText can draw (withTrayKinds gives the same set its trayKind). While an account is cooling, the card has a used-100 window and is offered and drawn as before. A card ticked earlier stays in the list, under its card's name instead of its provider id, so it can be unticked. Comments in renderTrayUsage were cut to pay for this: app.js is 1,311,353 bytes against 1,311,462 at origin/main, and no budget was raised. Run on mote at this tree ( |
||
|
|
31ece9761c |
provider: a Codex reset spent by itself is the very one its checks passed (#5555)
stillExpiring said only whether the account still had one due to be
spent; the spend then read the cards afresh and took the one that runs
out first. If the card the checks had passed expired and went in
between, that was another card entirely, one never checked for being
due. The check now says which card it passed (Each[0], the soonest,
from the same read as Until), and the spend is of that one through the
named-credit path: gone from the spend's own read, held() fails and
nothing is spent, no card picked in its place; the next look decides
afresh. When the list read isn't the count (Each empty), the credit is
"" and the spend picks as before.
Run (wsl-run, magpie-desktop, Go 1.26.8):
- go vet ./internal/provider; gofmt -l: clean
- go test -count=1 -run 'Reset|Expiring|CapNeverSpends' ./internal/provider: ok
- go test -race -count=5 -run 'TestResetUse|TestExpiringSpend|TestSpendExpiringCodexResets': ok
Broken by hand: the spend unbound again (spendCodexReset(ctx, who, "",
...)): TestExpiringSpendKeptToTheCreditChecked red, `spent 1 ("later"):
the card that ran out was replaced by one the checks never passed`.
Not tried: a real reset credit expiring between the reads (the fake
server stands in for the vendor's list losing it).
Reported-by: cgsme
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
|
||
|
|
96f99b7609 |
provider: a Codex reset's lost use record is named, not silent (#5556)
noteResetUsed dropped the errors of keeping codex-resets-used.json: a full disk or a denied path left the spend a success with no record and no word of it. It says so now, and spendCodexReset names the loss in the log. The spend stays a success either way: the reset is spent on the server, so a lost record must never read as one to spend again. Run (wsl-run, magpie-desktop, Go 1.26.8), with #5555 on top: - go vet ./internal/provider; gofmt -l internal/provider: clean - go test -count=1 -run 'Reset|Expiring|CapNeverSpends' ./internal/provider: ok - go test -race -count=5 -run 'TestResetUse|TestExpiringSpend|TestSpendExpiringCodexResets': ok Broken by hand: the write's error dropped again (`_ = steady.WriteFile`): TestResetUseWriteFailureSeen red, "the record's loss went unnamed". Not changed (pre-existing, its own issue): when readResetsUsed fails for a reason other than a parse (a denied read), no copy is put aside and the history is written over, and the `.bad-` copy's own write error is dropped. Not tried: a real full disk or denied path on a real account. Reported-by: cgsme Co-authored-by: ggbdpq <ggbdpq@gmail.com> |