1ccacad63281094de8a3372d5a507d38f9969e5c
248
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f5e1b10913 |
settings: longest context can hold a model's own window too (WJaunita45604 on X)
v0.1.3681's Longest context left a window the user set for a model, or "*"
on its provider, alone even when longer. Settings > Models > Routing now has
a menu beside the field: "Models without their own" (the default, as before)
or "Every model". In both modes the shorter of the cap and the user's own
window is told; they differ only when the user's own is longer (own keeps it,
every model brings it down). Settings.ContextCapAll, Settings.CappedOwn,
POST /api/settings/context-cap-mode {all}, magpie model context-cap all|own.
Applied in provider.windowIn (so /v1/models, catalogs, compaction), Codex's
CodexNativeWindow/CodexWindow (the list's ETag tag carries the mode) and the
gateway fallback window. i18n in zh, zh-TW, ja, de.
Run (wsl-run, mote's disk was full): provider (full), settings, settingsapi,
codexcat packages; cli -run ContextCap; gateway -run ContextCap|ModelsList;
GUI context-cap, i18n-keys, model-load, settings-places, settings-general in
chromium and webkit; TestCoreScriptBudget; gofmt; go vet nogui and
GOOS=windows vet. Broken by hand: windowIn's CappedOwn removed turns
TestContextCapAllHoldsTheUsersOwnWindowsToo red.
Not tried: the whole Go and GUI suites, a real Codex reading the list, macOS
or Windows runs, GUI in zh-TW/ja/de beyond the i18n-keys check.
|
||
|
|
58fb070953 |
settings: named proxies, chosen as inherit, direct or a saved one anywhere a proxy is (@tsingchao on X)
Settings > Network keeps named proxies (name, address, optional login)
with a Test that says reachable and the latency. Everywhere a proxy can be
chosen (global, plugin downloads, a provider, a key, a Claude account) now
has a Saved mode beside the others; the value is "@<id>". Addresses typed
before are read exactly as before, nothing is migrated or overridden.
netproxy.Parse/Resolve/Redact/EnvWith/Dispatch resolve a reference at the
lowest layer, so a proxy edited once reaches the gateway, usage reads,
sign-ins and the plugin host at the next request; Claude Code's
settings.json env (a snapshot) is rewritten by provider.ProxyEdited.
A reference this computer lacks fails closed (DeadProxy), says the proxy's
name in the request error and as "Proxy missing: {name}" on the provider
row, and never goes direct. The password lives in settings.json (0600), is
never read back by the page, logged, or put in Settings sync. The list
rides with the providers part of a sync (Bundle.Proxies, MergeProxies by
id, passwords only with keys). A proxy in use can't be deleted (409).
The saved list's page code is in proxies.js, loaded when Settings draws it;
app.js grew by Saved-mode helpers only, paid for by 16 long comments cut
(core budget unchanged, no raise).
Run (mote refused ssh all session, so Go and GUI went through win-run on
xiaomi-gpu, Windows 11; gofmt and darwin/linux-nogui/windows go vet were
clean on mote before it went down, at the pre-sync tree):
- go test settings, netproxy, backup, settingsapi, davsync: ok on Windows
(earlier on mote: also gui, provider, plugin with real Bun, gateway).
- saved-proxies.test.cjs 20 of 20 (chromium+webkit, en zh zh-TW ja de,
420px) twice more on Windows; provider-proxy-missing.test.cjs 20 of 20.
One webkit de 420px run of saved-proxies failed once under 4-way
concurrency and passed 3 of 3 alone; not reproduced.
- TestCoreScriptBudget ok after the move (it was 3.4KB over before).
Red on this tree and on origin/main alike (Windows run, not mine):
settings TestSharedCheckedReadsOnceAndKnowsUnknown; provider
Codex keychain/Git tests; plugin TestHostRunsAsMagpieBun, TestPiPackage;
gui TestGatewayHeldByAContainer and others; old-webkit "compat.js is the
first" (headerpresets.js) and ":has() (Safari 15.4)" on origin/main
|
||
|
|
7476328901 |
settings: one longest context for every model (WJaunita45604 on X)
Settings > Models > Routing has a Longest context field (magpie model context-cap [<size>|off], POST /api/settings/context-cap). It lowers every model's window to it, so a user need not set each model. A window the user set on a model, or on its provider with "*", wins and is not capped; a model whose window is unknown stays unknown. It is applied where the window is derived, provider.windowIn, so /v1/models, every agent's catalog, group windows and the compaction thresholds that follow the window all agree. Codex's own models take it through CodexNativeWindow, CodexWindow and codexcat.Cap on the list the gateway serves; the list's ETag carries the cap so Codex asks again. The provider editor's Listed value stays the vendor's. Run (mote): provider, codexcat, cli, settings, settingsapi, gateway tests; GUI context-cap, model-load, settings-places, i18n-keys, settings-general in chromium and webkit (en, zh); TestCoreScriptBudget; gofmt; vet on darwin, linux nogui and windows. Broken by hand: windowIn without the cap turns TestContextCapHoldsEveryModelButTheOnesTheUserSet and TestModelsListContextCap red. Not tried: the whole GUI suite (one row added to an existing list, no new API read on page load), a real Codex reading the capped list, Windows run. Not covered: Claude Code's own [1m] choice (claudeRunName) and agent/claude.go's fallback when a ref has no window. |
||
|
|
71c4ef2d07 |
gui: Bark push target for every alert, and a daily spend summary (EV_John_Liu on X)
Settings > Usage has a Bark row: a server (default https://api.day.app, or
a self-hosted one) and the device key, then Test and Remove. Every alert
that goes through notifier.sendAs (allowance, balance, reset reminder, task
done, masking, sign-in) is also pushed to Bark when a key is set, whether or
not the system lets this computer notify. A second row, once a key is set,
turns on a daily summary at a time of day: today's cost and request count,
and each window or balance near its cap (the Allowance alert's share, else
80%), capped at 8 lines. It is pushed once a day (a restart does not resend;
a failed push is retried every 15 minutes; one more than 6 hours late is
left), in the page's language (en, zh, zh-TW, ja, de).
The device key is a key: the page only gets barkKeySet, never the key; it has
its own route (POST /api/settings/bark, key omitted keeps it, "" removes it),
a Settings save carries it (settingsapi.Merge), and a backup or sync without
keys leaves it out and keeps this machine's. No log line or error names it
(the Bark client replaces it with "..." in what the server or client says).
bark.js is a lazy module so app.js (budget) gains one line.
Run (mote, at the pushed tree before the rebase onto
|
||
|
|
1d41799f2a |
agent: turn off every agent's telemetry from Settings › Privacy (OipsAnthony on X)
OipsAnthony on X: "magpie 设置 - 隐私,支持统一关闭所有 Agent 的遥测功能, 这个统一管理的地方优先级最高". v0.1.3562 gave Codex, Claude Code, Gemini CLI and Qwen Code a Telemetry row each; there was no one switch for all. Settings › Privacy now has "Turn off telemetry for all agents" (settings.AgentTelemetryOff, POST /api/settings/agent-telemetry, agent.SetTelemetryAll in internal/agent/telemetry_all.go): - On: every agent found here with a telemetry switch is turned off through its own switch and that switch's rules (only keys the file lacks are written; a value of the user's own that keeps telemetry on is never written over: the agent stays on and the reply's "refused" names it and why). Each agent the switch turned off gets a stash marker, <id>.telemetry.all. An agent found later is turned off on the next state the window reads and by a one-minute gateway loop (KeepTelemetryAllOff, in WhileServing). - While on, each agent's own Telemetry row shows off, says "Off for all agents in Settings › Privacy" and its buttons are disabled; the API refuses it too (ErrTelemetryAllOff). - Off: only the marked agents are turned back on, which takes out only magpie's keys. An agent off by its own row or the user's own config before stays off. - An unreadable settings.json is unknown: nothing is written. - The setting is per computer (KeepOwn) and the generic settings POST can't change it (settingsapi.Merge carries it). app.js pays for its ~650 bytes with ten Privacy-section comments cut (core 1,533,550, under its 1,533,802 budget, no raise). Run (mote, first on |
||
|
|
4623f54190 |
gateway: HTTPS for other computers, from magpie's CA or an imported certificate (zhangly1 on X)
zhangly1 on X: Claude on another computer on the LAN needed magpie at https://. Settings → Network and sharing → HTTPS (magpie https on) serves other computers TLS on the gateway's own port, with a certificate magpie's CA (the mTLS one, in ~/.config/magpie/mtls) signs for this computer's names and addresses; this computer keeps plain http://. The switch is read per connection, so no restart. - Certificate row: Import… takes the user's own PEM certificate (with chain) and unencrypted key, in any files and order; a pair that can't be served (no key, no cert, a stranger key, a passphrase, run out, nothing PEM) is refused with the reason in the page's language and leaves nothing behind. Remove goes back to magpie's CA. --tls-cert still comes first. - magpie's CA row: SHA-256 shown, Save puts magpie-ca.crt in Downloads; the gateway serves it without a key at /magpie-ca.crt to any address the share lets in. Rows under it give curl -kO, macOS, Windows, Linux and NODE_EXTRA_CA_CERTS steps with Copy. - A page open from another computer can't turn HTTPS on or off under itself (it would lose its own address). - magpie https status|on|off|import|remove|ca --out; the serve banner names magpie's CA or the imported file instead of "(mTLS)". - docs/reference.md and gateway-routing.md say all of it, and that Windows' curl.exe needs --ssl-no-revoke for any private CA. Run: - gofmt -l clean; go vet linux -tags nogui ./internal/..., GOOS=windows and GOOS=darwin -tags nogui vet of the touched packages (WSL, mote refused ssh all evening). - WSL: go test -tags nogui gateway -run HTTPS|MTLS|ClientCert|CAFile|TLS|LAN ok; gui -run HTTPS|MTLS|Keep ok; settings, settingsapi, mtls ok; cli -run Help|HTTPS|TLS|Serve|Banner|Flag|Unknown ok. The whole cli package hit its 40m timeout in TestEveryAgentFieldNameWritesNothing (#5234, #4247, not this change). - GUI (WSL Playwright, chromium + webkit): https-settings (en, zh, 390px, strings in all four languages) ok, plus mtls-settings, allow-ips, browser-access, cors-origins, gui-de/ja/zh-tw, i18n-keys, i18n-en-no-cjk, lan-*, public-url*, api-key-theme, connect-address-kept, gateway-connect-keys, gateway-caller-keys, side-gateway-lan, menu-scroll. Reds at load ~130: api-key-theme (#5044), connect-address-kept (#5972), gateway-caller-keys (#2572), gui-ja (#5943), lan-docker (#4692), all red the same at base |
||
|
|
71075af726 |
codex: "subagents on any model" tells Codex V1 for a relay of the ChatGPT backend too (brethhbbm on X)
brethhbbm on X: lead on relay/gpt-6-astra, subagent model set to
relay/gpt-6.1-terra, "Codex subagents on any model" on. A new session's
subagents still ran on Astra, and Routing said the task was sealed and
only a ChatGPT account could read it. The model's catalog entry still
said multi_agent_version "v2".
Cause: the setting (settings.CodexAgentsV1) stamped V1 only on the
ChatGPT account's own models (codex/) and the groups one is in (Fast).
The relay lists Codex's own entry for gpt-6-astra (a sub2api asked with
Codex's client_version), "v2" included, and a relay offering Ultra is
given "v2" (AgentsV2) besides. In V2 Codex hands the lead the
collaboration namespace (spawn_agent etc.), whose arguments a relay of
the ChatGPT backend seals as the backend does (#1109), so
codexSubagentPick kept the subagent on the lead's model (sealedKept).
Fix: catalog.Model.Seals (provider.CodexSeals) marks a model whose
provider is of no sign-in on the Responses API, as the gateway's
canSeal, or a group with such a member. With the setting on, its entry
says V1 like the ChatGPT account's, listed by its relay or made by
magpie, so the task goes as text and the model set for subagents takes
it. Seals is in the list's tag, so Codex asks for the list again. A
model of an account that seals nothing (Copilot's Ultra, #656) keeps
V2, and with the setting off every entry is as before. No prompt text
or instructions change.
Real Codex (0.165.0, sandbox HOME/CODEX_HOME, fake Responses server,
model_catalog_json with the user's gpt-6-astra entry as
relay/gpt-6-astra): with "v2" the first request carries the
collaboration namespace (spawn_agent, send_message, followup_task,
wait_agent, ...); with "v1" it has none.
Run (Linux box via wsl-run; mote refused SSH for the whole session):
- go vet -tags nogui (linux), GOOS=windows go vet, GOOS=darwin
CGO_ENABLED=0 go vet -tags nogui on codexcat, provider, agent,
catalog, settings: ok; gofmt -l clean
- go test -tags nogui -count=1 ./internal/codexcat ./internal/catalog
./internal/settings ./internal/provider: ok
- ./internal/agent, and -run 'Codex|Ultra|Subagent|Sealed|Collab|AgentsV1'
./internal/gateway, were still running when this was pushed; their
results go on the release's issue thread if red
- at the pushed head (rebased on
|
||
|
|
99b080e2ee |
agents: an agent can have its own Provider in model names (KillTry27355 on X)
"希望 可以在不同的 agent中选择是否显示供应商名字,现在只能统一开关":
Provider in model names was one switch for every agent. An agent's
Details on the Agents page now has a Provider in model names row: As in
Settings · <mode> (the default, kept for everyone), On, Not on names I
set, or Off, for that agent alone. The CLI has the same thing:
`magpie model suffix <agent> [on|own|off|every]`.
- settings.AgentSuffix keeps the agent's own mode by the id its lists are
kept by (Agent.ListsFor, lower-cased, without @wsl: or #profile). An
agent with none follows PlainNames/PlainOwnNames as before, so nothing
a user already set changes.
- provider.LabelsFor(agent, es) reads that agent's mode. Every place
that named models with Labels for an agent now passes the agent: Codex's
catalog, the agents' written lists (route.go, Pi's extension), the
gateway's /v1/models (by agentOf(r)), Muse, Antigravity, Ollama, Claude
Desktop's catalog and descriptions, Claude Science. Labels is
LabelsFor("").
- POST /api/settings/agent-suffix sets it and rewrites the agents'
configs (catalog.Touched), as Settings' switch does.
- docs/subsystems/agent-wiring.md says where the mode is kept and read.
- The picker is in agentsuffix.js, imported when an agent's Details open,
so the core grows by the one line that loads it (1,529,335 of its
1,533,802 budget, after the previous commit's move). An agent whose
list takes no names of magpie's (noNames) has no row.
Tests, each red on the old code: TestAgentSuffix (provider: modes, keys
with @wsl and #profile, reset, bad input), TestAgentSuffixReachesItsFileAlone
(agent: Pi's file follows its own mode while Codex's follows Settings'),
TestModelsListFollowsAgentSuffix (gateway /v1/models per agent),
TestModelSuffixAgentCmd (cli), settings_keep (AgentSuffix survives a
Settings save), agent-suffix.test.cjs (5 languages x 1180/390 x chromium
and webkit, and a noNames agent has no row).
Broken by hand (a copy with LabelsFor ignoring the agent and the picker
reading no own mode): TestAgentSuffix, TestAgentSuffixReachesItsFileAlone,
TestModelsListFollowsAgentSuffix and every agent-suffix GUI case went red.
TestModelSuffixAgentCmd stayed green; it checks what is saved, not the
names.
Run on mote at this change on top of
|
||
|
|
add0dadd4f |
codex: a service tier set in Codex's settings goes on every request of Codex's (JackyFill on X)
JackyFill asked for a choice in Codex's agent settings that rewrites
service_tier: follow the request, force Fast, force Ultra Fast. Codex's
settings on the Agents page now have "Codex service tier", picked from
the app menu: As Codex asks (the default, nothing changes), Standard,
Fast or Ultrafast.
The values are Codex's own request values (codex-rs protocol
config_types.rs ServiceTier, tui service_tier_resolution.rs): Fast is
"priority", Ultra Fast is "ultrafast", and Standard sends no
service_tier. Flex isn't offered: the ChatGPT backend's requests drop
it (codex_request.go).
settings.CodexServiceTier ("", "default", "priority", "ultrafast";
anything else refused) is set through POST
/api/settings/codex-service-tier. codexTiered rewrites the body where
Codex's requests come in, on both ways: codexBackend (Codex signed in,
/backend-api/codex) and the main handler's Codex-on-Responses block,
which a websocket turn goes through too. It applies only when the
request is Codex's (fromCodex or agentOf == codex). Everything after
treats it as Codex's own ask: an account whose list lacks Ultrafast is
put after a mate that has it or sent priority. A bare model (Codex's own
sign-in, whose plan magpie doesn't know) gets ultrafast only where one
of magpie's Codex accounts lists it on the model (UltraModels), else
priority. The body is edited with topMember/withoutTopMember, no full
decode. Fast picks still apply after, unchanged.
Run (mote):
- TestCodexServiceTierSet, TestWithServiceTier: ok. The test signs in a
Plus and a Pro ChatGPT account against a fake backend whose lists offer
gpt-6-luna's Ultrafast to Pro only, and checks the tier sent for each
setting x what Codex asked, through /v1/responses (account:tier tried)
and on /backend-api/codex for a model with Ultrafast and one without;
OpenCode's own priority is left alone; "flex" is refused.
- go test -count=1 -timeout 45m ./internal/settings ./internal/provider
./internal/gui ./internal/gateway: ok but internal/gui, which was red
twice: TestCoreScriptBudget (1,535,075 > 1,533,802) and
TestSettingsSaveKeepsWhatItDoesNotSend (a save of the Settings page
dropped the tier). Paid for by eight Codex-row comments cut in app.js
(now 1,533,416), no raise; settingsapi.Apply keeps CodexServiceTier
as it keeps the other Codex rows. At the pushed head: go test
./internal/settingsapi ./internal/settings ./internal/gui ok, the two
gateway tier tests ok.
- go vet darwin; GOOS=linux -tags nogui; GOOS=windows (gateway,
provider, settings, gui): clean. gofmt -l: clean.
- GUI, chromium + webkit: codex-service-tier (new, en/zh/zh-TW/ja/de at
900 and 400px: 20/20), agent-prefs (56/56, Codex's row list updated),
i18n-keys, i18n-en-no-cjk, settings-search, codex-titles,
codex-subagent-model, settings-general, codex-sheet-providers,
click-scroll: all pass; at the pushed head codex-service-tier,
agent-prefs, i18n-keys, settings-search, codex-titles,
codex-subagent-model, settings-general, click-scroll: 166/166.
Broken by hand:
- codexTiered returning the body as it came: TestCodexServiceTierSet red
(17 lines).
- the Ultrafast-to-Fast downgrade for a bare model removed: red on
gpt-6-sol (sent ultrafast, want priority).
- the GUI posting to the wrong path, and the row left out of Codex's
AGENT_PREFS: codex-service-tier red in chromium and webkit.
- settingsapi without the CodexServiceTier keep:
TestSettingsSaveKeepsWhatItDoesNotSend red.
Not tried: a real ChatGPT account's Ultrafast or Fast request with the
setting on (only the fake backend), a real Codex websocket session, and
Windows/Linux runs of the GUI.
|
||
|
|
efb75ad1f0 |
gateway: client certificates (mTLS), and Remote Magpie can show one (hhdaxia on X, #5596)
hhdaxia on X asked for mTLS so a shared magpie isn't open to the internet on a key alone; clxsh's #5596 asks Remote Magpie to send a client certificate and key (PEM) to an Nginx doing mTLS, the server still verified, the Gateway Key still sent, for models, the test and streaming. Server side (magpie's own CA, internal/mtls): - Settings -> Network and sharing -> Require a client certificate, or `magpie mtls on|off|issue <device>|list|revoke`. Issue saves client.pem, client-key.pem and ca.pem to ~/Downloads/magpie-<device>; the key is kept nowhere else. - With it on, a peer that isn't this computer or a WSL distro must finish the TLS handshake with a certificate the CA issued and hasn't revoked (RequireAndVerifyClientCert + VerifyConnection -> Admits). The TLS config is chosen per connection, so the switch needs no relisten; without --tls-cert the server certificate is made by the CA in memory. - lanGuard and ClientCertGuard (magpie web's page) refuse 403 what still arrives without a verified one: plain HTTP, a proxy or tunnel on loopback (unless MAGPIE_TRUST_PROXY=1), the page port, a connection from before the switch, a certificate revoked since its handshake. - Loopback, this computer's own address and a WSL agent with its key are answered as before. - A page open from another computer can't shut itself out: without a certificate it can't turn mTLS on, and it can't revoke or reissue the certificate it came with. Client side: a provider with a base URL of the user's own (Remote Magpie included) takes ClientCert, ClientKey and ServerCA paths (editor: Advanced -> Client certificate). netproxy.WithClientCert shows them to that provider's own hosts only, on a transport per identity keyed on the files' mtimes; through an https:// proxy such a request is refused. Save refuses half a pair, a pair that doesn't match and a CA that isn't one. Run (on mote, at 4024df0f9, this commit before its rebase): - gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows. - go test -count=1 ./internal/mtls ./internal/netproxy ./internal/provider ./internal/settings ./internal/settingsapi ./internal/cli ./internal/gui ./internal/gateway: ok (gateway 893s). The first run had three reds of this change, each green at base and fixed here: TestEveryRouteHasACommandOrIsNamed (the mtls routes now name `magpie mtls`), TestSettingsSaveKeepsWhatItDoesNotSend (MTLS kept), and TestGoroutineDumpAnswersWhileRequestsWait (mtlsRefuses asks whether the peer is remote before reading settings, so a local request never waits on the settings lock). TestHandedOffGatewayAnswersAConnectionNotedLate was reset because ServeTLS now always wraps the listener: tlsListener hands a connection it took as Close came to the server instead of dropping it. -count=3 of these and every TLS/MTLS/Handover/Relisten test ok. - Every route without a certificate, with a foreign one, a revoked one and a good one: TestMTLSOtherComputerHandshake, TestMTLSGuardEveryRoute, TestMTLSThisComputerAndProxies, TestMTLSToggleWithoutRelisten, TestMTLSRevokeMidConnection, TestClientCertGuardPage. Remote Magpie against an httptest server asking RequireAndVerifyClientCert: models and the connection test fail without the certificate and pass with it (TestRemoteMagpieClientCert). - GUI: the 92 files near the change (settings-*, provider-*, editor-*, lan-*, i18n*, allow-ips, remote-*, mtls-settings new) in Chromium and WebKit: 2904 pass, 74 fail, all in nine files red the same way at base |
||
|
|
e4197144a8 |
perf: every package's package-level regexps compile on first use
v0.1.3516 made gateway's and redact's patterns lazy. The other 299 package-level regexp.MustCompile calls, in 148 files across agent, provider, gui, library, codexcat, sessions, usage, plugin and the rest, now go through lazyre.New too, so a launch that never reaches them (`magpie statusline`, run by Claude Code on every message) doesn't compile them. Fields, maps and params that held them are *lazyre.RE. Measured on mote (M5 Pro), sandbox HOME, v0.1.3516-equivalent build (t42) against this one (t43): - GODEBUG=inittrace=1 sum: 7.39 MB / 69,837 allocs -> 4.62 MB / 46,765 - `magpie statusline`, 3 runs each: instructions retired ~212M -> ~176M, peak memory footprint 19.2-19.4 MB -> 16.8-17.0 MB Run: go vet ./... (darwin) ok; GOOS=windows go vet on each of the 30 changed packages ok; GOOS=linux go vet ok except ., internal/cli and internal/gui, which stop in wails v3's cgo files when cross-compiled (the same at main). New TestAllLazyPatternsCompile at the root compiles all 574 registered patterns (ok), so a bad pattern fails a test rather than a first use. Not run before push: the changed packages' own test suites; they run on mote after it. |
||
|
|
4bfac12683 |
plugins: downloads take a proxy of their own, apart from the vendors' (JonahFu on X)
JonahFu on X: GitHub is unreachable without a proxy, while API requests may go direct, so plugin downloads' proxy should be set apart from the one model requests take. Before: plugin downloads already followed the global proxy (fetches through http.DefaultClient and netproxy.Func, bun add and git through netproxy.Env), so nothing ignored it; there was only no way to give them a different one. Now Settings › Network has a Plugin downloads row under Proxy: Same as above (the default, unset: downloads follow the global proxy as before), Direct, or Custom with its login, remembered as pluginProxyCustom as Proxy's Custom is. The CLI takes it as `magpie settings set pluginProxy <url|direct|"">`. It covers the plugins list and Discover's lists (fetchJSONFrom), a user's own npm registry (fetchRegistry), Bun's download (getURLFrom), bun add/update/remove and the git commands of GitHub-installed plugins (dlEnv). The plugin host (bun run) keeps the global proxy: its requests are the vendors'. Both fields belong to this computer (KeepOwn) and are left out of auto-backups, since a proxy URL may hold a password. Settings' Proxy row and the new one are drawn by one helper (proxyRow); the core's script budget is met by cutting the proxy rows' comments, no raise. Run (mote, through mote-run): gofmt -l clean; go vet of the touched packages (darwin), GOOS=linux -tags nogui ./..., GOOS=windows of the touched packages; go test -count=1 internal/settings, settingsapi, backup, netproxy, plugin, gui, cli all ok (gui after the comment cut; its first run had TestCoreScriptBudget 1,352 bytes over). GUI, chromium and webkit: settings-plugin-proxy (new, 5 languages x 2 widths), settings-proxy-remember, settings-proxy-auth, proxy-test, settings-sections, proxy-login-fields and the i18n files: 102 pass, 0 fail. plugin-proxy-page, proxy-own-wording, account-proxy, provider-proxy, routing-proxy, provider-many-keys-proxy and signin-proxy: 104 pass, 2 fail, both signin-proxy's "a subscription with no proxy offers the global one" at 380px in Chromium, red the same way on origin/main |
||
|
|
6ce663c0ce |
check-in: a time of day every daily check-in waits for (times_ang on X)
times_ang asked on X: 可以调整自动签到的时间吗. Before this, the daily
check-in had no time to choose. The loop first looks 2 minutes after start,
asks every 30 minutes, and asks as the Beijing day (UTC+8) turns. So an
account was checked in at the first look after 00:00 Beijing, on whatever
clock the computer kept.
settings.CheckinAt ("15:04", local time) is one time for every check-in:
the built-in WorkBuddy, Trae, MiniMax and Qoder ones and the plugins'
auth.checkin.
- checkinGate puts it on the Beijing day the account is checked in for:
the first HH:MM on the computer's clock at or after that day's start.
- The loop holds each account's first ask of a Beijing day until then,
and wakes at it.
- Within the day nothing changes: a vendor's own turn (a plugin's until),
retries and the before-noon recheck. So a vendor day is never skipped.
- Unset keeps today's behaviour.
- A press (Check in now, `magpie accounts checkin`) is never held.
Where to set it:
- The editor's check-in groups get a Check-in time row (Off/On and a time
box, as the warm-ups do), drawn by checkinnow.js so the core stays in
its budget.
- The Usage card's not-yet line says "checks in from 09:00".
- From the CLI: `magpie settings set checkinAt 09:00`.
Run (on mote unless named):
- go test ./internal/provider ./internal/gui ./internal/tui; settings,
settingsapi and cli.
- The check-in tests again with TZ=UTC and TZ=Pacific/Kiritimati.
- TestCheckinAt*/TestCheckinGate on Windows (win-run).
- TestCoreScriptBudget at the rebased head: 1,533,673 of 1,533,802.
- gofmt; go vet for darwin, linux (nogui) and windows.
- GUI: checkin-at.test.cjs (chromium and webkit, 1100 and 420 wide, en,
zh, zh-TW, ja, de) plus 27 more files the change reaches (check-in,
warm-at, provider-prefs, settings, i18n, gui-de/ja/zh-tw).
New tests, with the zone held in UTC+8 and in UTC-5:
- One ask per Beijing day, at the set time, with no day skipped.
- A press goes ahead of the time.
- A vendor whose day turns at 10:00 gets one ask a day at 20:00.
- Save refuses 25:00.
Broken by hand:
- The gate off: the Beijing 09:00, New York 23:30, press and vendor-day
cases went red.
- The row not drawn: checkin-at 0 of 40.
Not tried:
- Real vendor accounts.
- The real Linux app.
- The whole GUI suite; the full Go suite runs after the tag.
|
||
|
|
60f0433d1b |
dsh: a model of its own for DeepSeek Harness's compaction (Musikrv77852 on X, #5395)
DSH compacts on the session's latest model (compaction-basic with no summarizationModel). A session on magpie/workbuddy/deepseek-v4.1-flash switched to another model compacted on WorkBuddy first, got 429, and the switch failed. DeepSeek Harness's opened row on the Agents page now has a "compaction model" square (compact_model), offered once dsh is on magpie's route. It is magpie's own Live setting (settings.DshCompactModel), so nothing is written into dsh's profiles and no restart is needed. The gateway moves a dsh compaction to it (dshCompactTo, Route.Moved why "dsh-compact") when the model is enabled, served by its exact id and allowed to the key; else the compaction stays as asked with a log line. The Routing page says why. On magpie's llm-pi-ai routes DSH sends no x-deepseek-harness-compact mark, so its compaction is now known by compaction-basic's own ask (@deepseek-ai/dsh-compaction-basic 0.0.1-rc.3, the latest) in compactAsks. As a result DSH compactions show as Compaction in Usage and Routing, and a group's Compact rule reaches them too. The options are spelt magpie/<id> like the model field's, so `magpie dsh deepseek/flash` still sets the model (fieldForValue gives a bare value to the first field offering it). CLI: `magpie dsh compact_model magpie/deepseek/flash`; API: /api/set. zh, zh-TW, ja and de strings added. Run (mote): go test -count=1 -timeout 45m on internal/gateway, provider: ok at the base before the rebase on 0842bc517; agent, gui, settings, settingsapi, and the gateway's TestDsh/TestCompacting/ TestRuleCompact: ok at this head. The first agent run caught the square reading dsh's profiles at a stopped WSL distro (TestWSLColdPlaceOpensNothing, #3896); its options now look at nothing at a cold place. go vet on darwin, GOOS=linux -tags nogui and GOOS=windows: clean. gofmt clean. GUI in chromium and webkit: dsh-compact-model (new, 5 languages x 2 widths), desktop-subagent-model, codex-subagent-model, routing-moved-why, i18n-keys, i18n-en-no-cjk, claude-subagent-effort-row, codex-start-model-field, model-test-why and agent-connect-no-models: 140 of 140 pass; after the rebase (i18n.js changed upstream) i18n-keys, i18n-en-no-cjk, dsh-compact-model and routing-moved-why 48 of 48. Broken by hand, each red: dropping the compactAsks line (TestCompacting, TestDshCompactMoved on all three protocols), skipping the move in serve (TestDshCompactMoved), dropping the agent check (TestDshCompactLeft's other agent), taking the square out of extra() and dropping the routing story's case (dsh-compact-model.test.cjs). Not tried: a real DeepSeek Harness desktop app (none on this Mac or on mote); the compaction text was checked against the npm package's source. DS Bot's requests can't be told from dsh's, so its compactions follow the same setting, though it has no square of its own. |
||
|
|
47f70a077f |
perf: the allow list and state read settings without a copy of their own
Every request served by the GUI and the gateway goes through AllowGuard, and AllowGuard read the allow list through settings.LoadChecked. That call reflect-copies the whole Settings each time. /api/state did the same through Load, then only encoded the result. Changes: - New settings.SharedChecked(). It is Shared plus LoadChecked's error. While settings.json parses whole it returns the settings parse already keeps, with no copy. Otherwise, or while a write is in progress, it falls back to loadChecked, so an unreadable file is still unknown, never an empty list. - allowList reads AllowIPs through SharedChecked. - state() reads settings through Shared. Nothing in gui writes into stateJSON.Settings (grepped for field, map and append writes). Measured on mote with the real-account sandbox, allocations under Settings.clone/deepCopy over 40 /api/state polls: - before: 1.5 MB and 1 MB - after: 0 and 0 The totals vary run to run (t32 34.6-35.1 MB, t33 24.8-30.8 MB). Run on mote: - go vet on settings, gateway and gui. - go test, all of internal/settings. - go test, internal/gateway -run "Allow|Remote|LAN|Lan|Origin|Guard". - go test, internal/gui -run "State|Settings|Allow". All ok. New test: TestSharedCheckedReadsOnceAndKnowsUnknown checks that a change is read and that a file that doesn't parse is an error. With the shared path broken by hand (made to fall through to loadChecked), it goes red: 24 allocations against LoadChecked's 24. Not tried: the full gateway and gui suites. |
||
|
|
ab084fdf25 |
gateway: a model's own system prompt, added after the agent's on every route (liucl on X)
liucl asked for a system prompt per model rather than per agent. A provider's editor now has a System prompt box in each model's Model settings row (Providers > a provider > Model settings). The gateway adds the text after the agent's own system prompt on every request for that model, whatever agent sends it. Empty, the default, sends the body byte for byte as before. It is only ever appended. Codex's base_instructions, Claude Code's identity block and any agent's prompt stay first and unchanged (withModelSystem in internal/gateway/model_system.go), in the agent's protocol, in serve's candidate loop after triedOn, so before translation and before a plugin's fetch: - Anthropic: string system + "\n\n" + text; a block array gets one more text block; none gets system. - Chat: the last leading system/developer message gets it after a blank line (or one more text part); none gets a system message first. - Responses: a developer message after the leading system/developer items, instructions untouched; a string input becomes that message plus the user's; none when previous_response_id is set (the turn it follows had it). - Gemini: systemInstruction / system_instruction gets one more part. count_tokens counts it (countOn). magpie's own asks (search and vision side calls, Codex titles, the router's classifier) get none. A fallback to another model gets that model's own, or none. Stored as settings.modelSystemPrompts["pid/model"] (SetModelSystemPrompt: trimmed, at most 64KB, no NUL, a model the provider serves), saved through modelPrefs[id].system; renames carry it (perModelFields). The Restore default title now says it takes the system prompt away too; the four tests that pin that title follow it. app.js stays in its budget with one comment cut, no raise. Run, on mote at this head: - TestModelSystem* (every wire format with exact bytes, empty unchanged, own asks skipped, messages/chat/responses/gemini/count_tokens routes, another model sent byte for byte as before, a plugin's model), TestProviderSaveModelPrefs, settings keep test. - Broken by hand, each red then restored: no call in serve, no call in countOn, prepend in Anthropic, empty not guarded, own asks included, any model of the provider; SetModelPrefs ignoring system; the GUI not staging it. - GUI: model-system-prompt.test.cjs (Chromium and WebKit, en zh zh-TW ja de, 1200 and 420px), model-limits, model-headers, provider-same-as, provider-detect, provider-listed-as, i18n-keys. - Real run: Claude Code 2.1.321 -p in a sandbox HOME and CLAUDE_CONFIG_DIR, through a sandbox `magpie serve` built from this tree, to a fake Anthropic upstream recording bodies. Its /v1/messages system had 3 blocks, Claude Code's own first, the prompt once, at the end of the last block; count_tokens sent "Be terse.\n\nAlways answer in Chinese." - gofmt; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...: clean. - The full go test -timeout 45m ./... and the whole GUI suite were queued on mote at this head and run after the tag (the owner's ship-now rule); what they find goes in follow-up commits. Not tried: Codex or any agent other than Claude Code for real; a real vendor upstream; the Responses, chat and Gemini shapes only through the gateway tests' fake upstreams. |
||
|
|
39569d5604 |
claude desktop: an optional Claude Magpie app beside your own Claude (#5671)
baranwang on X asked to keep Claude Desktop's own (1P, Anthropic) sign-in while using magpie. Turning on "Separate app" in Claude Desktop's row on the Agents page (or `magpie claude-desktop launcher add`) moves magpie's 3P wiring into ~/Library/Application Support/Claude-Magpie-3p and adds ~/Applications/Claude Magpie.app. That launcher opens Claude.app with --user-data-dir on that folder, so it runs side by side with the user's own Claude.app. Its icon is Claude's icon with a magpie badge. Off is the default, and turning it off (`launcher remove`) moves the wiring back and removes the app. It is macOS only: Desktop's packaged app strips CLAUDE_USER_DATA_DIR, and on Windows it hardcodes LOCALAPPDATA\Claude-3p. The folder ends in -3p because Desktop adds -3p to any other name. Restarting the isolated app ends only its own process (pkill on its --user-data-dir) and opens the launcher again. Run at 1b25cda26 (this change on origin/main |
||
|
|
dae104bfac |
capre: a length check, not an unrolled repeat, holds nine patterns
Go's regexp unrolls a bounded repeat into that many copies of its
class: [A-Za-z0-9.-]{0,254} (the session terminal's bundle id) was
89kB of program, kept from start to exit, and Codex's item-id refusal
`.{0,1000}?` 88kB. Measured one by one over magpie's 540 package-level
patterns (1.5MB in all), the nine largest bounded ones were ~440kB.
capre.MustCompile(expr, max) is the pattern with * or +, matching only
a string of max characters at most (rune count, so the (?i) Kelvin
sign and invalid bytes count as the regexp counted them). The nine:
settings' bundle id, library's name and agent id (now name@wsl:distro
cut in two), Anthropic tool names, the trace page's name and find,
access's MCP server, OpenClaw's profile and Codex's provider id. The
item-id refusal is a function: the tail within 1000 characters of a
head.
Run on mote (go1.26.8):
- go test ./internal/capre ./internal/access ./internal/settings
./internal/library ./internal/sessions ./internal/agent ./internal/gui
. : ok; ./internal/gateway -run 'ItemID|Undeclared|ToolName|Refus': ok
- TestCappedMatchesBounded holds each old pattern against its new one
over 14 units x 19 lengths (0..300, at each bound +-1); with the
length check taken out it is red (1586 mismatches).
TestItemIDRefusalAsTheRegexp holds the function against the old
regexp at 998..1002 characters of x, é, 日, \xff, \n; with 1001 it is
red. TestCappedIsSmall: 1304 bytes held, 49680 bounded.
- go vet native, GOOS=linux and GOOS=windows over the touched packages
(gui natively: its Linux build needs cgo); gofmt -l clean.
- Real build, GODEBUG=inittrace=1: magpie's own inits allocate
11.93MB -> 10.61MB.
- Idle on the real-account copy, 180s heap: regexp programs (sampled)
4.54MB -> 3.01MB.
Not tried: the full ./... suite; the gateway package beyond the run
above.
|
||
|
|
c7ebb6f8d9 |
settings: Video generation picks the model Magpie Image makes videos with
The same Discord (#feedback) user: a custom provider's video model still couldn't be chosen. A custom provider's video model was already found (seedance, kling, veo, wan, hailuo ids by name, or marked by hand with right-click › Makes › Video model, #1399), but generate_video always used AutoVideomaker's pick, the first video model of the first provider, with nowhere to choose another, as Settings › Images does for images. settings.VideoGen (provider/model or a routing group) is now the model a request that names none makes its video with, while it resolves; else AutoVideomaker's, as before. Image generation turned off turns video off with it, as before. Settings › Models › Images gets a Video generation row under Image generation: Automatic (naming the automatic pick) and every model Magpie Image can make videos with. A pick that no longer makes videos (provider gone or off, model unmarked) says so and the automatic one is used in its place; the settings API refuses a model that makes none, and keeps the pick when a save doesn't send it. The row is drawn by videogen.js, imported when Settings draws Image generation, with one call in app.js: drawn in app.js it put the core scripts 616 bytes over TestCoreScriptBudget (1,534,418 > 1,533,802, found by the first full run), and the budget is not raised. Run on mote: - At this change on |
||
|
|
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 |
||
|
|
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
|
||
|
|
da548b4548 |
codex: a reset about to expire can be used from 3 minutes before, or after any minutes typed (Custom…)
shangyuan0818 asked again, and the coordinator agreed: magpie runs the whole time, a reset's expiry is known to the second, and a user who is worried can pick a long lead. So the menu ends with Custom…, and the floor is now what the gateway needs, not 15 or 5 minutes. - settings: CodexResetLeadLeast 5 -> 3; the presets start at 3. The CLI (magpie quota reset-lead) and settings/codex-reset-lead check the same constant. Saved values stay valid: everything from 5 to 1440 still is. - Why 3: since v0.1.3204 the loop wakes at the lead's start (timer, at most 1s late), a try is bounded by the pass's 2 minutes, and a failure in the last 15 minutes is tried again a minute after it began, at once when that has passed. At 3 minutes a try hung to its bound ends at T-0:57 and a retry starts at T-0:56. At 2 minutes a hung try leaves no retry before expiry. - GUI (autoresetown.js): Custom…, the menu's last item, puts a field of minutes where the button was, at the button's size, so the row doesn't rewrap. Enter or leaving it saves. Escape keeps the lead. A number outside 3 to 1440 is shown as an error and not written. A redraw leaves the field alone while it is open. It uses the app menu and no native select. There is one new string, in all five languages. Tests: - TestShortLeadSpentInTime: at the least lead, for four phases, the reset is spent at T-3:00, and after a 2-minute hung try plus a 30s retry it is spent before expiry. - TestQuotaResetLeadCmd: 3m is taken and 2m is refused. - codex-reset-lead.test.cjs: 12 items, picking 3 min, and Custom… in every language at 1100 and 420. Typing 7 and pressing Enter posts 7. Typing 2 is said and not posted. Escape posts nothing, and leaving the field posts 12. Opening the field moves no page. Run on mote at this tree: - go test of the reset-lead, short-lead, reset-loop, expiring and quota-reset tests in provider, cli and settings: ok. - go vet: darwin, linux -tags nogui and windows on provider, settings and cli, plus darwin on gui: ok. - go test ./internal/gui: TestCoreScriptBudget ok with no raise (the field lives in the lazy autoresetown.js). TestMainWindowCorners is red, as in #3949. - GUI codex-reset-lead, codex-auto-reset-settings and i18n-keys in Chromium and WebKit: 49/50. The red is i18n-keys "a plugin's words are its own", filed as #5327, #5332, #5426 and #5482. Before the last comment trims, codex-reset-lead, codex-auto-reset-settings and providers-reset-use passed 86/86. Broken by hand, each red: - Floor at 2: the least-lead hung case goes red (one try, no retry), and so does the CLI (2m taken). - Floor at 5: the CLI refuses 3m. - The GUI range check removed: "2 isn't posted". - Escape saving: "Escape posts nothing". - The field at its own size (76x27) instead of the button's: WebKit ja and de at 1100 move the page 1px. Not tried: a real ChatGPT reset spent at 3 minutes, since none of my accounts has a reset about to expire. The redraw guard has no test of its own, because a click elsewhere blurs the field and saves first. Reported-by: shangyuan0818 (Discord) |
||
|
|
d4a221f79c |
codex: a reset about to expire can be used 5 or 10 minutes before it does
shangyuan0818 on Discord asked for leads under 15 minutes (1, 3, 5, 10, or
free seconds) for Codex's auto-use of the reset about to expire, to use
more of the windows first. The shortest was 15m because the gateway only
looked every 5 minutes after a pass ended (a pass is bounded at 2
minutes), so the gap between looks could reach ~7 minutes. With a 5-minute
lead, the reset could run out before any look landed inside it.
- provider: a look lands on the lead's start (nextResetLook takes the
sooner of +5m and until-lead), and the loop sleeps until the soonest look
due among the accounts its pass went over (expiringResets.wake: 5m at
most, 1s at least; an account the pass skipped wakes nothing). A read or
spend that fails inside the lead in the last 15 minutes is tried again
in 1 minute (retryResetLook), not 5; a long lead failing earlier keeps
the 5-minute cadence. A retry that came due while a hung pass ran is
made at once.
- settings: CodexResetLeadLeast 15 -> 5; choices 5m, 10m, 15m, 30m (default),
1h ... 24h. Saved values from 15 to 1440 stay valid; the default is
unchanged.
- GUI (app.js RESET_LEADS, resetLeadMinutes) and CLI (magpie quota
auto-reset lead) follow the same range. No new strings ("{n} min"
already exists). Still the app menu, no seconds field.
Why 5 and not 3 or 1: in the worst case a try hangs to the pass's 2-minute
bound. At 5m: try at T-5:00, hung until T-2:57, retried at T-2:56, so two
tries before expiry (four when ChatGPT refuses at once). At 3m a hung try
leaves no retry. At 1m one try cannot even run to its own bound, and
local-vs-server clock skew eats the rest.
Run (mote, via mote-run, at base
|
||
|
|
4e0e8e7933 |
gateway, settings, gui, cli: the results a search is answered with can be set, 1 to 20 (#5545)
Claude Code's WebSearch and Codex's web_search never name a count, so magpie answered every such search with searchHits, 6 pages (#5545, mdwsk88: more pages for research-heavy work, fewer to save context). settings.SearchCount holds the count. 0 means the default, 6 (SearchCountDefault), and the most is 20 (SearchCountMost), the most Brave and Tavily return. Save refuses a value out of range, so nothing is written. Settings.SearchPages reads it. The gateway's searchCount falls back to it when a search names no count. The web_search MCP tool still answers a named count with that count, and its schema's default says the count set. It reaches every search API (Brave, Tavily, Exa, You, the plugins' searchers), as a named count already did. - Settings › Models › Web search: "Results per search", segments 3, 6, 10, 15 and 20, plus a count set by hand in settings.json. POST /api/settings/search-count sets it alone. settingsapi.Apply keeps it as it keeps search-all, so a save of the Settings form doesn't put it back. - CLI: magpie search count says the count; magpie search count <n> sets it; magpie search count default puts 6 back. A bad value is refused and nothing is written. - docs/subsystems/gateway-routing.md says it. - New strings are in zh, zh-TW, ja and de. Run at this tree (mote-run, macOS): - go test -count=1: internal/settings, settingsapi, cli, gateway (TestSearchMCPCount, TestSearchCountReachesEveryAPI, TestSearchCountSetting), and gui (TestSettingsSearchCountSetOnItsOwn, and TestSettingsSaveKeepsWhatItDoesNotSend with SearchCount set): ok. internal/gateway whole: ok with -timeout 45m (847s). internal/gui whole: ok but TestMainWindowCorners/macOS_26_SDK (#3949, mote is on macOS 27). The first cli run was red on TestEveryRouteHasACommandOrIsNamed: the new route had no CLI entry. cliForRoute maps it to search count now. - Broken by hand: searchCount returning searchHits again makes TestSearchCountSetting fail ("set 11: a search naming no count asks for 6, want 11"). Restored, it passes. - GUI: node --test --test-concurrency=4 over routing-*, usage-*, ledger-*, panel-*, call-*, search-*, searcher-*, settings-*, i18n-* and gui-* (Chromium and WebKit; the files cover en, zh, zh-TW, ja and de), with #2398 and #5545 in one tree: 4961 of 5016 ok. The 55 reds are in 12 files. i18n-keys' "a plugin's words are its own" names other files' strings (#5327, #5426, #5482). The other 11 files were run alone at dc49feca9 (this tree without either change) and at this tree: 52 and 51 reds, the same tests. The one apart is usage-focus-steady, which flakes (#3501). Each is filed: #5392, #3414, #5048, #3799, #3415, #3954, #4627, #4628, #5223, #1529. routing-canceled-row.test.cjs: 10 of 10. With the .rt-req.gone rule taken out, its dot is the answered green rgb(24, 154, 88) and it fails. Restored, it passes. - Not tried: a real Claude Code WebSearch through this tree with a live search API key. The tests use fake search APIs. Co-authored-by: mdwsk88 <11055210+mdwsk88@users.noreply.github.com> Reported-by: mdwsk88 (dawei on Discord) |
||
|
|
6ac1e04244 |
provider: a Claude model on Copilot has its 1-hour cache write priced as Copilot bills it, at the 5-minute write (#3435)
Copilot bills a cache write at one price however long it is kept. Its copilot_usage counts a 1-hour write as the cache_write a 5-minute one is, and GitHub's "Models and pricing for GitHub Copilot" (docs.github.com/en/copilot/reference/copilot-billing/models-and-pricing) lists one "Cache write" price per Claude model, no 1-hour tier (Opus 5.5: input $4, cached input $0.20, cache write $5, output $20). magpie gave every Claude model's list price Anthropic's 1-hour write, 2x input (catalog.OneHourFor), so copilot/claude-opus-5.5 was priced at $8 per million for an hour's write where Copilot bills $5: on the reporter's request, $0.125456 against Copilot's own $0.078443. A Copilot price (tariffOf, cacheWritesAlike) now has no 1-hour write of its own, so an hour's write is billed as a 5-minute one (catalog.Price.OneHour), its tiers alike, copied as they may be the catalog's. This holds for a call read after Copilot was signed out too (tariffOf's unknown-provider path, MakerPrice), which the reporter's patch left at 2x. A price the user gave for a Copilot model keeps the 1-hour write they gave, and one they left out isn't filled with 2x input (userPrice, so UserBasePriceIn reads it alike). Every other provider is as before: Anthropic, Bedrock, Vertex and relays bill the hour at 2x, so the rule is scoped to Copilot's id, not taken off every non-Anthropic provider. Usage rows are priced as they are read (Record.CostAt), so calls already recorded read at the new price too. docs/reference.md and ModelPrice's comment say so. Run on mote (go1.26.8, macOS) at |
||
|
|
ead0bf0059 |
agents, sessions: open in a terminal on Windows and Linux too, and copy any CLI agent's launch line
lileo0668 on Discord: clicking an agent should start it in a terminal,
and a history session should resume there. Opening a terminal was the
Mac app's only (Open in terminal on an Agents row, and Sessions' Open in
the selected terminal and Continue with another agent), and Copy launch
command was only for agy, Cursor (local) and Claude Science.
- terminal_open.go: openTerminal off a Mac.
- Windows: Windows PowerShell (the system default), PowerShell 7 and
Windows Terminal. The line, PowerShell's as Sessions already copies
it, goes as -EncodedCommand: no script file, so no execution policy,
no file encoding and no quoting in between. A shell gets its own
console through cmd's start (magpie's children are CREATE_NO_WINDOW);
wt is started directly, on pwsh or else powershell.
- Linux: $TERMINAL, then xdg-terminal-exec, then x-terminal-emulator,
then the first of GNOME Terminal, Konsole, Xfce Terminal, kitty,
Alacritty, Ghostty, foot, WezTerm, Terminator and XTerm, each with its
own words before the command. The line runs from a script of its own
in sh, then the user's shell, as the Mac's .command file does.
- A terminal that quits failing within a second says so, with what it
printed ("cannot open display").
- Settings' Session terminal row lists the terminals found on Windows and
Linux too; no row when none is found.
- Every agent row with a program now carries `command`, the line the
server builds (Launch, or the program quoted for this system's shell;
an agent in a WSL distro is started through wsl.exe on Windows). The
row menu (right-click or the grip) has Copy launch command after Open in
terminal, on the web build and in the panel too.
Run:
- mote (macOS 27, go1.26.8): go vet of internal/gui and internal/settings
for darwin, for linux with -tags nogui, and for windows; GOOS=windows
and GOOS=linux (nogui) builds of the binary; go test ./internal/gui
./internal/settings ./internal/agent. Everything passes except
TestMainWindowCorners/macOS_26_SDK, which is #3949.
- Windows (win-run, xiaomi-gpu): go test ./internal/gui ./internal/settings.
The new tests pass, among them TestAgentLineWindows, where real
PowerShell runs the encoded line on a claude.cmd in a folder named
`it's a $(New-Item made1) & New-Item made2 #` and runs nothing else.
The six reds are filed: TestLodyImportHandoff,
TestImportStatusUnreadableIsUnknown and TestAionUiImportRow (#4115),
TestUpdateThatWontStart (#1827), and TestPluginAgentMissingSaysSo and
TestGatewayHeldByAContainer (#5324).
- Linux (wsl-run, magpie-desktop): go test -tags nogui -timeout 45m
./internal/gui ./internal/settings: both ok (internal/gui 630s; at
the default 10m it timed out with nothing hung)
- Real use. A throwaway test called openTerminal, not committed.
- On xiaomi-gpu's console desktop (schtasks /IT): system default and
wt each opened a window and ran a line with ' and 中文. pwsh isn't
installed there and was refused by name.
- On magpie-desktop under Xvfb: the system default
(x-terminal-emulator, the xfce4-terminal wrapper) and xfce4-terminal
each ran it (TERM=xterm-256color, set by the terminal). xterm isn't
installed there and was refused. Without a display, xfce4-terminal's
"cannot open display" came back as the error.
- GUI (mote, Playwright Chromium and WebKit): agent-open-terminal (five
languages, 980px and 420px; Copy sends the server's line to /api/copy
unchanged), session-terminal (Win32 and Linux platforms at 420px, and
no row when nothing is found), settings-general, and the agent-*,
sessions-*, session-*, gui-de, gui-ja and gui-zh-tw files with
fold-show-grip, grip-inset, tap-click, menu-input-scroll and
click-scroll (102 files): 1689 pass, 5 fail. The fails:
menu-input-scroll, 4 of 4 red alone on origin/main
|
||
|
|
bd18b7e280 |
gateway: Settings' Longest wait an agent is told bounds every Retry-After it hears (#5371)
tlerbao (#5371): an Antigravity quota ran out, magpie rested the account
until the plan's reset hours away, and that horizon went to OpenCode as
Retry-After. OpenCode clamps one wait at 900s and asks the same model a
few times, so it sat ~45 minutes before its own fallback chain moved on.
RetryAfterCap (seconds, unset by default) bounds the Retry-After an
agent is told. Accounts rest exactly as long either way: restAfter and
the held try read the header before it leaves.
Changed from ggbdpq's patch:
- The cap is one wrapper in Server.Handler (retryCapped), on every
answer of 400 and up, not capAfter at four call sites. The patch
missed the vendor's own Retry-After passed on by keepRetry (19821s and
an HTTP date went out uncapped) and any other site that writes one.
The wrapper has Flush and Unwrap, so ResponseController and the
websocket's Hijack still reach the connection.
- settings.Shared() per answer, not settings.Load() from disk.
- The setting is reachable: settingsapi Keys and Merge (kept when not
sent), a Settings › Models › Replies row (1/5/15 min, No limit) with
zh, zh-TW, ja and de text, and prefsKeep. The patch failed
TestKeysAreWhatTheSaveWrites ("only saved: [retryAfterCap]").
- Stays opt-in: a default cap makes a backing-off client ask again
sooner, and each ask can spend a confirm probe on an exhausted account.
- Core script budget not raised; three app.js comments were shortened.
Run on mote at this head (rebased on
|
||
|
|
d00e41604c |
settings: the image model error's example is gpt-image-2, not the shut-down gpt-image-1
OpenAI shut gpt-image-1 down on 2026-10-23. Run: go test ./internal/settings on mote: ok. |
||
|
|
93d5c76c0d |
router: an agent with many tools is given them on demand
ArvinCharl on X: the MCP router's tools fill the context. An agent that
doesn't search its MCP tools itself (all but Claude Code, Claude
Desktop, Codex and Pi) sends every tool's whole schema on every
request. Given more than 10 router tools, such an agent now lists two in
their place: find_tools (matches by name and description, the first 5
with their inputSchema, 15 more by name) and call_tool (runs one by
<server>__<tool>, its bare name, or arguments sent as a string; an
unknown name is told the close ones). The instructions still name every
server and its tools, and a tool called by its own name still runs. The
request log names the tool call_tool ran. The address for any other app
lists every tool, since which app connects isn't known.
Library → MCP gains a "Tools on demand" toggle (settings
routerAllTools, kept by KeepOwn and the settings API); turned off,
every agent gets every tool whole as before.
Run on mote (after the rebase onto
|
||
|
|
3eb2bda4f2 |
settings: Codex, Claude Code and Grok Build each take a Long conversations of their own (molianyin4227 on Discord)
molianyin4227 (Discord #help): models differ, so one compaction size
for every agent fits none; they asked for Codex, Claude Code and Grok
Build to each have their own, falling back to the shared one.
- settings.AgentCompacts[agent] {At, Full} for the agents that write a
compaction window (CompactAgents: codex, claude, grok); Settings.
ForAgent(agent) lays it over CompactAt/FullContext for that agent's
readers only: codexcat.entriesAt, provider codexListed, Claude Code's
writeCompact and desktopPlan, grokModelTables, the route list's
buildModels, Codex's window line (api.go) and Tuned for you
(gui/tune.go, agent/tune.go). A model's or provider's own Compact at
still comes first. An agent with none follows the shared value, so
nothing new is written for it, and an agent outside the three has no
such key and is refused (provider.SetAgentCompact).
- POST /api/settings/agent-compact {agent, own, full, at}; own false
takes the agent's value away. settingsapi.Merge keeps the map.
- GUI: a row "Long conversations in <agent>" under Long conversations,
in the agent's opened row and its sheet: Every agent / Compact at N /
Full window (segs, no select), a size box when Compact at. It lives in
agentcompact.js, imported when the agent's settings hold Long
conversations, then put in synchronously (an async put-in after a
redraw moved the page in chromium: codex-memories-settings' scroll
check). It draws again only when its own values change. i18n in
zh, zh-TW, ja, de.
- Tuned for you's Use on an agent with its own value changes that one,
stashed under tune.long.compact.<agent>; Undo puts it back.
- codex-memories-settings' "no Codex" check counts Long conversations
alone again (:not(.agent-compact)) and waits for the new row.
- docs/subsystems/agent-wiring.md: a row for it.
Core size: app.js 1,311,919 bytes, 109 under origin/main
|
||
|
|
1e1068c86c |
codex: "Same as the lead" holds every subagent to the lead's model (cleverpigo on X)
cleverpigo (Windows, Codex App 26.1027.6604.0) had Codex's lead on WorkBuddy's DeepSeek-V4.1-Flash, the subagent model on what the GUI called "Same as the lead", and the Routing page still showed a subagent on gpt-5.6-sol through Codex's own sign-in. Cause: that setting, unset, never held a subagent to anything. Since |
||
|
|
3c2dceb340 |
gateway: "member" in Model name in replies names the member to Claude Code and Codex too (ZoeCats)
ZoeCats (Discord #feedback, after v0.1.2760): with Settings › Models › Replies › Model name in replies on "vendor" the name is no longer written over, but on "member" (作答的成员) a reply still didn't name the routing group's member that answered. Cause: replyNamingOf turned the "member" setting into the model asked for whenever the agent was Claude Code, Claude Desktop or Codex (vendorNamed, kept from #822's memberModel). ZoeCats's agent is Claude Code, so the setting did nothing for them, while "vendor" was already for every agent. The setting was saved and read as it should be (the vendor choice worked through the same path), and an absent X-Magpie-Response-Model falls through to the setting. Fix: the user's pick is for every agent. Those three already take a provider/model id back under the default (the group or provider/model they asked for), so the member's provider/model id is no new shape for them. vendorNamed, replyNamingOf's unused agent argument and the dead namesMember are gone. The menu's note for "member" says "for every agent, groups included" in en, zh, zh-TW, ja and de; settings.go's comment and gateway-routing.md say the same. Tests (fake upstreams, no network): - TestReplyNamesMember: "on, codex", "on, claude code", "old file on, codex" now want the member, plus "on, claude desktop" and "on, codex, name asked" (the header still wins), on 6 paths x streamed or not, each after a failover in a group. - TestPluginReplyNamesMember (new): a group served by the fake plugin, Chat and Messages, streamed and whole, with no token and Claude Code's, member and default. - TestGeminiReplyNamesAskedModel: also with replyModel member and vendor. - reply-model-setting.test.cjs: the member note says every agent and names no Claude Code. Red on origin/main |
||
|
|
91379b9339 |
settings: a reply's model can be the vendor's own name again, the member, or the model asked for (ZoeCats)
ZoeCats (Discord #general): since v0.1.2473 a reply's model says the name the client asked for (a group or provider/model id), groups that aren't aggregates included, and the only way back to the vendor's own text was the X-Magpie-Response-Model header, which their client can't send. Settings › Models › Replies › Model name in replies (replyModel), picked from the app's menu, in en, zh, zh-TW, ja and de: - "" the model asked for (the default, as now); - member: magpie's provider/model that answered (what memberModel did; Claude Code, Claude Desktop and Codex still get the name asked for); - vendor: the vendor's own text, for every agent, the vendorNamed three included, as every agent got before v0.1.2473 and as the header's "vendor" already gave them. X-Magpie-Response-Model (asked, member or vendor) still picks for its request; an unknown value falls through to the setting, as before. memberModel is folded in without changing anyone's choice: a file with memberModel on reads as replyModel member, an explicit replyModel wins, and memberModel is written beside it as a mirror so an older magpie reads the same. An older page sending only memberModel changes the setting only when its switch moved (a vendor choice survives its saves). The CLI's set/reset goes through Keys/Choices (replyModel in place of memberModel). app.js's row is paid for by five comments in Settings' code cut down: app.js is 145 bytes under its base, no budget raise. Run on mote at this head (rebased on origin/main |
||
|
|
2ab9235711 |
agents: an agent's picks can be kept to this computer, as an MCP server can
chenxiang0010 on Discord: 「agent当前选择的模型可不可以像mcp那样 只对当前设备生效」.
Sync carries every agent's picks (model, effort...) between computers;
an MCP server has an opt-in "This computer only" that sync and backup
files never carry. Agents now have the same: the row's menu (right-click
or ...) has This computer only, off by default, so an upgrade changes no
pick on any computer.
- settings: AgentsHere, this computer's own (KeepOwn), and kept by a save
of the Settings page (settingsapi.Apply), which doesn't send it.
- davsync: each kept agent adds "<id>.*" to the own set (withHere, isOwn),
so a sync neither pushes its fields nor brings the server's; a Restore
from the server leaves them. sync-state.json records the list as of the
last sync (Here): hashes before a sync use it and after use the current
list, so turning it on or off is no change on either side, and a changed
list forces the sync past its early returns. Turned off, the next pick
goes up again. Other agents still sync both ways; the implicit own
fields (hayden4608) are unchanged.
- backup.Restore skips a kept agent in a backup file.
- gui: POST /api/agents/here; the row says "This computer only" beside
the version (hidden in the tray panel and in a narrow row), menu ticks.
Core words moved from the library plugin's i18n into core i18n
(zh/zh-TW/ja/de). Comments in renderAgents cut to pay for it under the
core budget (no raise).
- cli: the route is named under stage 3 (no command yet).
- docs/subsystems/sync-backup.md describes it.
Run on mote, at the base
|
||
|
|
ed978e560f |
gui: the Quit question's Don't ask again, and Settings › General › Ask before quitting (zhujiu on Discord)
zhujiu (Discord #feedback) asked for a 不再提示 on the question a tray Quit asks while agents go through magpie ( |
||
|
|
da275848b6 |
tray: Windows shows a card's number in its icon (Benjaminliang_1 on X)
Windows' notification area shows no text beside an icon, so with a card in the tray the icon itself is now the first card's figure: the first row of the first card whose first row is a percentage, used or left as Allowance display has it, its digits alone (trayIconFigure). It is drawn in Segoe UI Semibold (Go's bold if the font can't be read) at SM_CXSMICON, white on a dark taskbar, near black on a light one, as tall as fits, centred by its ink, three digits narrowed into the square (trayNumberIcon). It is drawn again when the figure, the icon size or the taskbar theme changes (SystemThemeChanged wakes the loop); the tooltip still lists every card. A balance or magpie's totals are skipped; with no such card, or no cards at all, the icon is the bird as before. Settings > Usage > Tray icon number (settings.TrayNoNumber, Windows only, on by default, kept per computer) keeps the bird when off; Menu bar windows is now shown on Windows too, since it picks the row the number comes from. The number row sits after Menu bar cost, so the bird > pace > cost order the other tests pin holds. Linux and the Mac are unchanged. New words in zh, zh-TW, ja and de. app.js stays in the core budget with one comment shortened, no raise. Run at this commit on origin/main |
||
|
|
ec104b8625 |
gateway: a Codex account can spend its credits before magpie moves to another account (jojonas_xyz on X)
jojonas_xyz on X: "我账号额度用完了自动给我切了别的号…找不到怎么关掉设置…你怎么知道 我不是想用 credits 呢". (Roughly: "my account ran out of quota and magpie switched me to another account by itself; I can't find a setting to turn that off; how do you know I didn't want to use the credits?") Cause. At 90% or 98% of a window, smart routing's tier put the account behind every account that still had room, whether or not it had ChatGPT credits. Codex's own sign-in (NextLogin / SwitchWhenSpent) moved at the spent share in the same way. The account's credits were spent only once every other account was used up, and the switch was a log line. The Use credits switches that existed (on, and "Only after other accounts" from |
||
|
|
e5f66f8a61 |
claude: with the interactive mode on, nothing ever runs as -p; the editor switches TUI and claude -p
The owner (11-01): the interactive mode falling back to -p is dangerous,
for the account (a -p request counts as another client's) and for the
cache (a -p run starts without the interactive mode's), so it goes
entirely. With Settings › Models › Replies' interactive mode on:
- a request it can't take (safeguards, client cache marks, a JSON
schema, an image by URL, words over 400KB, a branch of a -p session,
a WSL Claude Code whose home or transcripts magpie can't reach) is
refused before any Claude Code starts, saying why and naming the
setting (claudeTUIErr), never run as -p;
- a helper that can't start the interactive mode (sign-in asked,
first-run notes, an untrusted folder, no prompt within ReadyWait)
ends saying why (claudetui fail); printMode, OnlyEnv and the
claude-tui-broken mark that sent every run to -p for a day are gone;
- a helper that never answers initialize fails the turn
(tuiNoStart), and the next turn tries again.
Off still runs every request as -p. The "Interactive only" choice of
v0.1.2448 (claudeTUIOnly) is what On is now; the setting is no longer
read or sent.
The Claude Code provider editor's "Claude Code runs as" row is a
switch between Interactive mode (TUI) and claude -p (owner, 11-01),
saving claudePrintMode and reading /api/claude/mode again; disabled in
magpie web. It reads the settings first when the Settings page was
never opened (prefs null crashed the switch; found by the GUI test).
Chromium has no onfocusin property, so the card on keyboard focus
listens for focusin/focusout. Words in en, zh, zh-TW, ja and de.
Docs: claude-subscription-bridge.md describes refusal, not fallback.
Not covered yet, now refused under On rather than run as -p (follow-
ups, each to be done inside the interactive mode): an image by URL, a
JSON schema, safeguards, client cache marks, over 400KB, a -p
session's branch, WSL transcripts Windows can't read. /usage reads
the allowance with claude -p /usage (no model request) either way.
Run (worktree at
|
||
|
|
5dfbca6274 |
cli: magpie settings list|get|set|reset, through the window's own save (#4745)
Stage 1 of #4745 (StringKe): every setting POST /api/settings saves can be read and set from the terminal. - internal/settingsapi holds the save the handler made: Merge (the carry of keys a page leaves out, moved verbatim from api.go, plus upstream's RouterNote line), the vision/imageGen/searcher checks, settings.Save's own checks, catalog.Touched. POST /api/settings and `magpie settings` both call settingsapi.Apply, so a value is checked and saved one way. It sits outside internal/gui so the nogui build has it. - `magpie settings` (list, the default, with value, default and choices; get; set; reset to settings.Defaults()), --json on list and get. Body sends the whole file with one key changed, so a key the save keeps when absent (noBird, refusalRetries, ...) is set even to off. A flag where a key or value goes, an unknown key (with near matches named) or a refused value writes nothing and exits 1; --help prints usage. - Parity guards: TestKeysAreWhatTheSaveWrites (each Settings field sent changed on its own; what the save takes must equal Keys), TestSettingsCLISetsWhatTheWindowSaves (every key the page's prefsKeep and savePrefs send is a key), TestEveryRouteHasACommandOrIsNamed (each /api route has a command or a reason in notYet, which later stages shrink; 36 have one now). - Item 3 of the stage (per-provider CLI-only fields in the window) is left for stage 2. - The open app's in-process follow-ups (fonts, Dock, tray menu, alerts, language, update re-check) run only from the window's save: #4752. Run (mote, at the pushed head |
||
|
|
01ccbd40a0 |
library: an MCP router says which computer it is, so an agent can pick between two (packinggoodsllc_07668 on Discord)
Two magpies, one in China and one in Los Angeles, each serve the same tools through their MCP router (/mcp/magpie/hub). An agent connected to both saw two identical web fetches and couldn't pick the one in Los Angeles to reach Google. Each router now says where it is: - initialize's instructions end "This router: <name>. Each of its tools' descriptions starts with [<name>]; ...", and serverInfo.title is "Magpie MCP hub · <name>"; - each tool's description in tools/list starts "[<name>] " (once: a description that starts so already, another magpie's router behind this one, isn't given it twice). <name> is the user's words (settings.RouterNote, one line, 80 characters at most) to every caller. With none it is this computer's name, to callers on other computers only: an agent on this computer has one router at hand, and its prompts stay as they were. RouterNote is this computer's own (KeepOwn): library.json is synced, settings.json isn't, so a sync never brings the other machine's name. It is set in the Library's MCP tab, in a Router name row under the router's address (shown while the router is on): a plain field with the computer's name as placeholder, saved on Enter or leaving it, Escape puts the saved words back, an input method's Enter is its own. POST /api/settings keeps it. Translated in zh, zh-TW, ja, de. docs/subsystems/mcp-router.md has the rule. Run (mote, at |
||
|
|
4c815ac2a5 |
search: searchers picked to follow the one named, tried in their order when it fails (axelburks on Discord)
axelburks asked for more than one searcher, so that when one fails another provider searches. A searcher named in Settings gave way to no other provider before, only to the Search APIs. Automatic already fell back to up to three. - settings: SearcherThen, the searchers after the one named. Entries are trimmed. Blanks, "off", the named one and repeats are dropped. - gateway: when the named searcher fails (the context still live), modelSearch asks each of SearcherThen in order and skips one that can't search now or is the same model. The first that searches answers, and the call is marked searchingInstead, so the Routing row says why the named one didn't search. If all of them fail, their errors go back together, saying "the searchers picked ..., in their order", and webSearch goes on to the Search APIs as before. SearchFailure.Instead names the one that searched in its place. - gui api: searchFailed.instead. A save takes only searchers that Searchers() offers. A save without searcherThen keeps the list, since the page's prefsKeep doesn't send it, and [] clears it. - Settings › Web search (plugins/search/settings.js, outside app.js's budget): an "If it fails" row under a named searcher, with numbered chips and Add. A chip's picker changes the chip or removes it. The row is hidden for Automatic and Off. The failure line names who searched instead, or says the ones after it failed too. The help text says the same in en, zh, zh-TW, ja and de. - docs: gateway-routing's failing searcher, and gui-shell. Tests: - TestPickedSearchersInTheirOrder (gateway): one test where the named searcher answers without searching and one where it fails. A gone entry and one that can't search are skipped, and the third searches once. With no working entry, the error says so and Instead is empty. - TestSearcherThenSaved (settings) and TestSearcherThenFromSettings (gui): what is saved, kept and cleared; refusing an entry that can't search. settings_keep_test sets SearcherThen. - searcher-then.test.cjs: chromium and webkit, en, zh, zh-TW, ja, de, at 560 and 1000 wide. Checks the row's place and words, what Add offers, the posted lists, that the chips fit with no horizontal scroll, that no click moves the page, and both failure lines. Broken by hand: running no fallback turned TestPickedSearchersInTheirOrder red (both subtests: "ds2 searched []"). Not keeping the list on save turned TestSearcherThenFromSettings and the keep test red. Run on mote (mote-run): - At the pre-rebase tree (base |
||
|
|
7503beee72 |
plugin, settings: a model's load goes past 100% for a vendor that queues (axelburks on Discord)
axelburks, on v0.1.2547: their vendor queues, so a model's load can be
past 100%, even 200%. magpie clamped every load to 100, and Busy models
last allowed 1-99 only.
- host.js reportLoad and plugin.noteLoads keep a load from 0 up. The
floor is still 0, null still clears it, and a sanity cap of 10000
(LOAD_MOST, plugin.LoadMost) keeps an absurd value from reaching the
UI or the trace.
- settings.BusyLoad takes 1 to 9999 (BusyLoadMost-1). The segment
choices stay Off/50/70/80/90, and a value set in settings.json (150)
shows as its own choice, as before.
- The editor's badge reads "180%". It is a badge, not a bar, so nothing
assumed 100 wide; the test checks it stays on one line.
- Docs: site plugins page (en, zh, ja) Values and Routing bullets, and
provider-plugins.md and gateway-routing.md.
Run on mote via mote-run, on origin/main 8d8df0639+ rebased:
- go test ./internal/plugin ./internal/gateway ./internal/settings -run
'ModelLoad|TestBusy' -v: all pass. TestPluginReportsModelLoad has
over:250 kept and huge:1e9 at 10000. TestBusyModelGoesBehind has 180
behind 120 at a threshold of 150, and 10000 refused.
- Broken by hand in a copy, with the old 100 clamps and the 99 limit:
TestPluginReportsModelLoad red ("ModelLoad(over) = 100; want 250"),
TestBusyModelGoesBehind red (150 refused).
- node --test model-load (with Queued 180% in every language, Chromium
and WebKit, 420 and 900, plus Over 150% picked at 420) and i18n-keys:
46/46 pass. go test ./internal/gui -run Budget: ok.
- gofmt -l: empty. GOOS=linux go vet -tags nogui and GOOS=windows go
vet on plugin, settings and gateway: ok.
Not run before the push (owner: push and tag first): go test ./... and
the whole GUI suite. They are queued on mote behind another session's
suite.
|
||
|
|
8d8df06399 |
plugin, gateway: a plugin reports its models' load, and busy models can go last (axelburks on Discord)
axelburks (Discord #feedback): an in-house vendor queues requests to
its busy models, and the plugin could only put the load in the model's
name, which changed only when magpie re-read the list.
- A provider plugin calls input.magpie.load(provider, {"<model id>":
0-100 | null}) whenever it likes, from its own timer. host.js
(reportLoad) clamps each number to 0-100, null clears a model, every
other value is dropped, at most 1000 a call, and it returns the count
taken. A provider that isn't a string or loads that isn't an object
throws a TypeError. It goes to Go as an unasked {event:"load"}.
- internal/plugin/load.go keeps each by provider and lowercased model
id. ModelLoad answers unknown once a load is older than LoadFresh
(5 minutes), never idle. model@size falls back to its model.
- The provider editor shows it by the model as a grey ctx badge
("87%", titled "87% busy now, as its plugin says").
- Settings > Network and sharing > Busy models last (settings.BusyLoad,
POST /api/settings/busy-load, Off by default, over 50/70/80/90% or
1-99 by hand): restLast puts a model reported over it behind the
ready candidates, ahead of the resting. The trace row has busy:<load>.
At a new turn affine moves a conversation off it (Why "busy",
busyBehind); within a turn it stays. after, readyForNew and leastHeld
skip it. Unknown load, a lone candidate, or all busy: nothing moves.
- Docs: site plugins page (en, zh, ja) "Model load" section and input
table; docs/subsystems provider-plugins.md and gateway-routing.md.
Run, all on mote via mote-run at a42736807's tree rebased on
origin/main
|
||
|
|
699ddf1524 |
gateway: a Codex account can spend its credits only after every other account, key and fallback (gokoshiki on Discord)
gokoshiki wants a Codex subscription first, then an OpenAI API key, then the subscription's credits. Until now an account at 100% that holds credits either kept its place and spent them there (on) or was held (off). This adds a third way per account, "last": - settings: CodexCreditsLast []string, empty by default, so a setting saved before it keeps its order. provider.CodexCreditsLast, CodexCreditsMode and SetCodexCreditsMode(user, on|last|off); SetCodexCredits(on) still means "in its place" and clears last. - gateway: candidate.creditsLast is true for such an account once a window for the model is used up and it is going on its credits (a call ChatGPT counts in no window stays in its place). restLast orders ready, then resting, then those, and marks Weighed.CreditsLast. restLast runs over the asides too, so such an account goes behind a provider's reserves (Accounts at once, |
||
|
|
9bb1efdde3 |
gateway: a reply names the model the agent asked for when it went out under another name (issennknight)
issennknight on Discord (#general): an agent asked for deepseek-v4.1-flash, which goes out as deepseek-v4.1-flash-1017 (settings' ModelIDs). The vendor's reply said -1017, magpie passed it back, and the agent warned that the model didn't match. Before, only MemberModel (#822) or X-Magpie-Response-Model: member rewrote a reply's model, and only to the group member's id. Now the default is nameAsked. When magpie sent the request under another name than the agent asked for (a model's own id, a routing group, a provider/model id), the reply names the asked model. That covers Chat and Anthropic `model`, Responses `response.model` (created, in_progress, completed), Anthropic `message.model` (message_start) and Gemini `modelVersion`, streamed and whole, translated paths and plugins included: it all goes through serve's one memberWriter. A vendor that sent back the wire name as asked keeps its own name, a dated -20261017 too. Usage rows, recent calls and the Routing page still record served = the vendor's name: the writer sits outside captureResponseWriter. Claude Code, Claude Desktop and Codex get the asked name (or the vendor's), never the member's id, as before. Streams are rewritten one complete line at a time (memberLines). A run with no "model" in it is written through as the same slice. Only a JSON reply that has a target at decide time is held whole, which is what MemberModel already did. A JSON body that doesn't parse (a reply cut short) goes on as it came. A request to a remote magpie now sends X-Magpie-Response-Model: vendor (passOnCaller). That magpie names the vendor's model, as before, so this one still records what served the call (TestRemoteMagpieGroupNotSwapped went red without it). Existing tests that held a native reply byte for byte now expect only its model renamed to the asked id (namedAs in member_test.go): passthrough_severed, stream_accounting, refusal, refusal_thinking, thinking_signature and vertex. The archive keeps the reply as the vendor sent it, under the vendor's name (archive_test). Also dropped: the openai-model header code. serve never relays that header, so the test for it could not pass. Run (mote, at this head rebased on origin/main |
||
|
|
05f6ca39b3 |
provider, gui: settings only read go through the shared copy
settings.Load clones the whole Settings, every provider's model prefs included. CompactsOf, OutputsOf, ModelNames, ModelEfforts, settings.SavedAddr and the GUI's providerInfoWith only read it, and providerInfoWith took a copy for each provider: 16 MB of what twenty window polls allocated in a real-account sandbox, more with each model a user has set prefs for. They read settings.Shared() now. ModelEfforts hands back a clone of the slice it finds, so a caller's change never reaches the shared settings. TestModelPrefsReadTheSharedSettings: 3000 other models' prefs; the values are right, a caller's change to ModelEfforts' list doesn't reach the settings, and each look allocates at most a tenth of Load's. Red on the old code: ~6058 allocations a look against 6056 for a Load. Run at this head on mote: go vet (darwin, GOOS=windows, GOOS=linux without the gui package) ok; go test ./internal/settings and ./internal/provider ok; ./internal/gui red only in TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners (#3949), both red on main. |
||
|
|
15066f84f6 |
appdir: a folder and file name are joined once, not on every read
appdir.Config and Cache, catalog.CachePath and LivePath, settings.Path, provider.Path and the logins path each ran filepath.Join on every call, and they are called on every read of a cached file, many times a request. Those joins were 70 MB of the 1.4 GB twenty window polls allocated. appdir.Join and JoinFile keep each (dir, name, ext) they joined, up to 4096 of them, so a path named again is the same string. A changed HOME or folder is a different key, so a test's sandbox still gets its own path. TestFoldersJoinedOnce and TestLivePathNamedOnce: 0 allocations a call. Broken by hand on mote (the files before this change) they are red at 1 allocation a call, and 3 for LivePath. Run on mote at this tree (on |
||
|
|
e6b595e1ab |
claude: Interactive only, a setting under which a model request never runs as claude -p (_yuchanns_ on X)
_yuchanns_ on X, on the interactive mode falling back to -p: for people
who stayed off magpie's Claude subscriptions because of -p, a fallback
is a time bomb. Settings › Models › Replies › Claude Code's interactive
mode now has three choices: Off (always -p), On (the default, falling
back to -p as before) and Interactive only.
With Interactive only (settings.ClaudeTUIOnly; ClaudePrintMode set too
wins):
- a run claudeTUI would make -p is not started; the request fails with
the reason and the setting (claudeOnlyErr, claudeNotTUIWhy);
- the helper is handed MAGPIE_CLAUDE_TUI_ONLY=1 (claudetui.OnlyEnv,
claudeCLI.tuiEnv). Where it would exec -p (no start, sign-in, first-run
notes, untrusted folder, 45s timeout) it exits with the reason
(fallBack in Run), and it ignores the broken mark;
- a helper that never answers initialize ends the turn with an error,
not a -p retry, and `broken` isn't counted (claudeMachineWhy), so the
next run tries the interactive mode again;
- the model test's and warm-up's "hi" (askClaude) runs through the
helper (askClaudeTUI) in stream-json, its stdin closed at the first
result. The helper command and env are built in one place now
(tuiCommand, tuiEnv) for both.
Reading the plan's allowance (/usage) asks no model and stays -p; the
setting's text says so. Docs: claude-subscription-bridge.md.
Provider editor, on e8347401f's "Claude Code runs as" pill
(ClaudeMode.Only): with the interactive mode in use and no last
request, it says a request it can't take fails, and the card's foot says
nothing runs as -p. Where the interactive mode can't run, the pill names
Interactive only, never claude -p, the line says "Claude requests fail:
<why>", and Change in Settings goes to the row. A request refused this
way never ran, so it isn't noted as the last request (noteClaudeRun
comes after the refusal).
app.js: the Replies rows share one helper (segRow, which waitRow uses
too), so app.js is 530 bytes under main's with the third choice; no
budget raise.
Tests: TestClaudeTUIOnlyRefusesPrint, TestClaudeTUIOnlyHungHelperNoPrint,
TestClaudeTUIOnlyTellsHelper, TestAskClaudeTUIOnly (gateway);
TestShimOnlyNeverPrints (claudetui: fake fail/trust/login/notes each
exit with an error and no -p, a marked-broken run still interactive);
claude-tui-setting.test.cjs (three choices, Only saves claudeTUIOnly with
claudePrintMode false) and claude-mode.test.cjs (Only in use, and Only where it can't run).
Broken by hand, each red, then put back: the startRun gate off
(RefusesPrint 200); start()'s Only check off (HungHelper 502 without the
Only reason); tuiEnv's OnlyEnv off (TellsHelper); askClaude's branch off
(AskClaudeTUIOnly); the helper's fallBack ignoring only (4 subtests);
BrokenSince's `&& !only` gone ("marked broken"); the save without
claudeTUIOnly (16 of 16 setting tests) and claudemode.js's m.only
branches gone, rebuilt on e8347401f's file (10 of 10 Only tests,
Chromium).
Run on mote at
|
||
|
|
33a284497e |
plugin options: a switch a provider plugin declares is saved where the plugin reads it (plugins#550)
`magpie plugin options cursor '{"wire_trace": true}'` wrote the entry's
options in plugins.json (a middleware's ctx.options), while a provider
plugin's switches (auth.options, the editor's Plugin options) are read
from settings' PluginOptions (input.magpie.option). The command said
"options set" and Wire trace stayed off.
Now a key that the plugin declares as a switch for one of its providers
(from the providers last listed, else asked of the plugin host) goes to
PluginOptions for that provider, through settings.EditPluginOptions, and
a running host is handed it (SetProviderOptions, 5s, best effort). Only
true or false is taken for a switch. The other keys go to plugins.json
as before; set with switches only, a middleware's options stay, less a
switch written there before. `off` puts every switch back to the
plugin's default and clears plugins.json's options. Shown with no value,
each switch is listed with its value. docs/reference.md and the plugins
page (en, zh, ja) say so.
Run at this head on mote: go test ./internal/cli ./internal/settings
./internal/plugin ok; gofmt -l clean; go vet darwin and GOOS=windows ok;
Linux go vet -tags gtk3 in WSL (magpie-desktop) ok.
Broken by hand: no key read as declared, and both new tests went red
(PluginOptions empty, the old switch left in plugins.json).
Not tried: the real CLI against a running magpie with the Cursor plugin
installed; a plugin not listed yet (the host path) is not in a test.
|
||
|
|
7b09d2c951 |
provider: a model can be listed by an id of the user's at its provider, asked for by its own
zeewell on X (tweet 2116404121930432888): relays serve one model under
ids of their own (deepseek-v4.1-flash-1017, grok-4.6@500k). They want to
give each one their own id at the provider layer. magpie then lists,
routes, groups and finds groups by that id, and the upstream request
still carries the vendor's id.
Choice: a new per-model map, settings' ModelIDs
("<pid>/<local>": "<own id>"), served through the wire names that
already exist. ModelSameAs was not widened. It means "same as another
vendor's model": it lends specs and joins found groups. Making it rename
models everywhere would change every existing user's ids and refs.
ModelWires was not reinterpreted either, for the same reason. ModelIDs is
ModelWires turned round: a wire keeps magpie's id and changes the one
sent, and this keeps the one sent and changes magpie's. Settings.Wires()
merges each entry in as a wire name (wrapped by a "<pid>/*" wire). Every
place that sent a ModelWires name (gateway, usage ledger, request page,
UpstreamName, UpstreamNameAs) reads Wires(), so the upstream id needs no
new path. An explicit ModelWires entry for the same id wins.
- Listed by the local id: Available, liveIDs/liveByID, Serving and
ListPrice translate through OwnModelID. /v1/models, agents' lists,
Resolve, routing groups and found groups (auto/<local>, merged with
every other provider serving that id) all see the local id.
- Only a provider of the user's own (Account == nil) takes one. An
account's or a plugin's request is built from its list's id, which no
wire reaches.
- Two variants of one provider given one id: the latest given it wins,
and the earlier one is listed by its own id again. The CLI names it.
The editor refuses two rows given one id in one save. A model of the
provider's own id that a variant is listed by (plain grok-4.6 beside
grok-4.6@500k) is not listed while the variant has it.
- The user's values are never overridden. SetModelID moves picks,
contexts, fallbacks, groups' members/rules/fast/placed/off/weights/
classifier/pick, the pickers' lists, every per-model setting
(Settings.MoveModel) and gateway keys' models (provider.ModelMoved,
set by access) to the new id, but only where nothing is under the new
id yet. Agents' own files are not rewritten: an old provider/<own id>
still resolves and is sent as it is. Group match patterns and key
patterns stay as written.
- Key limits: a key held to either id passes for both (modelAllowed:
the ref, OwnModelID, ListedModelID). Group members use the same check.
- Usage: model = the listed id, served = the vendor's id from its reply.
The price is the own id's first.
CLI: magpie model id <provider/model> [<id>|--reset], magpie model ids.
GUI: Providers > a provider's editor > Names & levels > "Listed as",
beside Same as. It is staged with the editor's Save and taken back by
Restore default, in zh, zh-TW, ja and de. Accounts have no box.
Docs: providers-accounts.md, gateway-routing.md, and site start.html in
en, zh and ja.
Run (mote-run, at this tree rebased on
|