ea3d1c62e7eebc8e080a07b65f97facc3cebcb53
6530
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ea3d1c62e7 |
gateway, codexcat: Codex's image detail "original" goes as "high" to a relay's Responses API, and only DeepSeek's own API is told it takes it (qiu_eth)
qiu_eth on Discord, v0.1.2885: the Codex App on opencode-go/deepseek-v4.1-flash got 400 "invalid image detail" / "this feature is not yet supported by atlas" for every screenshot. Where the values come from: - input_modalities ["text","image"]: models.dev lists deepseek-v4.1-flash under opencode-go with input text and image, and |
||
|
|
116f23c784 |
plugins: an agent plugin whose agent isn't on this computer says so, not "Adds Kimi to Agents" (zzZ)
zzZ (innerscw) on Discord: Kimi no longer shows in Agents, even with the
plugin installed. Nothing in magpie regressed. Kimi Code CLI (built-in
`kimi`, ~/.kimi-code) is found on main: installed with Kimi's own
install.sh in a sandbox HOME on mote, it is listed. The plugin is
@magpie-community/agent-kimi-desktop. Its agent's folder,
~/.config/magpie-kimi, is made by its adapter only once Kimi desktop's
Work runtime has written its config.json (bootstrap() in adapter.mjs).
Until then Detected() is false, so Agents lists no row for it. All the
while, the Plugins page said "Adds Kimi to Agents".
/api/plugins's agent now has missing, looks (where magpie looks, ~ for
home) and notice (the plugin's own notice) when the agent isn't found.
The row's line says "Kimi isn't in Agents: magpie doesn't find it in
~/.config/magpie-kimi", followed by the plugin's notice ("请先打开 Kimi…").
It wraps, in muted colour, since it is not a failure. In zh, zh-TW, ja
and de as well. A found agent's row is unchanged, as are fixtures with
no `missing`.
Run on mote (mote-run):
- go test ./internal/gui -run 'TestPluginAgent|TestCoreScriptBudget|I18n|Words': ok.
- node --test plugin-agent, i18n-keys, i18n-en-no-cjk: 30 pass, Chromium
and WebKit, en/zh/zh-TW/ja/de, at 980 and 420.
- go test ./internal/gui ./internal/agent -count=1 -timeout 45m:
internal/agent ok; internal/gui red only in TestMainWindowCorners
(macOS 27, #3949).
- node --test every *plugin*.test.cjs: 1126 of 1130 pass. The 4 reds are
plugin-move-unserved's "Try again takes the models unticked", red the
same on origin/main
|
||
|
|
10f1e97883 |
search: a GLM Coding Plan searches its own models with the plan's web search MCP
young02036 on Discord asked for the GLM Coding Plan's Web Search MCP in
magpie's web search. The plan's key is given for that server, so magpie
now asks it with the provider's own key, with nothing to set up: a
Streamable HTTP session at <host>/api/mcp/web_search_prime/mcp
(open.bigmodel.cn or api.z.ai, docs.bigmodel.cn/cn/coding-plan/mcp/
search-mcp-server and docs.z.ai/devpack/mcp/search-mcp-server), the key
as a Bearer, initialize, one tools/call of webSearchPrime with
{"search_query"}, then the session's DELETE.
- provider.ZhipuCodingSearch: only a provider or key on the plan's
/api/coding/paas/v4 (Zhipu's or Z.ai's host, or the zhipu/zai preset).
A pay-as-you-go key isn't served by the server and never asks it.
ZhipuSearches reads p.Keys itself, since KeysOn is counted per list and
searchesOwn runs on every request. ZhipuSearchKeys lists the plan's
keys, which are asked in turn.
- searchesOwn/ownSearch: the plan's own models search there first, as
with Kimi Code and WorkBuddy, and fall to magpie's searcher and the
search APIs when it fails. This happens only while Settings names no
searcher (glmSearches): a searcher the user named still searches for
every model, which is a value the user set.
- It is not offered as a searcher for other providers' models. A plan
with the Responses base (/api/v1) already searches natively there
(searchHosts, #660), and making it a no-model service would change the
searcher those users have now.
- The reply's text is read as a list of results, a list in a JSON
string, or a list under search_result/results/items/data. isError, or
words with no results, is an error with the key masked. The query is
masked as Settings > Privacy says (maskedQuery). Each ask is a request
log row (logOwnSearch).
- No GUI change: the setting has no switch, the same as WorkBuddy's.
- docs/subsystems/gateway-routing.md has a section on it, and the
searchesOwn lists there and in plugin-runtime.md name it.
Run (mote, at this tree):
- go test -count=1 ./internal/provider ./internal/settings
- go test -count=1 -run 'Search|GLM|Zhipu|Kimi|LoopGuard|Docs|Guard|WorkBuddy'
./internal/gateway: ok
- GOOS=linux and GOOS=windows go vet ./internal/gateway ./internal/provider:
ok
- gofmt -l: clean
The tests use a fake server only and never reach the network:
- TestGLMCodingPlanSearchesForItsModels: Claude Code's literal WebSearch
request to a plan's model. The fake gives an event-stream reply with
a progress notification before the result, and a double-stringified
result. Then a refusal, an unnamed versus a named searcher beside a
search API, and a pay-as-you-go key.
- TestReadGLMSearch: each reply shape, and prose.
- TestZhipuCodingSearchAddress: hosts, presets, a plan key beside a
pay-as-you-go one, a key that's off.
Broken by hand:
- With the old searchesOwn/ownSearch, TestGLMCodingPlanSearchesForItsModels
is red: the model had no search, 400 "no search tool".
- With glmSearches ignoring a named searcher, the test is red at the
named-searcher step: the MCP was asked and the named searcher wasn't.
Not tried:
- No real GLM Coding Plan key was available, so nothing was sent to the
real open.bigmodel.cn or api.z.ai server. The docs give neither the
tool's argument names nor its reply's shape. search_query and the
result fields come from Zhipu's Web Search API and a third-party npm
wrapper (web-search-zaimcp 0.1.2). If the real reply differs, a search
falls to magpie's other searcher or the search APIs and says why.
- The plan's MCP quota, and how a spent quota is worded.
- A GUI hint in Settings > Web search.
|
||
|
|
2260390a01 |
gateway: a Gemini thought signature goes back only to the provider that gave it
mimi001234 on Discord: Pi (openai-completions) on auto/gemini-4-argon, a group of google-vertex and google-aistudio-paid. Vertex AI served turns 1 to 14 and signed its calls; on turn 15 it answered 429, the group moved to AI Studio, and magpie replayed Vertex AI's signatures from gemini-signatures/. AI Studio answered every try with 400 "Corrupted thought signature." A signature is the issuing backend's, and only it takes one. - The provider that gave a signature is noted beside it, gemini-signatures/<key>.by (noteSigner, written through temp and rename), wherever a reply is read: decoderFor (every translated path: Chat, Anthropic and Responses clients, plugins, search, continuations) and sigTidy (a Chat relay, and a Gemini client's reply relayed as it came, now only read, in native mode). - Every request is fitted to its provider: ownSignatures in forwardTranslated, chatCallSignatures and geminiBodySignatures in passthrough. Another provider's signature goes as Google's documented skip_thought_signature_validator on a call, and not at all on text. A signature of no known provider (ids from before this change, a note that couldn't be written) goes as before. - A 400 "Invalid/Corrupted thought signature" (signatureRefused) is asked again once without signatures at any upstream Gemini's signatures reach (signaturesReach), relayed too, not only Vertex AI translated; it rests no account (restAfterMarked) and lets a group go on to its next member (shapeRefused). The signer is the provider id, not the account: two accounts of one provider share signatures as before. Run on mote (mote-run), the targeted run and vets at this change on origin/main |
||
|
|
47d5839397 |
library: sync and backup files carry the hooks
VincentChan on Discord (v0.1.3005) said part of the Library doesn't reach his other computer through sync. Checked kind by kind what the library part of a bundle carries: instructions (each set's text, a linked set's file text, the agents ticked, each agent's own addition), MCP servers, skills and subagents all go. Hooks didn't: library.Bundle had no field for them, so a hook made on one computer never reached the other, by WebDAV/S3/GitHub sync or a backup file. - library.Bundle.Hooks (*[]*Hook): name, description, event, matcher, command, timeout, agents ticked. Collect always sets it, empty too. Applied.Hooks (the entries magpie wrote into each agent here) stays out: each computer writes them on the sync Put runs, beside the user's own hooks, and records its own entries, so an entry the user edited there stays theirs. - Put replaces the hooks with the bundle's, so one taken out on one computer goes from the others. A nil list (a bundle from a magpie before this) keeps this computer's. - check refuses a hook with no name, no command, or named twice. The event and agents are carried as they come: an event a newer magpie knows is a problem on the agent here, not a refused library. - davsync: an empty list hashes as before the field, so upgrading with no hooks syncs nothing. - The CLI's backup line counts hooks; the GUI's sync/export/import ticks say "instructions, MCP servers, skills, hooks and subagents" in every language. - library.md and sync-backup.md updated, and they now name what stays this computer's own: projects, skill groups, CopySkills/SkillHow, SharedSkills, MCPHub. Instructions: two sandbox computers through the fake DAV server carried a named set and a change to it, a set linked to ~/.agents/AGENTS.md and a hand edit of that file, both computers having their own text first, an agent's own addition, and an agent installed after the first sync. All reached the second computer's CLAUDE.md/AGENTS.md (exploration tests, not kept). So no instructions change here; what VincentChan saw is not reproduced yet. Run (worktree at 0e55a7593; origin/main bf60ea596's two commits touch none of these files): - mote: go test -tags nogui ./internal/backup ./internal/davsync ./internal/cli ./internal/library ok; go vet -tags nogui for darwin, GOOS=linux and GOOS=windows on the four packages ok; gofmt -l clean; go test ./internal/gui -run 'TestCoreScriptBudget|Words|I18n|Builtins' ok - GUI (wsl-run, Linux): i18n-keys, github-sync, s3-sync, sync-*, webdav-settings-refresh, library-backups-top, gui-de, gui-ja, gui-zh-tw: 187/187 Broken by hand: with Collect not setting Hooks, Put ignoring them and the hash not dropping an empty list (the old code), TestCarryHooks, TestCarryOldBundleKeepsHooks, TestCarryNewerHooks, TestBackupFileCarriesHooks, TestSyncHooks and TestNoHooksHashAsBefore went red. Not tried: a real WebDAV/S3/GitHub remote between two real computers; Windows and Linux runs of the Go packages. |
||
|
|
bf60ea5968 |
routing: an earlier account's overload reads overloaded, not quota used up (danzi002)
danzi002 on Discord (v0.1.3005): a Codex request's row read "529 · 额度用尽" (quota used up) while its detail said ChatGPT's 529 service_unavailable_error server_is_overloaded, on an account with its allowance left. The account was not rested as spent: an overload is failOther, rested a moment at most (vendorOverloaded). The words came from the row. When the last account left is out of its allowance after an earlier one failed otherwise, Codex is told the earlier failure (Try.Earlier), and the route takes that one's status, but the row paired that status with the last try's own fail, quota. The route now records the kind of the failure the agent was told (Route.Fail, from toldFail: overloaded for a 529 or a 5xx that says overloaded, the prompt turned away, else failure's reading), at both places serve tells an earlier try's failure: Try.Earlier, and every account after it passed over by a middleware. The Routing page and the panel's request rows (endWord) say that kind when it is there. "servers overloaded" is a new word for the row only (en, zh, zh-TW, ja, de), never a rest's Why. Run (mote, through mote-run; rebased on origin/main |
||
|
|
234903cb23 |
cli: magpie model api sets the API a model is asked on, as the editor's picker does (yew_fence_931206)
A relay with many models behind one key can now have each model's API
set from a script, not only in the provider editor's Names, prices &
levels ("API this model is asked on"):
magpie model api <provider/model>... chat|responses|anthropic|gemini|auto
magpie model api <provider/model>... --reset (auto)
magpie model api <provider/model> what it is asked on
magpie model apis [<provider>] the settings; with a
provider, every model
It saves through provider.SetModelPrefs, the editor's Save, into
settings' modelAPIs, so a running gateway reads it on the next request
and the agents' model lists are told once. Choices are those the editor
offers (modelAPIs in app.js): the APIs the provider has a URL for, when
it has two or more; Vertex AI none. --help anywhere prints the usage. A
flag in place of a model, an unknown API, a model the provider doesn't
list, or an API it has no URL for is refused; several models are all
checked before any is written. A saved setting for a model the vendor
no longer lists can still be reset. Documented in docs/reference.md
("The API a model is asked on") and the gateway-routing page.
Run (mote, via mote-run, at this tree on
|
||
|
|
0e55a75936 |
remote magpie: a request that goes round magpies pointing at each other stops after 8, and a remote that is this magpie lists its models once
Follows |
||
|
|
1fd02d33ce |
agentplug: an agent plugin can pick the model its agent starts on in a second file (str_, PiG)
str_ on Discord (#help, v0.1.3005): PiG's row on the Agents page only
switched the model list on, where Pi's picks the model it starts on.
PiG, like Pi, keeps its providers in ~/.pig/agent/models.json and the
model a session starts on in settings.json (defaultProvider,
defaultModel; PiG's docs/site/docs/settings.md, startup_model.go). An
agent plugin could name a model key only in the one file connect
writes, so agent-pig 0.1.0 had to be connect-only.
An agent's descriptor can now say `startup: {config, format, model,
keys}`: the other file, the key that holds the model (the id without
magpie's prefix) and keys written beside it. With it the row gets a
model field as a built-in's does. Picking one of magpie's writes
connect's keys into config and the model and keys into startup.config,
each key kept aside as before; a model of magpie's picked in the agent
itself still reads as magpie's; a model of the user's own picked there
while magpie's provider is listed counts as connected (Beside), not
drift, and is kept on disconnect. Sync rewrites the list and leaves the
startup model where it is. Off, or `magpie <id> default` with the plugin
gone (RestoreGone), puts both files back. startup without connect, beside
agent.model, in config's own file, or naming the model key among keys
is refused. An older magpie ignores the field, so agent-pig 0.1.1
(plugins repo) stays connect-only there. Every other agent plugin
already names its model in its own config; pig is the only
connect-only one.
Run (mote):
- go test -count=1 ./internal/agentplug/: ok
- go test -count=1 -run 'TestPlugged|TestPlugin|TestRestoreGone|TestAgent'
./internal/agent/: ok
- go vet, GOOS=linux and GOOS=windows go vet of both packages; gofmt -l
clean
- the four TestPluggedStartup* tests on the old code: red (the row had
a provider field and only listed models)
- real PiG 0.5.3 (darwin-arm64 release, SHA256SUMS checked) in a sandbox
HOME, models.json written by agent-pig 0.1.1's own connect and
settings.json as startup writes it, against a fake OpenAI server:
`pig -p` sent model deepseek/flash with the gateway key. With an
enabledModels scope that leaves it out, PiG started on the scope's
first model (said in the plugin's README).
Broken by hand: no startRestore in Unwire (TestPluggedStartupModel and
OwnPickKept red); no Beside (OwnPickKept red, "wired false").
Not tried: the GUI and the TUI with the real row (app.js unchanged; the
row is the model field every built-in has), Windows and Linux runs of
PiG, a real magpie gateway in front of PiG, a real vendor model.
|
||
|
|
c2c991a5b3 |
remote magpie: two magpies each the other's remote no longer list each other's models back without end
cdredfox (Discord) saw 100-200% CPU while magpie used a remote magpie
over Tailscale, gone with the remote off. Their providers mask anyway
and their agent asks auto/ ids, so the earlier unmasked-group lead
doesn't explain it. What does: when A and B are each other's remote,
A's /v1/models (to another magpie) lists rem/<B's models>, B fetches it
as back/rem/..., lists that back to A, and so on: one level deeper on
every 10-minute fetch, without end. Each level is another member of
the found auto/ group and another route round the two machines, masked
again on each pass. On mote, two sandbox magpies in that setup went
from A: [auto/m1 own/m1 rem/auto/m1 rem/up/m1 rem/back/own/m1] to
[... rem/back/rem/back/own/m1, rem/back/rem/auto/m1 ...] after one
more scheduled fetch, and B had back/rem/back/own/m1. A request on the
loop route (rem/back/own/m1) cost A 1.07s CPU over 10 turns against
0.69s for own/m1.
The list a magpie gives another magpie now names, as magpie_via, the
magpies each model passes through, itself last. Each process has a
random id (catalog.Self). A fetched list leaves out a model whose via
has this magpie and another one (it left here and came back), or more
than 8 magpies. A remote that is this magpie itself (via only this id,
as the in-process tests set up) is kept. A magpie older than this sends
no via, and its list is taken as before: both machines need the update.
Stamped on every list a magpie gives: models(), its deciders, and the
drawer and video lists. A routing group's via is its members'
together, so A's auto/m1 holding B's auto/m1 (which holds A's) is left
out at B, and requests no longer go A -> B -> A through groups.
What a user of A loses: B's own auto/ group of a model when it holds
A's model (it reaches A again); B's own models stay listed at A one by
one, and A's group of the model holds them. The cached list keeps Via, so a model a remote served
through others keeps its path in this magpie's list too.
Run (mote, at this tree on
|
||
|
|
1ae48d7f4d |
gui: Antigravity's accounts say the app keeps its own sign-in
Greatrobbort on X (2118158946896932928): picking a preferred Antigravity
account, or smart routing, didn't change the account the Antigravity app
itself uses. It never does: magpie keeps Antigravity's tokens in its own
logins.json and serves only requests that go through it. But the editor
said "Antigravity signs in to the first", "Sign Antigravity in to this
account" and "Antigravity is now signed in as …", as it does for Claude
Code and Codex, whose own sign-in magpie does move.
Antigravity is now `own` in SUBS, so those texts say the gateway uses the
account, and with Routing on the hint adds "Only requests through magpie
use them; Antigravity itself stays signed in as it is." (zh, zh-TW, ja,
de).
Run on mote (macOS 27), at this head's tree:
- go test ./internal/gui -run Budget: ok
- accounts-own-signin (new), accounts-switch-alone, i18n-keys,
i18n-en-no-cjk, agent-switch-accounts, panel-switch-accounts,
routing-accounts-narrow, Chromium and WebKit: 106 pass, 0 fail
- the 19 other GUI files naming antigravity: 247 pass, 4 fail, all in
usage-fold, which fails the same 4 alone at origin/main
|
||
|
|
6abacd46c3 |
update: an Intel magpie under Rosetta updates to the Apple silicon build
cdredfox on Discord saw magpie at 150% of a core. Their goroutine dump
shows AstrLink Guard running in Go (guard.geluRow) in a darwin/amd64
build on an 8-core Mac. That is the Intel build under Rosetta: no
CoreML, and Go's kernels are translated, several times slower than
Apple silicon's build. AppAsset and BinaryAsset named runtime.GOARCH,
so every update fetched the Intel build again, with no way off it.
- internal/rosetta: Translated (sysctl.proc_translated), moved out of
pii so the updater reads the same thing. pii's translated is now that
var; its tests still replace it.
- update: arch() is arm64 for darwin/amd64 under Rosetta. AppAsset and
BinaryAsset (the darwin CLI) use it. goos/goarch/translated are vars
that tests set.
Checked before switching: Stage downloads the zip, ditto unpacks it,
sameSigner wants the same team, and Install renames it over the
bundle. Nothing there reads the architecture, and the CLI's
InstallBinary is a rename too. An arm64 build runs natively on every
Mac that runs Rosetta.
- pii: Status.Rosetta, set on AstrLink Guard's Now() only. Privacy
Filter's pf-serve is already Apple silicon's there (target).
- GUI: Settings > Privacy's local model line, while AstrLink Guard runs
under Rosetta, says "On, slowly under Rosetta: the next update
installs magpie for Apple silicon" in place of "On, on the CPU". It
is the same one sub-line, with no new element. en/zh/zh-TW/ja/de.
Not done, as decided: skipping tool outputs for the model, or capping
its cores.
Run (on mote unless named):
- go test -count=1 ./internal/update ./internal/rosetta ./internal/pii:
ok. On WSL magpie-desktop: the same three, plus go vet of them, ok.
On Windows (xiaomi-gpu): -run "Rosetta|Asset|GuardNow" on update and
pii, ok.
- go vet ./... (darwin) and CGO_ENABLED=0 GOOS=windows go vet ./...: ok.
A Linux cross vet needs cgo for Wails, and WSL has no gtk4, so Linux
vet covered the changed packages only. gofmt -l: clean.
- node --test privacy-model, i18n-keys, i18n-en-no-cjk (chromium +
webkit, 5 languages, 1100/640px): 91 of 92. The new rosetta case
passed in every engine, language and width. The one red is "a
download is cancelled" (chromium). It passes alone, 1/1 at origin/main
|
||
|
|
681a472cab |
agent: a Codex thread started during the takeover comes back to OpenAI once it is quiet, not hours later (nb5p on Discord)
nb5p on Discord (v0.1.3001, Codex app): after Send greyed out, Retry in
Codex did nothing. The model picker and Send spun, the same dialog came
back a few seconds later, and the model field read "model unavailable".
With the ChatGPT account Codex is signed in to used up, magpie makes
itself Codex's provider (codex.out), so a turn sent then starts a thread
saved with model_provider "magpie". When the account has room again,
Sync puts Codex back on OpenAI, and its deferred bringBack moves magpie's
threads to OpenAI. It skips a thread written to in the last minute,
which is the one the user was in, and leaves it "for the next Sync".
Nothing schedules one, though: Sync runs on a catalog change, which can
be hours away. The app then can't resume that thread on the provider it
is now on ("This chat uses magpie, but your current provider is
openai", the string still in the Codex the app bundles), so each Retry
failed the same way.
bringBack now asks whether a thread is still on magpie because it was
being written to (sessions.CodexThreadsBusyOn: the state databases' rows
on magpie whose rollout changed within ActiveWindow). If one is, it asks
for one more Sync after ActiveWindow+5s. Only one wait is pending at a
time.
docs/subsystems/agent-wiring.md says so beside bringBack.
Test: TestCodexTakeoverThreadComesBackOnceQuiet. The takeover is on, and
a thread on magpie is written to now. The account comes back, and the
thread stays on magpie while it is written to. A later Sync is asked
for, and that Sync, with the thread quiet, moves it to openai. No other
Sync is asked for after that.
Broken by hand: with the bringBack hook turned off (`if false && ...`),
it fails with "no later Sync asked for" (5.3s). Restored, it passes.
Run on mote at this tree (base
|
||
|
|
8eb2193540 |
agent: Codex's own models are drawn by their names in its picker, as every other list's are (nb5p on Discord)
nb5p's screenshot of the Agents page: Codex's model picker drew each of
Codex's own models by its slug (gpt-6-astra · 经 magpie · GPT-6-Astra in
grey). Every other list in magpie, magpie's catalog included, draws the
model's name. options() gives a model its name only as the grey note;
Codex's own were the one list built straight from it, and on magpie API or
with magpie Codex's provider the label was set to the slug outright.
codexNamed gives each of Codex's own models its name (the display_name
Codex lists it by) as the label, for the picker of this machine's Codex
and of a WSL distro's (wsl.go, both of its lists), and the magpie-API
branch no longer writes the slug over it. The value is the slug, as
before: what Codex is set to and sends is unchanged (codex/gpt-… on
magpie API, gpt-… otherwise). The Codex app's own picker was not the
cause: magpie's catalog file already gives it the names.
Test: TestCodexOwnModelsNamedInPicker (beside the ChatGPT sign-in, and
magpie the provider) checks each own model is labelled by its name and
valued by its slug. TestCodexAPIKeepsMagpieOnOwnModel and
TestCodexProviderOwnModelSaysItsPath now check the name too.
Run on mote at this tree: go test ./internal/agent ok (176s); go vet for
darwin, linux -tags nogui and windows on internal/agent; go build ./...;
gofmt -l clean.
Broken by hand: codexNamed left without the label, all three tests red
("gpt-6-astra is offered as "" ... want it named "GPT-6-Astra"").
Not tried: the GUI suite (no GUI file changed; the picker already draws
a label when there is one), a real Codex in WSL.
|
||
|
|
3d0d790606 |
codex: the Codex app left on an account that runs out is restarted onto the one Codex is signed in to (nb5p on Discord)
nb5p has two ChatGPT accounts in magpie, B first. The Codex app showed A, and once A ran out Send was grey for every model, magpie's and another provider's too. Cause: magpie's switch back to the first account (or to the account Codex is kept signed in to) leaves the Codex app's app-server running unless "Restart the Codex app to follow" is on. The app-server keeps the account it started on (CodexAppStale), so the app stayed on A while auth.json said B. magpie read only B, which had room, so nothing moved, magpie never took over, and the app-server was never restarted: the app greyed Send on A's allowed false for good. Fix: on each full look of KeepOnAnAccountWithRoom, restartCodexAppLeftOnSpent reads the account the app is left on, and once that is held (codexHeld) marks a spent switch (codexAppSwitched true), which codexAppStep restarts past the RestartApp tick, as a switch off a used-up account already does. Once per app-server left. Run (mote, at this tree): - go test ./internal/provider -count=1: ok - TestCodexAppLeftOnASpentAccountIsRestarted: user switches to A, magpie switches back to B and leaves the app running, A still has room (nothing ended), A runs out with B's room (app-server 7 ended), next look (not ended again). Broken by hand: - codexAppSwitched(true, false) commented out: red, "ended [], want the app-server left on the used-up account". - the once-per-app-server check off: red, "restarted again: [7]". Not tried: the real Codex app on a real account running out; the call in KeepOnAnAccountWithRoom's loop is covered by reading, not by a test. |
||
|
|
dabb5722f8 |
claude: Claude Code routed through magpie stays signed in where the user put it when that account is spent
oreoft on Discord has two Claude accounts: A, the main one, whose sign-in carries their claude.ai connectors (MCP), and B, a quota account. A's allowance was used up. They set A first and signed in, B second, and "跑着跑着" B came first again and became Claude Code's sign-in, and the MCP broke. They set it back more than ten times. Cause: the used-up switch (#208). KeepOnAnAccountWithRoom looks at Claude Code's sign-in every minute or five; A is spent, so NextLogin returns B and SwitchWhenSpent rewrites Claude Code's live credential to B. The GUI's list puts the account in use first (loginsInOrder), so B "moves to first". Each time the user signed A in again, the next look moved it back. Decision: when Claude Code's settings send its requests to magpie's gateway (ANTHROPIC_BASE_URL is the gateway, whether it signs in with magpie's key or keeps its claude.ai sign-in), NextLogin never moves its sign-in off a spent account. The gateway already routes every request to an account with room (it skips spent ones on its own), so moving the sign-in served nothing and only took away what the user signed in as. This keeps the user's choice and needs no setting. Still switching, unchanged: - not routed (Claude Code asks Anthropic as its own sign-in): the switch is the only thing that keeps it working (#208); - "Only switch Claude Code's sign-in" (SwitchOnly): the gateway serves none of those accounts, so switching is all magpie is asked to do; - the move back to the first account / the kept account (returnsToFirst, KeepLoginAs), which go toward the user's choice; - `magpie accounts switch claude next` and the GUI's own switch. - Codex is left as it is: the Codex app stops sending once its own account is out, so it needs the sign-in moved. ClaudeThroughMagpie is a provider hook the agent package sets (claudeRouted, the same check claudeIn's "routed" uses), like CodexAppRoute. Run (all on mote via mote-run): - new TestClaudeRoutedThroughMagpieKeepsItsSignIn (sandbox HOME: A spent, B with room; routed: three looks, no switch, credential still A's; SwitchOnly: switches to B; not routed: switches to B) with TestClaudeSwitchedWhenSpent, TestClaudeSwitchOnly*, TestKeepLoginAs*, TestNextLogin*, TestClaudeSwitch*, TestNextInOrder, TestCodexDrain*: ok. New TestClaudeThroughMagpieReadsItsSettings (agent): ok. - gofmt -l clean; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...; go build; GOOS=linux go build -tags nogui; GOOS=windows go build: ok. Broken by hand: with the NextLogin gate turned off ("if false && ..."), TestClaudeRoutedThroughMagpieKeepsItsSignIn FAILs at line 80, "Claude Code routed through magpie was signed in to b@example.com". Not tried: real Claude accounts and a real Claude Code with claude.ai connectors; Windows and Linux boxes. Full suite runs after the push. A sign-in already moved to B stays on B until the user switches back once. |
||
|
|
4164edce60 |
gui: a one-tone dark or light logo is drawn in the text colour, so Open Design's shows in dark mode (chen2652)
chen2652 (Discord #help) reported that Open Design's icon is almost invisible in dark mode, with no browser dark-mode extension on. The icon is the plugin's own picture, open-design.ai/favicon.svg: a single fill, #26251E, drawn as an <img> on the dark card (#232327). Now icon() judges each picture once, after the picture's own load, so lazy loading is kept (#909). The result is cached per src. If every opaque pixel of a picture is one tone (the range of each channel is at most 24), and that tone is near-black (every channel at most 72) or near-white (every channel at least 224), the picture is replaced by maskSpan, the way a mono logo is drawn: a mask in the text colour. This holds on any ground, Omarchy's themes included. It covers user pictures (file:), plugin pictures, and bundled -color and PNG icons. Audit: every bundled picture icon, plus the plugin registry's pictures, was measured in CIELAB against #232327 and #fff. Two were invisible in dark mode: Open Design's plugin picture and bundled voyage-color.svg (#012E33, in the provider icon picker). Both are now masks. Multi-tone and tiled logos stay as they are (pipellm, zcode, mothx, deepinfra and others: low contrast in places but readable). Mono icons were masks already. Test: icon-one-tone.test.cjs, with the real favicon bytes in fixtures/. - It draws every picture logo on the dark and the light card and measures, on a screenshot, how much of each stands apart from the ground. - It opens Open Design's Installed row on the Plugins page and checks that it is a mask in the icon's text colour and visible in both themes: 5 languages, 980px and 420px, Chromium and WebKit. icon-url and icon-url-saved served a plain black square as the fetched picture. That square is one tone, so it is now a mask. Their fixture is now a coloured tile, like the letter icons the server makes (favicon.go). Run (on mote unless named): - icon-one-tone: 48/48. The 14 icon/theme GUI files (icon-tile, plugin-own-icon, mono-icon-redraw, plugin-registry-icon, models-add-and-icons, market-icon-corners, request-provider-icon, routing-client-icons, routing-log-icons, tray-logos, api-key-theme, icon-url, icon-url-saved, icon-one-tone): green in both engines. - go test ./internal/gui -run 'Budget|I18n|Asset', gofmt -l, GOOS=linux go vet -tags nogui and GOOS=windows go vet of ./internal/gui: all clean, and no size budget was raised. - A whole GUI suite on Linux (WSL) was cut off when the SSH connection to xiaomi-gpu dropped, after about 9,160 passes and 277 reds: - 40 of the reds were icon-url and icon-url-saved (fixed above). - The rest were in 75 other files. Those 75 files were run on mote with this change and at origin/main |
||
|
|
a18ff505ba |
gui tests: redact-words-list measures the drawn controls, not the closed Import box's (acmilan_ follow-up)
v0.1.2964 ( |
||
|
|
76f00399c5 |
redact: a ping between two pieces of a placeholder no longer leaves it in the agent's arguments (#5287)
The Writer holds an event whose text ends in part of a placeholder and
joins it with the next piece. A keepalive event in between (Anthropic's
ping, Responses' response.in_progress or response.queued) made it write
the held piece as it was. The rest of the placeholder came in the next
piece, and neither piece could be restored. A slow model writing a masked
value through Claude Code's Write/Edit put {{SECRET_…}} or a stray { on
disk. magpie-community/plugins#738 committed two German texts as
{{SECRET_5dz6uy27}} and {{SECRET_2zh6t2jw}}.
Keepalive events now go out ahead of the held piece, which stays held for
its continuation. This covers every route that restores through
redact.Writer (Anthropic, Responses, Codex backend, plugins). Chat's
keepalive is a comment, which was already passed through (#2402), and
Gemini has none.
Run on mote at
|
||
|
|
fe6533ad8b |
claudetui: Claude Code's exit is recorded once its last words are read (#5283)
The shim closed `exited` as soon as cmd.Wait returned, which can be
before the PTY reader has read what Claude Code wrote just before it
ended. Every "Claude Code ended ..." error then carried an empty screen
in place of the reason it gave, which is what TestShimNeverPrints/
failed_start saw on a loaded ubuntu CI runner (run 41899504898):
"ended before it showed its prompt (exit status 3): " with no
"something went wrong". The shim's own stderr line is meant; the test
checks the reason is in it.
Now the exit goes through shim.ended: on Unix it waits for read to end
(the master reads EIO once the last slave writer is gone), on Windows,
whose pseudo console stays open, until reading has gone quiet for 250ms
after its first bytes; two seconds at most either way, for a terminal a
child of Claude Code keeps open.
Run:
- Red before: with a 200ms sleep injected at the top of read(), the old
code failed failed_start 5 of 5 on Linux (wsl-run, magpie-desktop)
with CI's exact message; with the fix and the same injection, 50 of 50
green. Without injection the old code passed 300 of 300 there (an
idle machine never loses the race).
- New TestShimEndedAfterLastWordsRead (a reader given the last words
300ms late, terminal ending and staying open). Broken by hand (ended
records at once): red on both subtests; restored: green 20 of 20 with
TestShimNeverPrints on Linux.
- internal/claudetui: Linux (wsl-run) -count=3 ok; macOS (mote-run)
-race -count=2 ok; Windows (win-run) -count=2: only
TestShimFirstMessageWaitsForTools red, the same at origin/main
|
||
|
|
49e382735f |
claude: a side question after a run's first reply of words branches by the reply's id
sleepy_shibe (Discord #feedback, magpie 0.1.2948, Claude Code 2.1.318,
claude-opus-5-5, macOS, interactive mode): when the last turn's reply
was words only, the turn after a prompt suggestion found no run
("claude: no run waits for this turn: its run ended 0s ago: the
interactive Claude Code can't go on with this turn") and a new Claude
Code was told the whole conversation as a transcript. With a tool call
in the turn it branched. 3 sessions, 7 times.
Cause (the reporter's reading, checked in a test): the interactive mode
streams a reply and the bridge hears its session line only later, from
the file. resume saves run.lastLine as the turn's backLine. A run's
first reply of words has no line heard yet, so backLine, behindLine and
the shelf's behindLine were empty while behindMsg (from message_start)
held the reply's id. branchAt returned nil at `at == ""` with no log,
and the run was let go. With a tool call, the run waited on the call and
heard the call's line first, so there was a line to cut at (
|
||
|
|
ed7aeb052f |
plugins: a package that declares magpie.agent is an agent, with a main or without (plugins#737)
miaocell's magpie-agent-deva ships a Bun module as its main beside its moejs agent file (deva.agent.js), because the agent needs a runtime. The market's GitHub list decided the kind by whether a main was there, so it listed the package under Providers, and the Installed row wore a Provider chip and a provider logo though the module serves no provider. Now readTagged gives Kind "agent" to any package that declares magpie.agent; middleware, page and hooks still need no main to be that kind. The file looked for in the repository is still the module Bun loads (its main), or the agent file when there is no main. The Installed row of an agent plugin wears Provider only when its module serves a provider, and its logo is the agent glyph unless it does. The moejs descriptor contract is unchanged. The community registry.json already gives kimi-desktop and reasonix-desktop (both with a main) kind agent; the plugins repo's check now fails an agent package listed as any other kind. Docs: docs/reference.md, docs/subsystems/provider-plugins.md, and site/public/docs plugins.html in en, zh and ja say an agent that needs a runtime keeps its agent file and adds a Bun main, and is listed as an agent either way. Run (on mote, at this head rebased on |
||
|
|
b047cfe73c |
gateway: TestCRTidyTwentyFourMBLine bounds the bytes searched and allocated, not the wall clock (#5282)
The test is the relay hot path's bill for one 24 MB SSE line in 32 KB reads. It had an 8s wall-clock bar. On main CI's Race step, beside heavy shards, one_call_mended took 16.9s on ubuntu and 10.7s on macOS. Alone under -race on mote it takes 4.4s. The bar measured the machine, and it also missed one of the regressions it was there for: a copy of the held bytes on every read took 0.37s. crTidy now counts the bytes it searches for a line's end or the escape (looked, one add per write and per region). The test bounds two things the code controls, each against the line's size: - bytes searched, at most 3x. Measured: 2x with no escape, 3x mended. - bytes allocated (runtime.MemStats), at most 8x with no escape and 40x mended. Measured: 5.4x (append grows the held line a quarter at a time), and mended 27x, 32x under -race (decoded into maps and said again). Broken by hand, on mote: - searching the whole held buffer for a line's end on each read (the quadratic read from yetone's review of #4256): 9.7 GB searched, red in both subtests. - copying what is held on each read: 9.7 GB and 10.2 GB allocated, red in both subtests. The old 8s bar passed it at 0.37s and 0.77s. Restored, green. Run on mote at this head: - go test -race -count=3 -run TestCRTidyTwentyFourMBLine ./internal/gateway: ok. mended takes 4.4s, no escape 0.19s. - go test -race -run 'CR|Glm|GLM|Tidy' ./internal/gateway: ok. - go vet ./internal/gateway on darwin, GOOS=linux and GOOS=windows: ok. gofmt -l: clean. Not tried: a regression that searches without going through the counted sites. The count bounds only what passes them. The allocation bound still catches one that copies. |
||
|
|
1f53537996 |
gateway: the 516 MB generated-images test has largeBodyRoom under -race (#5281)
TestCodexGeneratedImagesPastOldLimit is about the body limit, not the unrouted cut. Its 516 MB turn is scanned and parsed a few times before routing. Without -race that takes ~3s against the 30s cut. Under -race it took 34s on main CI's Race step, and 14 to 17s on mote after |
||
|
|
24a68018e8 |
gateway: a held body's member is not checked again byte by byte when it is decoded alone (#5281)
heldLongOf remembers that a held request body is valid, and where its
top-level members are, by the body's data pointer, so only a whole body
matches it. A Responses request's input (a chat's messages) is then
decoded alone by each of its readers. The first decode of each checked
all of it again: inspectPrompt's goroutine and factsOf (the folder's
reader) do it at the same time, both before the hash memo knows the
slice. For TestCodexGeneratedImagesPastOldLimit's 516 MB turn that was
two more full jsonCheck scans before routing. Under -race each byte of
those scans calls into the race runtime, so they were a large part of
the 34s that got the turn a 504 on main CI.
heldMember says whether a slice is exactly the value of a top-level
member of a held body found valid (binary search over its member spans).
A part of a valid value split at its members is valid itself, so
jsonValid and longBody skip the byte-by-byte check for it. A slice that
only lies inside a member, or is cut short, is checked as before.
Run on mote:
- new TestDecodeJSONHeldMemberNotCheckedAgain: decodes a held body, then
its input three times as a string and as items plus jsonValid(input).
It expects the body checked once and the input never, and a cut input
checked once and refused. Red with heldMember turned off by hand
("checked 1 times and its input 1, want 1 and 0"), green on the fix.
- TestCodexGeneratedImagesPastOldLimit's post timed under -race on mote,
load 42 to 80, old and new interleaved: old 20.9/18.8/17.4s, new
(with
|
||
|
|
e710160df1 |
gateway: a request body a little over a doubling is not copied whole again for its last bytes (#5281)
readSized grows its slice by doubling up to the declared length. A body just over a power of two was read into 1+2+...+512 MB and then copied whole into a final 516 MB slice for its last 4 MB: about 1.5 GB allocated and copied outside the body's wait, which counts toward the 30s unrouted cut. TestCodexGeneratedImagesPastOldLimit sends such a 516 MB turn and was answered 504 on main CI's Race step (34s). Now, once the declared length is within a quarter of the next doubling, the slice grows straight to it. The worst case over all lengths goes from 3x the body allocated to 2.6x (computed over every length up to 600 MB in 16 KB steps). A body shorter than it said is still capped by what it declared. Run on mote: - new TestRequestBodyNotCopiedForItsLastBytes (4 MB + 64 KB in 64 KB reads, at most twice its size allocated): red on the old code, 11600416 bytes for 4259840; green on the fix. - go test -race -run 'TestCodexGeneratedImagesPastOldLimit|TestRequestBody| TestDecodeJSON|TestJSONValid|Held|TestReadSized|LargeBody|OldLimit' ./internal/gateway: ok 114.9s, with this commit and the two after it. - go vet ./internal/gateway on darwin, GOOS=linux and GOOS=windows: ok. gofmt -l: clean. - The full suite and race shards are recorded in the last commit of this set. Not tried: a real Codex client sending a 516 MB turn. |
||
|
|
5ee9a18747 |
gateway: magpie's own summary ask keeps its status, so a compaction over the byte cap is summed up locally (#4862)
codexCompact asks a summary through the gateway's own handler (wantsWhole)
and reads a 413 as its cue to fit the conversation, then to sum it up
without a model. That ask was treated like a client's turn:
- with Codex's User-Agent, compactsInStream sent it a 200 and the 413 as
the stream's error, so codexCompact saw no 413 and answered 502 "so
there is no summary" for every compaction over the vendor's cap;
- with any UA, once the fitting tries took past keepHeldAfter (3s: a 40
MB upload asked four times, a slow link, -race on CI) keepAlive sent a
200 and a comment first, and the 413 after it came the same way.
keptAlive.whole (set from wantsWhole) now gets neither a keepalive nor
the in-stream 413. Codex's own turns are unchanged.
|
||
|
|
f24829636a |
gateway: a plugin's Gemini model is never asked ending with the model's turn (plugins#734)
A test, no code change. plugins#734 says the plugin path (gcp-ai, @ai-sdk/google) skips the gateway's Gemini history rules. It doesn't: a plugin's @ai-sdk/google model is spoken to on CodeAssist (pluginProtocol), built by buildCodeAssistSent and unwrapped by pluginFetch, so the trailing-model user turn and the functionResponse/text split reach it. TestPluginGeminiNeverAskedEndingWithModel holds that end to end through the fake plugin with FAKE-style @ai-sdk/google model fake-gemini and a vendor answering as Vertex does (vertexTurnsAway): Codex compaction after the model's reply, a Codex turn ending with the assistant's message, and #1533's request on Codex's path and /v1/responses, each asked once and never refused. Run on mote (mote-run): go vet ./internal/gateway; go test -run 'EndingWithModel|NeverEndWithModel|ToolResponseTurnHoldsNoText|LocalModelIDAtAPlugin' ./internal/gateway ok. Broken by hand: with the trailing-model guard in buildCodeAssistSent turned off the test fails (vendor refused, a retry got past it); with the functionResponse/text split turned off it fails on both #1533 cases. Not run: the full suite (test-only change in one package). The plugin side got the same rules as defense in depth in magpie-community/plugins 5112465c (gcp-ai 0.2.1). |
||
|
|
099d2b4612 |
agents: Codex back on ChatGPT after the reset says to restart its app, with a Restart
A bug report by mail (11-04): after the ChatGPT allowance reset, Codex was back on its account, but the Codex app still showed no account and no usage. The app's app-server was the one it started while magpie served Codex, and the app reads account/read only as that starts. With "Restart the Codex app when magpie switches its account back" off (the default, #4550), codexAppStep leaves it running, and nothing said so; the takeover's hover even said "It all comes back on its own at the reset". On Windows StaleCopies lists only the daemon, so no hint showed there either. - provider: codexAppStep remembers the app-servers it left running when magpie gave Codex its account back (c.out && !out, not magpie's own account switch, which codexAppLeft already says). CodexAppBack() is true till they are gone (rechecked every 30s; a failed listing keeps it), a route change clears it, and RestartSwitchedCodexApp clears it. - gui: /api/state's Codex row carries appBack (not for a WSL Codex). The Agents row says "Back on ChatGPT · restart the Codex app to see its account" with a Restart, and the row opened says why, with the same Restart; it posts codex/daemon/restart-app, as the Providers page's "still signed in as" Restart does. The takeover text now says the account and usage come back once the app-server restarts, and that this row offers it. - i18n: zh, zh-TW, ja, de for every new and changed string. Run (on mote unless named; rebased on origin/main |
||
|
|
8b902e2879 |
checkin: a ZCode or Qoder captcha stands for the day, not asked again every 30 minutes (plugins#503)
ZCode's check-in is rechecked (pluginRechecks,
|
||
|
|
d892dd6a22 |
gateway: a Claude conversation keeps the folder it named first when its caller moves
EricWvi on X (Claude Code -> local magpie -> a magpie on a server -> a
Claude subscription): the cache read flipped between under 10% and over
90%, each drop on a turn whose folder had changed (.../frontend, then
.../frontend/src). Claude Code 2.1.316 says a cd as a later
"# Environment update" message, "Primary working directory: /y (was /x)".
clientNamedWorkPlace took the last folder named, so a run started again
for the conversation (saved session resumed, branch, replay) got a
different prefix than its first run:
- a caller elsewhere: envTurnsNote names the folder, so append.md changed;
- a caller on this computer: the run worked in the new folder, whose
session project doesn't hold the saved session, so --resume was lost
and the whole conversation was told again.
Either way the whole conversation was written to the cache again.
Now the first text that names a folder decides it (within that text, its
last line, so "said twice" in one system prompt keeps its meaning). The
move still reaches the model in the conversation as the caller said it.
No text is added to the prompt; the note's wording is unchanged.
The reporter's per-turn flips on a v0.1.2879 server are the earlier
safeguards restart (git_state.cwd in safeguardsKept), fixed by
|
||
|
|
e0ee9265ef |
gui: TestClosingWindowMarksPageOutOfSight reads hidden as app.js does and waits for the page (#4924)
The test page read document.hidden from WebKit, which app.js never does:
app.js makes hidden and visibilityState follow magpie's signal (#4293).
WebKit turns an ordered-out window's document.hidden on in its own time
and fires no visibilitychange of its own, so the page recorded the hiding
only if WebKit's value was already true when magpie's signal (an async
ExecJS after orderOut) arrived. When it wasn't, nothing was recorded, the
window was shown again after a fixed 500ms, and the host waited 8s for a
report that could never come: "timed out waiting for the page's hidden
report", as on macOS CI at
|
||
|
|
9a51d644d6 |
gateway: a compaction's summary late past 4 minutes is magpie's own, sent before Codex gives up (#5275)
hayden4608 on Discord (#5275, asked as urgent): Codex Desktop compacting a ~108k-token conversation on volcengine/deepseek-v4.1-flash. The ~3.1MB summary request was still being written to Ark at 299s (TryNet Send ~299s, no first byte), Codex gave up at 300s (499), and only then did magpie log "the reply ended before it was complete; compacting locally". That local summary went to a request nobody was reading, and compactFails.done cleared the conversation's count as if it had worked. Codex sent the same history again, three times, 300s each, and the conversation never got shorter. - codexCompact gives the summary compactWithin (4 minutes, a minute short of Codex's 300s stream idle timeout, as agentQuietMost). Past it the vendor is no longer waited on (the ask's context ends with a sideTimedOut cause, so the usage log says "magpie stopped waiting: its compaction summary had no answer in 4m0s", not the agent canceling), and magpie's own summary (localSummary, saying "no summary came in 4m0s") goes to Codex while it still waits. Checked after the first ask, the ask as plain text, and the as-text ask after tool calls, so a late first ask is never followed by another ask of the same body. - A compaction Codex left before it was answered is counted a failure (499, "Codex left before the summary reached it") and nothing is written; done() is no longer called for it. After compactFailsMost in a row, the next is held with a 400 at once instead of another 300s. Why the upload was slow: not shown to be magpie's. From here a 3.1MB whitespace-padded chat request to ark.cn-beijing.volces.com/api/v3 was read whole in ~1.5s by curl over HTTP/2 and HTTP/1.1, and Go's client with vendorTransport's settings (HTTP/2, ping health) wrote it in 0.89s (HTTP/1.1 0.17s) from mote. The reporter's ~10KB/s, and their own 4MiB control not finishing in 40s by any route, point at the uplink or the Shadowrocket TUN in their path. Not tried through a TUN. Run (mote): TestCodexCompactLateSummaryCompactsLocallyInTime and TestCodexCompactLeftBeforeAnsweredStillCounts green with the fix; both red on the old code (the first: no answer before the client's 10s; the second: a completed compaction written to a Codex that left, and the next not held). go test -run Compact ./internal/gateway ok; go vet of internal/gateway for darwin, linux and windows ok; gofmt clean. Full suite: run after the push (go test -timeout 45m ./... on mote, log teed), result on #5275. Not tried: a real Codex Desktop session against a slow uplink; a reporter-side stream_idle_timeout_ms shorter than 4 minutes (then Codex still leaves first, and the count holds the conversation after 3). |
||
|
|
c3ba2cc933 |
gateway: TestUnroutedProgressingUploadOutlastsMost gives the handler's time between reads room (#5274)
The zstd subtest went red on macOS CI at
|
||
|
|
83137bcbe9 |
sessions: TestCCListingKeepsItsNames counts the names' allocations, not Linux's stats (#4925)
Red on ubuntu CI at |
||
|
|
775630dac9 |
usage: the compaction picker says each window against the setting now
hayden4608 on Discord (#feedback): "上下文压缩阈值建议这里应该以当前选中的为
基准更直观 而不是以最省token的为基准". Usage › Context's "Other window…"
menu said every value's tokens past the leanest, so the window one had
set (ticked in the menu) read "+N tokens" like any other, and choosing
between them meant subtracting two notes in one's head. The reader
picks away from the setting in use, so that is the baseline now:
- each value says "−N tokens (−x%)" or "+N tokens (+x%)" against the
setting now's own point on the curve (the replay's cost at the current
value when the curve has no point there);
- the setting itself says "Your setting now";
- "Fewest tokens" stays, beside the leanest value's numbers (timed: the
cheapest, as before), so where the minimum is is still shown;
- the menu head says it: "Compact at · against the setting now, from
your calls of the range".
The chart and the "{pct} fewer tokens" line already compare with the
setting now and are unchanged. New strings in zh, zh-TW, ja and de; the
old head's key is replaced. docs/subsystems/agent-wiring.md says the new
baseline.
context-tune.test.cjs: the menu notes in every language at 360 and
1100 wide, against 300K set (−150M/−11% at 250K, −420M/−30% plus
Fewest at 160K, "Your setting now" at 300K), and again after 250K is
put in (250K is the setting, 300K +150M/+12%); the timed case against
120K set (100K −90M/−9% plus Fewest, 240K −20M/−2%).
Run on mote (mote-run), this tree before the rebase:
- context-tune: 120/120 chromium, 120/120 webkit
- i18n-keys 4/4 and compact-one-value 6/6 in each engine
- go test -run 'Budget|Script|Asset|I18n|Lang' ./internal/gui: ok
Broken by hand: the old context.js under the new test fails 20
subtests in chromium (both menu tests, every language and width).
Not tried: the real app with a real replay; the full GUI suite and
go test ./... (run after the push).
|
||
|
|
ab5191f8d7 |
provider: Zed's mover min is 0.1.18, which names each request's thread (plugins#731)
zed 0.1.18 (magpie-community/plugins@3920b745, on npm) sends thread_id and prompt_id in CompletionBody as Zed's editor does, so a conversation is one thread to Zed's cloud, not a new one per request. Yezike-yyy's Gemini 4 Argon conversation read no cache on 11 requests of 180k-230k input tokens. keepMovedCurrent brings every moved Zed user up to it. Run (mote): go test -timeout 30m ./internal/provider/ ok; gofmt -l clean. `npm view --prefer-online --registry https://registry.npmjs.org @magpie-community/opencode-zed-auth version` said 0.1.18 before this. Not tried: no Zed account, so whether Zed's cloud caches Argon on thread_id is not known; the reporter is asked to retest. |
||
|
|
676b143175 |
gateway: a model refused for the user's region is asked once more, then the agent is told Google's restriction on that model (#5182)
taoxiaoxin (#5182) runs magpie v0.1.2738 with the built-in Antigravity provider, calling it with curl. antigravity/gemini-3.8-flash (upstream gemini-3.8-flash-tiered) answers 400 "User location is not supported for the API use.", while claude-sonnet-4-6 and claude-opus-4-6-thinking on the same accounts answer 200. The refusal is per model and comes from where the user is. A new connection doesn't help, and v0.1.2982 still asked every account and then retried the last two more times. - gateway.go: regionAsked counts region refusals per provider and model within a request. The first one goes on as v0.1.2982 does: the next account, or the same one again, on a new connection, which covers ggdayup's stale-edge case. On a second refusal, the provider's other accounts aren't asked that model (notMates), the last one isn't retried (protected), and another provider or model left is asked. Nobody rests (restAfterMarked, v0.1.2982). - fallback.go: regionNote and explained. The agent gets the vendor's words plus: "Google doesn't serve <model> to requests from the region this one left from: a regional restriction on the model, not on the account, so no account rests for it and the provider's other models may still answer. Use another provider for <model>, or give the provider a proxy in a region Google serves (its Proxy setting)". It is added at the four places that word a failed reply through Provider.Explain (translated stream and non-stream, pass-through, count_tokens). It still goes out as the 400 that SDKs don't retry. - docs/subsystems/gateway-routing.md: the bullet says this. Tests: - TestRegionRefusalOfTheModelEndsAfterOneMoreAsk: one and three accounts, stream and not, every ask refused. Exactly 2 asks, then a 400 that carries Google's words and the note. No account rests and no usage is re-read. - TestRegionNote: Google's and OpenAI's wordings. Nothing is added for another 400, or for a 200 that quotes the words. Run on mote (mote-run): - go test -count=1 -run Region ./internal/gateway/: ok, every #5182 test from |
||
|
|
fd85c0a1e9 |
gateway: a test's memory root reads nothing of the machine it runs on (#5118)
TestCodexBodyLimitFromMemory's "unknown" case is red on every Linux
machine with more than 8 GiB: ubuntu CI ("unknown: 998 MiB" in the Test
job at
|
||
|
|
79477604a5 |
providers: a plugin option that says placement "top" sits under the accounts, above Routing (#5269)
mycf_711 (#5269): WorkBuddy Pro's plugin-level "panel" switch was drawn in Plugin options, under the whole model list, so it took a scroll every time. An option in auth.options may now say `placement: "top"`: the provider's editor draws those in a Plugin options block right under the accounts, above Routing, and the rest under the models as before. The note that the plugin reads them goes with the first block. host.js keeps placement only when it is "top" (anything else is left out, so the option goes under the models), and plugin.Option carries it to /api/providers. A plugin that says no placement is drawn exactly as before, and an older magpie ignores the field. Documented in docs/subsystems/provider-plugins.md and docs/reference.md. Run (mote, through mote-run): - new internal/gui/tests/plugin-option-placement.test.cjs: chromium 31/31, webkit 31/31 (1100 and 420 wide, en/zh/zh-TW/ja/de; mixed, top only, none or an unknown placement; the top switch posted on Save). - plugin-options.test.cjs 11/11 and plugin-option-words.test.cjs 21/21, i18n-keys 4/4, each in chromium and webkit. - go test ./internal/plugin ok (TestPluginOptions checks "top" kept and "sidebar" left out); go test -run Budget|Script|Asset ./internal/gui ok. - gofmt -l internal/plugin empty; go vet ./internal/plugin ./internal/gui ./internal/cli, GOOS=linux -tags nogui and GOOS=windows vet of internal/plugin ok. Broken by hand: - app.js put back to its parent: the placement test fails "mixed" and "top" in both engines (blocks under the models), "none" still passes. - host.js's placement line removed: TestPluginOptions fails "second = {... Placement:}". Not tried: a real WorkBuddy Pro plugin (Gitee, private) with the field; the full go test ./... and the whole GUI suite run after the next commit. |
||
|
|
d17a0b3ca0 |
usage: opening the Usage page no longer stutters (_hii11 on Discord)
_hii11 (Discord #general): switching sidebar pages stutters a little,
most of all on Usage. The click that opened Usage built every allowance
card and curve twice, the first time inside the click:
- renderUsageLoading drew the cards again although the read of the
allowances that goes with every load (loadQuotas) draws them once it
answers. Cards already drawn now stay until then.
- every card's draw parsed each history line's readings (up to 6000 a
window, 45 days) three times. quotaPoints parses a line once for each
read of the history (loadQuotaHist puts a new quotaHist), and the
recorded cycles are found once for those points.
The UI is the same; nothing new moves.
Measured on mote, headless Chromium, 1280x820, a busy user's data (10
accounts, 45 days of history, 30 days of usage), Usage clicked 4 times,
frames dropped in the 900ms after the click:
- CPU x1: before 4/4/1/1 (worst gap 50ms), after 1/1/0/1 (33ms)
- CPU x4: before 43/37/33/32, after 32/17/20/19; the click's own task
~250ms before, ~70-85ms after; click handling in the trace 303ms -> 89ms.
Agents and Providers switches were 0-1 dropped before and after.
Run (mote):
- usage-open-light.test.cjs (new), Chromium and WebKit, en/zh/zh-TW/ja/de:
green. Red on the old assets: 17292 dates parsed again per redraw; with
only page.js put back by hand, the cards are rebuilt inside the click.
- the 195 GUI files that touch the Usage page or its cards, both engines:
3243 of 3295 pass. Each red file was then run alone on this change and
on origin/main
|
||
|
|
2d04fe73dd |
gateway: Antigravity's tool enums go without a blank value (#5235)
Google's Schema proto refuses a blank enum value, so a tool whose enum holds "" turned every tool-bearing Antigravity turn away with 400 "enum[N]: cannot be empty". Portainer's StatusMessage.operationStatus (enum ["processing","warning","error",""] under allOf) did it for ikunbots' dsh session, reported on X. plainSchema now leaves blank (whitespace-only) values out of a string enum, and leaves the enum out when nothing else is in it; a blank const gives no enum. A number in an enum still drops it whole, as before. Run (mote): go test ./internal/gateway -run 'PlainSchema|Antigravity|CodeAssist|GeminiSchema' ok; TestPlainSchemaDropsBlankEnumValues red on origin/main's codeassist.go (the "" went through), green with this. gofmt clean. Not tried: a real Antigravity request with the reporter's Portainer tools. Not changed: Vertex's chat path (geminiSchemaShapes), which relays JSON Schema enums as they come; whether Vertex refuses a blank value too is unknown. |
||
|
|
c32b820a91 |
gateway: a "User location is not supported" refusal rests no account, and the next try goes on a new connection (#5182)
ggdayup (#5182): Antigravity answered 400 "User location is not supported for the API use." on one kept-alive connection. magpie asked every account after it on that same connection, each was refused the same and rested, and the agent got a 400, while a new connection about 12s later was answered. The refusal is about the edge the connection reached, not about the account. - routing.go: restAfterMarked returns Rest{By: "off", Until: now} for regionRefused, as for zdr and offline, so no account rests and no failure is counted. - upstream_transport.go: regionFresh wraps each of upstreamTransport's three transports (any, draws, uploads), so every request through s.client is covered. It reads the first 8KB of each reply with status >= 400. When those match regionWords, closing the body calls CloseIdleConnections, and a pending flag calls it again before the next request. That flag covers an HTTP/2 connection that still carried another stream when the body closed. - fallback.go: passing() asks the last candidate again (lastRetries, after retryPause), on a new connection, so a user with one account is helped too. - docs/subsystems/gateway-routing.md: a bullet saying all of this, including what it doesn't cover. Tests (region_fresh_test.go, with a fake TLS edge that refuses every request on the first connection it sees and answers on any other): - TestRegionRefusalDropsItsConnection uses the real New() client, over h2 and h1. After a region 400 the next request goes on a new connection and gets 200. A plain 400 INVALID_ARGUMENT keeps its connection. - TestAntigravityRegionRefusalAsksTheNextOnANewConnection: two accounts. The second is asked on a new connection and answers, no account rests, and Tries[0].Rest.By is "off". - TestAntigravityRegionRefusalAsksTheLastAgain: one account. It is asked again on a new connection and answers. - TestRegionRefusalRestsNoAccount: Google's and Antigravity's wordings, two turns each. Both accounts are asked both times, with no rest, no failure counted and no usage re-read. A 500 still rests the account. - TestGroupFailsOverARegionRefusal (#1621) now asserts By "off" and no rest. Run on mote (mote-run): - go test -count=1 -run 'Region' ./internal/gateway/: ok. - go test -race -count=3 -run 'Region' ./internal/gateway/: ok (16.5s). - go vet ./internal/gateway/ for darwin, linux (-tags nogui) and windows, and go build ./... for all three: all ok. - gofmt -l: clean. - Full suite: run after the push, see #5182. Broken by hand, one at a time, each with a real FAIL and then restored: - regionFresh not wrapping the body: DropsItsConnection h2 and h1 region, AsksTheNext and AsksTheLast are red (the second request goes on the refused connection, and the turn gets 400). - restAfterMarked's early return removed: AsksTheNext and RestsNoAccount are red (By backoff, Failures 1). - passing()'s region case removed: AsksTheLast is red (the turn gets 400). Not tried: a real Antigravity account in a refused region. Nothing here can reproduce Google's per-edge refusal. Not covered: an HTTP/2 connection busy with another stream at that moment outlives the close until it is idle. The close also drops other vendors' idle connections, which costs one handshake each. A user who really is in a refused region now gets the refusal about 3s later, after the last candidate's retries. |
||
|
|
18726b9fb6 |
statusline: a held key is told how to see its line, ?format=json, and /v1/magpie/limit says what holds a key (steven_4422)
steven_4422 (Discord, #feedback): POST /v1/magpie/statusline answered 403
gateway_key_held to a key held to Claude's models, while GET
/v1/magpie/limit told the same key {"limited": false}. They asked for the
line scoped to what the key may use, /limit to agree, and a JSON line for
claude-hud's external usage snapshot.
The scoped view already exists (#2216): the status line goes through
scopeQuotas like the quotas routes, so a held key its owner turns Quotas
on for (Gateway -> Gateway keys, or `magpie gateway-key quotas <id> on`)
is told the accounts it may use of each provider whose every model it may
use, and nothing else. Its 403 never said so. Decision: the switch stays
the gate for every held key, budget, models or accounts alike. What holds
a key says nothing of whether its holder is the owner or a friend (#1981
was a friend's budget key seeing every account's email), and only the
owner knows that, so a model- or account-held key is not told quotas by
default either. The every-model rule of #2216 stays.
- scopeQuotas' refusal (heldQuotasOff) names the switch and what it then
tells. heldRefused, for the routes the switch doesn't open
(concurrency, trace, a card outside the scope, writeCards' told-none),
is unchanged.
- GET /v1/magpie/limit tells a held key heldTo (budget, models,
accounts), models, quotas and, with it on, quotaProviders (the
providers newQuotaScope tells it). No account is named. `limited`
keeps its meaning (the budget) for remote magpies that read it.
- ?format=json on the status line: {"text", "model", "accounts"}, the
cards the line shows in /v1/magpie/quotas?kept=1's shape (windows'
used, resetsAt), through the same scope.
- Docs: reference.md, integrating.md, gateway-routing.md; site docker
and remote pages in en, zh, ja.
Run at this head (
|
||
|
|
4a9cfb52e5 |
usage: a plugin account told by its balance alone is drawn over time
corddis_114 on Discord: SenseTime Raccoon's (商汤小浣熊) usage card had no trend chart like the other cards. The Raccoon plugin tells a "Credits" window when its bills add up to the balance, and only `balance: "N credits"` with no window when they don't. A window's share is kept in quota-history.json and drawn; a balance was kept (balance-history.json, balanceTrend) only for API keys' balance cards, from KeyBalances. A subscription or plugin card's balance was never recorded, so such a card had no curve at all. noteCardHistory, called where SubscriptionUsage and a card's refresh note a read, keeps each window's share as before and, for a card with a balance and no windows, its balance, and sets the card's balanceTrend, so the Usage page draws "Balance over time" for it as for a key. A card with windows keeps its windows' curve alone (its balance isn't recorded). The keep-alive's keepCardRead is unchanged (Claude cards have windows). Run (mote, at |
||
|
|
7661a0aa72 |
provider: Fetch models ticks each key's own models, the first key's too (young02036)
young02036 on Discord (#feedback, v0.1.2965): "点击供应商的获取模型,给这个 供应商的所有账号默认勾选上可用模型,和新增账号之后默认勾选上可用模型这个功能 好像失效了". Cause: no later change broke it; the two commits that built it each left keys out. |
||
|
|
8e97e26d67 |
providers: WorkBuddy's sign-in warns that Tencent may ban the account first
NancyTom on X (11-04): WorkBuddy accounts used from DeepSeek Harness through magpie were banned, the international build's (WorkBuddy AI) most; repliers saw the same. Changing DSH's prompt isn't a fix: the plugin already rewords DSH's opener and moves the system prompt into the first user turn (REFUSED.md), and the bans came anyway. So magpie says it before an account is added, as it does for Claude, Zed, Qoder, Factory, MiMo and Command Code. - app.js: WorkBuddy and WorkBuddy AI carry risk with WORKBUDDY_RISK. A moved subscription (every user's now) gets it through subOf, so the plugin's sign-in waits behind "Sign in anyway" too. - i18n.js: zh, zh-TW, ja, de. - CLI: `magpie accounts add workbuddy|workbuddy-ai` asks the same (provider.WorkBuddyRisk, the window's words; a GUI test checks the two are equal). - Core script budget: no raise; the SUBS header comment was cut down. Run (mote, at |
||
|
|
9d0c9b41ea |
serve: follow an update put in where it runs from; a replaced magpie.real is magpie
acezan on Discord (Linux 5.15, 0.1.2959 to 0.1.2960): `magpie web` as a system unit updated /root/.local/bin/magpie.real, and the user unit's `magpie serve` (`magpie daemon install`) ran on for good from "magpie.real (deleted)". The panel said an older magpie served the gateway, and its "close it here" then said the port holder "isn't magpie" and left it. Why serve stayed old: the app and `magpie web` follow the program they started from (gui's followReplaced) and restart into an update; plain `magpie serve` had no such look, and answered `magpie update`'s restart ask (gateway.RestartPath) "unsupported". Nothing else can restart it reliably: a system unit doesn't reach the user's `systemctl --user`, and on a Mac the launch agent's serve (#4335) is the same serve. So serve now looks itself (internal/cli/serve_follow.go): every 5s it checks its program with update.Replaced; once replaced, it waits until the gateway is idle (nothing in flight, 10s since the last end, as gui's idle rule; after an hour, nothing in flight is enough), ends the plugin hosts and runs the new program in its own place (update.Reexec: exec in place on Unix, same PID, so systemd and launchd keep tracking it; a new process on Windows). The restart ask now answers restarting/waiting/current. A build that isn't a release never does it. Why "not magpie": proc.IsMagpie judged the file name, and "magpie.real" (the program the installer's wrapper script runs) didn't match. It now trims ".real". And proc.RunsMagpie, used by the takeover and the port check, also reads Go's build info of the running program (on Linux through /proc/<pid>/exe, which still reads after the file is replaced) and calls it magpie when its main package is github.com/yetone/magpie. A process that isn't magpie is still never ended (the existing "other-server" case passes unchanged). Tests, each red on the old code: - cli TestServeRestartsIntoAnUpdate: a copy of the test binary named magpie.real runs `serve` on a free port; a script renamed over it is run in its place with the same pid and args, and the old port stops answering. Old code: "serve ran on as the old version" after 40s. - cli TestServeFollowWaitsForIdle: current / waiting / tool-chain gap / waitMost with a request in flight / idle / non-release. - gui TestGatewayFixQuitsAReplacedMagpieReal: a fake older gateway named magpie.real, its file removed after start, is quit and the gateway served here. Old code: {OK:false Reason:not-magpie}, acezan's case. - proc TestIsMagpie magpie.real case; TestRunsMagpieByItsBuild: a copy named server.real, its file removed, is told by its build (Linux /proc/<pid>/exe), and is not magpie with the real main path. Run: the targeted tests above on Linux (wsl-run, magpie-desktop, -tags nogui) and macOS (mote-run), all pass. Broken by hand on Linux: dropped the ".real" trim, made RunsMagpie only IsMagpie, and set serve's follow to nil; all four new tests went red (output above), restored after. gofmt -l clean; go vet (darwin, GOOS=linux -tags nogui, GOOS=windows) and builds on mote. Not tried: a real systemd user unit or launch agent with a real update; the Windows restart path (Reexec starts a new process) beyond vet; the macOS TCC part of #4335 (this restarts the launch agent's serve into the new bundle path only if that path is where it started from). #4335 stays open, and ggbdpq's daemon.RestartReplaced patch there is not applied. |
||
|
|
e3ed21c7a2 |
provider: the ZCode mover's min is 0.1.50 (plugins#729)
zcode 0.1.50 reads a daily claim answered with code 1004 as the account
not being eligible for that plan now, and asks again in half an hour,
instead of reporting a failed claim (kongbai01203). Raising the min lets
keepMovedCurrent bring every moved user's plugin up to it.
npm view @magpie-community/opencode-zcode-auth version --prefer-online
(registry.npmjs.org) answered 0.1.50 before the change and again at
landing.
Run on mote (mote-run) at this tree, rebased on
|
||
|
|
0a6cccc3ff |
groups: a found group the user changed takes in a new provider with its model
Kxsg79bEYFP4 on X: magpie found auto/deepseek-v4.1-flash over two
providers, the user changed the group, then added a third provider (a
plugin's) with the model, and it never joined.
Cause: SaveGroup stores a changed found group under its auto-… id with
the members it had then, and buildGroupsIn skips the found group of
that id ("the user changed it: theirs now"). Nothing recorded which of
the found models the user had taken out, so a stored group could only
stay frozen. Plugin providers, id spelling and a one-time creation were
ruled out: a plugin's models are in providerEntries like any provider's,
and the found group itself has all three.
Fix: SaveGroup stores Group.Seen for an auto-… id: the models magpie
found in it by that save plus those the user names. Reading a changed
found group (joined) appends the found members it neither names nor has
seen, after the user's own. A model the user took out was seen and stays
out (magpie's default never overrides the user's value); a provider kept
out of found groups (AutoGroupSkip) doesn't join; with found groups off
nothing joins. Seen follows a provider's rename/SetModelID
(mapModelRefs) and a fold, and ShareGroup leaves it behind. A group
changed before this (no Seen) takes in nothing, since nothing says what
the user took out; its next save sees what is found then, and providers
added after that join. docs/subsystems/providers-accounts.md says so.
Tests: TestChangedFoundGroupTakesInANewProvider (join, order, routed by
FindGroup, the user's name/routing kept, taken out stays out before and
after joining, rename, skip, share), TestChangedFoundGroupFromBefore-
KeepsItsMembers (old stored group), TestChangedFoundGroupTakesInA-
PluginProvider (the reporter's surface: the fake plugin under real Bun).
Run on mote at base
|