f2eb56c6bbde1300dddc402861b59cd4e45e0215
714
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f03ed8c26e |
agents: Open in terminal on a Mac's Agents row (coolmantou)
coolmantou on Discord asked to start an agent from magpie's Agents list.
In the Mac app's window, an agent row's menu (openRowMenu, the one the
grip and a right-click open) now has "Open in terminal". This includes a
row under Not set up. Clicking it posts POST /api/agents/open with only
{agent: id}. The server finds that exact id in agent.Detected() (not
agent.Find's prefix match) and builds the line itself: the agent's
Launch() where it has one (agy, Claude Science, Cursor local), otherwise
its program's path, single-quoted (BinPath, new in internal/agent).
openTerminal then opens that line with the user's Session terminal
choice. The command never comes from the page. Other systems, the web
build, WSL agents and desktop apps with no program are refused, and
their rows have no item (agentJSON.terminal). The tray panel's rows don't
have the item either. The label is "Open in terminal", not "Terminal",
because the user's terminal can be iTerm or Ghostty. The string is in
en, zh, zh-TW, ja and de. Windows and Linux are #4474.
The core budget had 39 bytes left on main, so no budget was raised.
Instead:
- the item says nothing on success; the terminal opening is the answer,
and a failure goes to statusErr;
- the omp roles' comment above OMP_UNSET was cut to what OMP_UNSET's
values don't already say.
app.js is now 22 bytes under main's size.
Run:
- go test ./internal/gui ./internal/agent on mote (macOS) and in
magpie-desktop (Linux, -tags nogui), both ok.
- TestAgentOpenRunsOnlyTheAgent puts claude in a folder named
"it's a' $(touch made1) `touch made2`; touch made3 #". It posts the
ids "claude; touch made4", "claude'$(touch made5)'" and "cl"; none
of them opens anything. It then runs the line made for claude
through /bin/sh and checks that only the program ran.
- After the rebase onto origin/main
|
||
|
|
0621e70fb9 |
routing: leave a provider out of the groups magpie finds
chenxiang0010 on Discord asked to keep a provider or a model out of the auto-created routing groups. A model could already be kept out (remove its found group; magpie keeps it removed), but a provider could only be turned off per group or everywhere. Now Routing -> Groups, under "Find groups on their own", has "Leave out a provider..." (app menu, saved when it closes) and `magpie group auto skip <provider>...|none`. The providers chosen (providers.json autoGroupSkip) join no found group; a group the user made or changed keeps them, a found group left with one provider goes away, and a request for it is served by AutoStandIn from a provider still in, and agents on it are reseated (agent.Reseat). A rename carries the id along. en, zh, zh-TW, ja, de. Run at 383947fce (this change on origin/main |
||
|
|
d6beb9975a |
agent: T3 Code gets magpie on Codex too, picked in T3's model picker
karissasel_ on X: T3 Code through magpie could only run Claude Code; the
harness couldn't be chosen. T3 runs a thread on the driver of the provider
instance its model is picked under, and magpie wrote only a claudeAgent
instance. It now also writes `magpie-codex` ("magpie · Codex", driver
codex) in ~/.t3/userdata/settings.json. Its config.launchArgs (T3's
CodexSettings key, passed to `codex app-server`, and its -c pairs to
`codex exec`) are Codex's own -c overrides: model_provider=magpie, the
same model_providers.magpie table codex.go writes, and model_catalog_json
pointing at magpie-codex-models.json beside settings.json. Values are
quoted for T3's tokenizeCliArgs. ~/.codex/config.toml is not written. A
binaryPath/homePath the user gave T3's own codex instance is carried over.
The user's name, on/off and unknown keys are kept; launch args and catalog
are magpie's, and Check says when they no longer reach the gateway
(the base_url read back through T3's tokenizer; a reverse proxy to magpie
the user put there counts, reachesMagpie, as for every agent). An
older Claude-only wiring gets the instance once on Sync; one the user
removed stays removed (stash t3code.codex) until magpie is turned on for
T3 again. Turning magpie off removes both instances and the catalog. The
option's note says where to pick (4 languages); reference.md and
agent-wiring.md describe it.
Run (on mote, the tree as committed):
- real end to end, sandbox HOME (~/t3e2e/home): settings written by this
code, magpie serve on 127.0.0.1:47811 with a fake Responses upstream,
T3 Code server 0.1.5 (npm t3) and @openai/codex 0.165.0.
`t3 thread start . "Reply with the word pong." --provider magpie-codex
--model fake/fake-model --wait` answered PONG-T3-CODEX; the upstream saw
POST /v1/responses, model fake-model, stream true, with the provider's
own key (sent by magpie's gateway).
- go test -tags nogui ./internal/agent -count=1 -timeout 45m: ok
- gofmt -l; go vet (darwin, GOOS=linux, GOOS=windows) ./internal/agent
- node --test internal/gui/tests/i18n-keys.test.cjs: ok
Broken by hand, each red then restored: no escaping in t3Arg
(TestT3CodeCodexInstance red); Sync without t3CodexSync (both new tests
red); no stash check (TestT3CodeCodexInstanceAddedOnce red); t3CodexOff
never reporting (TestT3CodeCodexInstance red). The first full run
was red in TestReverseProxyIsStillMagpie, Check comparing the launch
args by string; that red is the break for the proxy rule.
Not tried: T3's desktop app window (the server CLI is what it runs); the
Windows quoting on a Windows box; a real vendor upstream (fake one only);
T3's other drivers (cursor, opencode, pi, grok, ...), which are off by
default in T3 and not wired.
|
||
|
|
72ed121fd2 |
agent: the Codex row asks for a reopen only when Codex's models change
Qyburn3 on X ("为什么我每天好多次要重启"): the Agents row of a Codex
app already connected said 已接入 · 退出并重开 Codex 应用后生效 several
times a day.
Cause: StaleCopies counts a running copy as behind when a digest of
what magpie writes for Codex changed after it started. That digest took
magpie-desktop-models.json byte for byte. Beside the ChatGPT sign-in
(since
|
||
|
|
ddb1701fe0 |
codex: a model magpie has no word on is offered low, medium and high
ccdcn on X: in the Codex app, the models of a provider they added
(XJAI's model-code, model-work, model-test) had no reasoning effort to
pick, though the chip said 中. Nothing magpie reads knows those ids, so
their entries in magpie-models.json (and /v1/codex/models) had
supported_reasoning_levels [] and default_reasoning_level null. Codex
then hides the choice but still sends an effort (medium, or
model_reasoning_effort), and the gateway's fitEffort passes an effort on
as asked when a model's levels are unknown, so the effort went out and
couldn't be changed.
provider.CodexEfforts offers low, medium and high for a model whose
levels are wholly unknown. It is used by codexListed (GET
/v1/codex/models, the backend list, spawn models) and by
agent.magpieModels("codex") (the file Codex reads, and magpie's own
Codex effort control). A model known to have no levels keeps none: one
the vendor's catalog or models.dev lists (any provider, any spelling),
one the user marked as taking no reasoning ask, a vendor entry in
Codex's shape, and a routing group.
TestCodexDesktopEfforts' "user's own" now expects medium added to the
user's enabled-reasoning-efforts: its fixture's fake/m1 is such a model.
Run (on mote):
- go test -timeout 45m -count=1 ./internal/provider ./internal/agent
./internal/codexcat: ok
- go test -timeout 45m -count=1 ./internal/gateway ./internal/gui:
gateway ok (615s); gui red only in 10 real-window AppKit tests
(dock, panel, tray, main window), each killed at its deadline. Four of
them run alone on origin/main
|
||
|
|
d99e213f5b |
codex: an account switch restarts nothing while Codex's provider takes no ChatGPT account
danzi002 on Discord: with requires_openai_auth = false on Codex's provider,
switching the Codex account in magpie still restarted the Codex app's
app-server and said the app and daemon were left on the old account.
Codex's provider with no requires_openai_auth = true goes by no ChatGPT
account: codex-rs ModelProviderInfo::account_state answers no account, and
resolve_provider_auth sends the table's key, never auth.json. So which
account auth.json holds is nothing a running Codex uses.
- provider.CodexNoAccount (set to agent.codexNoAccount): the config's top
model_provider is not openai, has a [model_providers] table, and the table
doesn't say requires_openai_auth = true. A profile, the built-in provider,
no table or an unreadable config count as false (may use the account).
- codexAppStep forgets a switch (and a spent switch) while it holds, so the
app-server is left running; a route change still restarts it.
- CodexAppStale / CodexDaemonStale say nothing, and `magpie accounts`'
switch line says nothing needs restarting.
- Kept: route-change restarts (model_provider, openai_base_url,
model_catalog_json, base_url, catalog hash: read only as the app-server
starts) and the daemon's model-list restarts; and switch restarts when
magpie writes requires_openai_auth = true (ChatGPT sign-in with room).
Run (mote-run; full suite at this change on
|
||
|
|
f63ea1d5b2 |
agent: omp asks a Gemini model on Gemini's own API at /v1beta (#4277)
omp gave a model served on Gemini's API the provider's openai-completions,
so the gateway translated Chat for it. ompProviderAt now writes such a
model as OmO does: api google-generative-ai, baseUrl <gateway>/v1beta.
Checked in omp's source (pi-ai providers/google.ts, 16.0.0, 16.3.5,
18.9.1, 18.14.0): it posts to baseUrl/models/<id>:streamGenerateContent
?alt=sse with x-goog-api-key, and throws only when the key is empty. The
issue's claim that auth: none breaks it is wrong: under auth: none omp's
model registry hands the client its no-auth key "N/A" (kNoAuth), which
loopback takes, so the provider stays keyless; a WSL omp under NAT sends
its apiKey there as before. Unlike pi-ai, omp's Google client takes a
custom fetch, so the Raft reason Pi stays on Chat doesn't apply.
Thinking: a Gemini 3+ model gets mode google-level (thinkingLevel; xhigh
and max go as HIGH, pi-catalog model-thinking.ts), a Gemini 1.x/2.x one
mode budget, since 2.5 refuses a level; omp sends that as
thinkingBudget -1 (custom models.yml has no effortBudgets).
Run:
- TestOmpGeminiModelsAskedOnGeminisAPI, TestOmpGeminiMode (new), and
TestOmp*/TestPi* on mote: ok.
- Broken by hand (Gemini case taken out): the new test is red on api,
baseUrl and thinking mode for gem/gemini-3-flash, gem/gemini-2.5-pro and
hybrid/gemini-3-flash; TestOmpGeminiMode doesn't build on the old code.
- go vet ./internal/agent for darwin, linux, windows: ok; gofmt clean.
- Real omp 18.14.0 (Bun 1.4.4) in a sandbox HOME on mote: magpie built
from this tree, `magpie provider add gem gemini=<fake>/v1beta`, `magpie
serve`, `magpie omp gem/gemini-3-flash`, then `omp -p`. omp answered
with the fake upstream's text through the gateway's /v1beta. Pointed
straight at a fake server, omp sent POST
/v1beta/models/gem/gemini-3-flash:streamGenerateContent?alt=sse with
x-goog-api-key: N/A and User-Agent: omp, and thinkingConfig.thinkingLevel
HIGH for --thinking high (MINIMAL for off).
- Full suite (go test -timeout 45m -count=1 ./...) on mote at c9b5fbb04
(origin/main
|
||
|
|
57e58595b9 |
agents: Claude Desktop says its signed-in chats and projects stay, before it is turned on
xgddm88 on X: after turning Claude Desktop on in magpie (to use DeepSeek
V4.1 Flash), Desktop started with none of the earlier projects or chats.
Cause, from Desktop 2.7032's app.asar (index.pre.js, read only): in
third-party mode Desktop calls app.setPath("userData", …"Claude-3p")
("[custom-3p] userData mkdir"), so it runs in a profile of its own. The
signed-in (1P) chats, projects and Code sessions stay in
~/Library/Application Support/Claude. They are not deleted, only not
shown, and come back when Desktop is off magpie. magpie writes nothing
in Claude/ but deploymentMode, and only reads its config.json for the
language. There is no supported way to show 1P history in 3P mode.
So magpie says it before the switch is touched, and after:
- the Agents row, not connected: "Not connected · on magpie, Claude
Desktop opens a separate profile: chats and projects from your
Anthropic sign-in stay, and are back when you turn it off"
(CONNECT_BEFORE);
- the opened row, once connected (CONNECT_COST);
- the notice after On and after Off (noticeClaudedesktop3/4).
In en, zh, zh-TW, ja and de. agent-wiring.md says where Desktop's
history is and that Opus beside DeepSeek comes from a Claude
subscription added in magpie.
Run (worktree at
|
||
|
|
cf9ea977ca |
agent: Droid gets a GPT on openai and a Claude on anthropic, as droid asks, and keeps an entry edited by hand
ji233 on Discord: droid warned at session start that "ultrafast/gpt-6.1-sol appears to be an OpenAI model, but is configured with provider generic-chat-completion-api". magpie wrote every model on a Chat provider as generic-chat-completion-api, whatever its name. droid's own rule, read from its bundle (droid 0.231.0, xs and g2): a custom model's "model" matching /\bgpt[-_.]?\d/i, /codex/i or /\bo[1-9](?:[-_.]|$)/i on any provider but openai is warned about as OpenAI's; then one matching /claude|haiku|sonnet|opus/i on neither anthropic nor bedrock-converse as Claude's. droid first looks the name up among its own models; every OpenAI one there matches the patterns except gpt-image/gpt-transcribe, so the patterns alone are used (droidWants). Such a model now goes on the provider droid asks for (openai on the gateway's /v1, anthropic on its root), and the gateway translates (Responses->Chat: TestResponsesClientChatUpstream; groups on Responses as for Codex). Other models keep their native API as before. A provider, displayName, maxContextLimit, maxOutputTokens or noImageSupport the user changed in one of magpie's entries stays through a sync and a new pick: what magpie last wrote is stashed (droid:<path>:wrote), a value other than it is the user's. Keys magpie doesn't write stay too (droid's index aside). baseUrl follows the entry's provider; apiKey is wiring, put back at every sync. With no record (entries an older magpie wrote, which each sync wrote over anyway), magpie's values are taken, so ji233's entries move to openai on the next sync. Disconnect forgets the record. Doc: agent-wiring.md. Run (mote): - go test ./internal/agent -run TestDroid: ok. Red on the old droid.go (TestDroidWantsItsOwnRule, TestDroidProviderByName, TestDroidKeepsAnEntryEditedByHand all FAIL); with droidMerge forced to magpie's values, TestDroidKeepsAnEntryEditedByHand FAILs. - gofmt -l clean; GOOS=linux and GOOS=windows go vet ./internal/agent ok. - go test -count=1 -timeout 45m ./... at 5be7d8ab7 (on |
||
|
|
129578c3d9 |
agent: pi_api_test.go is gofmt'd
|
||
|
|
a5ba5f23bd |
agent: a requires_openai_auth = false the user wrote in magpie's Codex table stays
蛋仔 on Discord wanted the Codex app wholly on magpie, with no ChatGPT
account of its own, and set requires_openai_auth = false in
[model_providers.magpie] by hand. While their ChatGPT sign-in had room,
the next Sync (authStale) set it back to true, and putProvider's
SetTOMLTable replaced the table without it. magpie only ever writes true
or nothing, so a false is the user's: openaiAuth now reports it as not
known (no rewrite, no drift), and putProvider carries it into the table
it writes.
Run (mote, at this head):
- go test ./internal/agent -count=1 (whole package, rebased on
|
||
|
|
7474a86f16 |
agent: TestPiModelsAskedOnTheirNativeAPI asks Gemini's API of OmO's folder, Pi's keeps Chat (2f5a3f1c0)
|
||
|
|
2f5a3f1c0b |
agent: Pi's models.json keeps a Gemini model on Chat, as Raft runs Pi's SDK on it with a fetch of its own (yunfei9958 on X)
Since |
||
|
|
51f37638e5 |
agent: a write to Claude Code waits to hear whether its proxy is magpie (#1985, #3512)
davisjiahao (#1985): Claude Code pointed by hand at a proxy in front of magpie, magpie's key kept (a company's nginx, or a compliance proxy on this machine every request must go through), is kept there once magpie has answered at the proxy (surelyMagpie). That answer comes from a probe a read starts in the background and never waits for, and every write to Claude Code reads routed() first: in a magpie just started, the CLI's, the first write found no answer yet and took the proxy for a relay of the user's own. surelyMagpie's comment says a write waits for the answer; none did. Codex's account failover does (codexProxyOK). From the CLI, with the proxy (relay.py, answering GET / as magpie's gateway does) taking 0.3s or 1.5s to answer, as one across a VPN can; the same on |
||
|
|
cff2852ca8 |
agent: Claude Code's own endpoint is never asked whether it is magpie (#3480)
zhangt2333 (#3480): magpie sent GET / (Go-http-client/1.1) about every 30s to the ANTHROPIC_BASE_URL in ~/.claude/settings.json of a Claude Code it never connected, with nothing shown and nothing to turn it off. Every read of Claude Code the Agents page makes (/api/state, /api/drift each 15s) goes through routed(), which asked a base URL that can be another way to magpie (proxyBase: an address on another machine, or one on loopback with a path of its own) whether it answers as magpie, for #1985's reverse proxy, whatever key Claude Code sends there. One read pass asked it about 65 times; the probe cache sends that as one GET once its answer is older than 20s (reachAge), every 30s on the page's poll. The address is now asked only while what Claude Code sends is for magpie (claudeProxied, claudeKeyed): a key the gateway takes (keyHolds, as Check already asks of ANTHROPIC_AUTH_TOKEN), or none where it keeps its claude.ai sign-in through magpie (claude.login, on a Claude Code magpie wired, wired_at, which Disconnect forgets, where the gateway takes any key). With a key of the user's own, the base URL is their endpoint, and nothing asks it: the reads (routed), a pick (gwAt), Check (its managed settings' and settings.json's URL), and a request's stand-ins (claudeStandInAt, now given the place, and claudeClassifierIn), a WSL distro's Claude Code's too. Check says such a Claude Code's address as it is, unasked (whatsOff: wiringOff's words, without its probe; an administrator's in managed settings too): with a model named as one of magpie's there, as a relay can name its own, "Claude Code's ANTHROPIC_BASE_URL (settings.json) is <its endpoint>, not magpie's gateway at <the gateway>", or "is gone" with none, which main said of it too once the address had answered as not magpie. #1985's proxy keeps magpie's key, so it is asked and kept as before. The key, not a record of what magpie wrote: wired_at is from 10-08 (#1218), so a Claude Code connected before it and not picked since has none, and a Claude Code magpie wired and then moved to a relay of the user's own (CC Switch, its own key) would still have that relay asked. The claude.ai sign-in can lean on it: it came with it (#1218), and its setting, on a routed Claude Code only, stamps it. Before and after, for a read, a pick or a request's stand-in while ANTHROPIC_BASE_URL is not the gateway's and proxyBase takes it: before: GET <base>/ in the background, at most every 20s after: the same while Claude Code sends a key the gateway takes or keeps its claude.ai sign-in through magpie; otherwise never, and the address is not magpie's Changed with it: a Claude Code pointed by hand at a proxy to magpie with a key of its own, drift on main too (its key "was changed"; now its address), is no longer taken as routed there, so a pick writes magpie's address and key, keeping its own for Disconnect, where it kept the proxy. Not changed: the other agents ask an address only from magpie's own entry in their config, or once on one of magpie's models (T3 Code's wired, Gemini CLI's isMagpie(model), Hermes's onMagpie and providers.magpie, dsh's usesMagpie), so none asks one of the user's own. A Claude Code magpie wired keeping its claude.ai sign-in, then moved by hand to an endpoint of the user's own with an ANTHROPIC_API_KEY alone and not disconnected, is still asked, as before: magpie reads no ANTHROPIC_API_KEY of Claude Code's. Cost: a never-connected Claude Code with its own key at such an address, the case this reaches: a read pass took 5.5 to 6.0ms on origin/main and 9.4 to 9.8ms with this (three runs each, taking turns, 200 passes, at load 46 to 50; the key's read and access.Authenticate at ~65 calls a pass), on the 15s drift poll. A connected Claude Code (the gateway's address) and one on Anthropic's own endpoint (no base URL) never get there. docs/subsystems/agent-wiring.md (Drift) says it. What was run (tree c7f75f7a, on origin/main |
||
|
|
b8de6e5afd |
agent: TestCodexDriftReached and TestCodexBehindReverseProxy read Codex's log again after each request they log (#3398)
codexReached keeps its read of Codex's log while the database and its -wal keep their size and modification time ( |
||
|
|
22faba9eca |
agent: the Reasonix fixtures build without a VCS stamp (#3641)
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout build a fake reasonix with go
build inside t.TempDir(). go build stamps VCS info by default: it looks
for a folder named .git above the fixture's module and runs git there,
and when that .git is no repository git will open (empty, as here, or
unreadable), git exits 128 and the build fails ("error obtaining VCS
status: exit status 128"). On this box /tmp/.git is an empty folder
owned by nobody, and git there says "not a git repository", so both
were red in every full run here that got that far.
Both builds now pass -buildvcs=false. reasonixCLI reads only the build
info's package path (info.Path, reasonix/cmd/reasonix), which the flag
doesn't touch. With no .git above, as on CI, the fixture is byte for
byte the same with and without the flag. No other test builds a package
with go: goose_test.go builds a single file, which go doesn't stamp,
and gui's `go mod download` builds nothing. The same /tmp/.git turns
gateway's TestPluginToldWhereTheAgentWorks red another way, through
provider.GitOnDisk (#3675), which this doesn't change.
What was run (tree 9ef1c9ee, on origin/main
|
||
|
|
ace8ee1e1c |
plugins: a registry icon that is a picture is kept and drawn, not the cube
registry.json's `icon` can be an https URL: Kilo Code (https://github.com/Kilo-Org.png), Search1API (https://s1.dev/icon.png), PowerContext (a raw.githubusercontent SVG) and GoAnyAPI (https://goanyapi.com/logo.png). It reached the page as it was, and app.js icon() took any name for a bundled file (icons/<url>.svg), so the Discover card, the plugin's page and Kilo's agent row showed the generic cube. A market picture now goes through the path a plugin's own picture already takes (pluginOwnIcon / RepoIcons). Only a public https host is fetched, the size is capped, and the file is kept as file:<hash> and served from /api/icons. The page never loads a remote URL. Until the picture is in, the icon is "", which the page draws as the cube. - provider.MarketIcon / MarketPicture. PluginIcon (installed plugins) uses them. - agent pluggedIcon (an agent plugin's row, which is Kilo's case) uses them too. - gui listingIcons: /api/plugins/listings and /api/plugins/market keep the market's picture icons and the npm icons in one RepoIcons call (the market waits up to 3s, the listings don't wait). The market's own slice is not changed. - app.js icon(): a name with ':' or '/' that isn't file:/data: is drawn as the cube, never asked for as icons/<url>.svg. A kept picture that fails to load already falls back to the cube through the img's onerror. app.js stays under its budget: two comments were shortened, with no raise. Tests: - TestMarketIconURLKept (provider): an https icon becomes file: and is fetched once, a bundled name is unchanged, and http:// is refused. - TestRegistryIconPictureKept (gui): listings give file: for a data: icon, keep a bundled name, and give "" for javascript:. The market's listing is not mutated. - plugin-registry-icon.test.cjs: Chromium and WebKit, en/zh/zh-TW/ja/de at 980 and 420. A kept picture is drawn on the card and on its page. A URL shows the cube. A 404 picture shows the cube, not a blank. A bundled icon stays bundled. Nothing is asked of another host. What was run: - Before the rebase (mote): - focused Go tests: ok. - plugin-registry-icon: 22/22. - real use, sandbox HOME, the four real registry URLs: each fetched and kept as file: (Kilo png 1455 B, s1 png 4426 B, PowerContext svg 40309 B, goanyapi png 21878 B). - At the rebased fix (on |
||
|
|
70a0c387cb |
agent: a provider named magpie written by hand is the user's, not connected (JFunfunfun on X)
Pi set up by hand on a provider of its own named magpie (magpie/<model> at the gateway) read as connected in magpie: every catalog change wrote magpie's list over that provider, RenameProvider rewrote its refs, Drift offered Reconnect, and Disconnect took the provider out. |
||
|
|
0911a65e7d |
agent: a catalog sync leaves a magpie provider the user wrote alone while the agent isn't connected
yyddbds on Discord: in Xiaomi MiMo they added a custom provider pointing
at magpie and picked a few models by hand. MiMo's switch on the Agents
page was off, yet after an update the provider held every one of
magpie's models. SyncCatalog runs at each start and update and on every
catalog change, and MiMo Code's Sync (openCodeLike) brought any
provider.magpie block up to the catalog whether magpie wrote it or not.
magpie's default went over a list the user set.
An Agent whose Sync does nothing but keep a block of magpie's name up
to the catalog is now ListOnly, and SyncCatalog runs it only while the
agent is Wired, which is what the Agents page's switch shows. The same
sync was in every sibling, so ListOnly is on all of them: openCodeLike
(OpenCode, MiMo Code and their WSL forms), piLikeKeyed (Pi and forks),
Goose, Crush, Air, AtomCode, Command Code, Droid, Fx, jcode, Kimi,
MiniMax, Mothx, omp, OpenChamber, OpenClaw, OpenPencil, Penguin, Qwen
Code and T3 Code. Left out on purpose: Codex, Claude, Grok and Hermes,
whose Syncs also repair while not connected (Hermes keeps its bots'
magpie provider current) and have their own gates.
Trade-off: a list magpie wrote while connected doesn't follow the
catalog while the agent runs a model of its own (switch off); it does
again once a model of magpie's is picked. Users whose list was already
written over: magpie keeps no copy of the old list, so it stays full;
from this release on it is left alone, and they trim it once by hand
(or connect the agent in magpie and use its model list's Pick).
Tests: TestCatalogSyncLeavesAHandWrittenMagpieBlock (MiMo, Pi and Crush
with a hand-written magpie block stay byte for byte; connected, MiMo's
list follows the catalog; disconnected and written by hand again, left
alone; a magpie model picked in MiMo, followed again).
TestListOnlyAgentsReadConnected: every ListOnly agent magpie connects
reads as Wired (n >= 15), so none of them loses catalog updates.
Fixtures of TestSyncCatalogRewritesAgentLists,
TestModelNameAndLevelsReachAgentFiles, TestSuffixModesReachAgentFiles
and TestPiKeepsTheirKeysInMagpiesProvider, and internal/cli's
TestSaveAnswersBeforeTheAgentsSync (its Pi settings were {}), now have
Pi connected (settings.json defaultProvider magpie), as a block magpie
wrote implies.
docs/subsystems/agent-wiring.md says the rule.
Run (mote, sandbox HOME via the tests' syncHome/codexHome):
- old code + the new test: red (MiMo, Pi, Crush written over; after
Disconnect written over).
- broken by hand: ListOnly dropped from openCodeLike: red on MiMo
(lines 52, 82); the Wired gate in SyncCatalog replaced with true: red
on all three.
- go test -tags nogui -count=1 ./internal/agent: ok.
- gofmt -l clean; go vet ./... for darwin, GOOS=linux and GOOS=windows:
ok.
- full suite, go test -tags nogui -count=1 -timeout 45m ./... at base
|
||
|
|
cc81ad4ea1 |
codex: a Windows Codex app that starts no app-server after a switch is reopened (蛋仔 on Discord)
After magpie switched Codex's account, the Windows Codex app answered every send with "Codex app-server process is not available" until it was quit and opened again. The report said the app doesn't reconnect after a clean exit. That is half right. The app (MSIX OpenAI.Codex 26.1021, an Electron ChatGPT.exe that spawns codex.exe app-server over stdio) does start another, but only once the old one's stdout reaches EOF and its exit has fired. On Windows a child of the app-server (an MCP server, a tool command) inherits that pipe handle. A child left running keeps the pipe open, so the app never sees the close, starts none, and its send() throws. Reproduced on the Windows box with the real codex.exe 0.164 app-server plus an MCP server: stdout ended only when the MCP server did, and at once when the tree was ended. magpie took "the old pid is gone" as done in each place it restarts the app-server. None of them checked that a new one came: - codexAppStep (the switch watcher) now records the pids it ended and waits codexAppBackWait (30s) for another app-server. If none comes and the app still runs (CodexAppOpen), it quits and opens the app as the Agents row's Restart does (CodexAppReopen: restartWin by the OpenAI.Codex_2p2nqsd0c76g0!App AUMID, Windows only). Where it can't, the row says to (CodexAppStuck). - RestartCodexApp (macOS Restart), RestartCodexAppWhenIdle (uninstall) and the switch notice's Restart (RestartSwitchedCodexApp, |
||
|
|
7946256933 |
agents: omp, OpenCode and Crush get each model's price, and a group of mixed prices is priced at its first member (taotao7 on Discord)
taotao7 (#help, msg 1565576524193857678): omp on magpie's group/* models
counted every call at 0. omp's custom provider prices a call by the cost
in models.yml alone (omp 18.9.1: pi-catalog src/models.ts
calculateUsageCost, USD per 1M tokens; models-config-schema-bundle.ts
cost {input, output, cacheRead, cacheWrite}). magpie wrote no cost into
omp's models.yml for any model; an ordinary id still got one from omp's
bundled reference match, a group/* id matched none. And a group whose
members cost differently had no price in magpie's agent list at all
(EntryPricer prices only one-price groups), so Pi had none either.
- provider.AgentPricer: as EntryPricer, but a mixed-price group is priced
at the member it sends to first (a manual group's pick, else the first
not switched off); a fast or unpriced first member leaves it unpriced.
Chosen over "the member it routes to most" because that needs usage
history and would rewrite agents' files as traffic shifts; the first is
what an In order / Manual group sends to while it answers. Read at each
Sync, so it follows the members. The gateway's /v1/models keeps
EntryPricer.
- omp: models.yml model entries carry cost.
- Siblings: Pi, mothx, alma, penguin, plugged already wrote m.Price and
now get group prices too. OpenCode got no cost at all: now cost
{input, output, cache_read, cache_write} (OpenCode 2.0.25). Crush:
cost_per_1m_in/out/in_cached(write)/out_cached(read) (Crush 0.39.3).
- docs/subsystems/agent-wiring.md says so.
Run (mote): TestGroupModelsCarryTheirFirstMembersPrice ok; full
go test -timeout 45m ./... at load ~150-210 from other work: agent and
provider ok, 77 ok; reds TestTOMLBigFileParsesInLinearTime (#4109) and
the Antigravity turned-away tests + TestCodexSpentGrokFailingIsTold
(#4362), both filed against main. GOOS=linux/windows go vet of agent and
provider ok. Real omp 18.9.1 in a sandbox HOME: `omp models list --json`
reads group/mix with cost {1,2,0.1,1.25}, pricingStatus fixed.
Broken by hand: route.go back on EntryPricer -> red (group/mix cost
nil); omp's Cost line dropped -> red (a/cheap cost nil).
Not tried: a real omp turn through the gateway showing the cost; OpenCode
and Crush showing a session's cost in their UIs (keys read from their
binaries' strings only).
|
||
|
|
46aa7e6b89 |
providers: the Codex app's switch notice has a Restart (nb5p_hQ on X)
After an account switch, Codex's accounts say the Codex app is still on
the account before. A user asked for a button that does the restart for
them. The notice now has Restart: magpie's own dialog asks first, then
magpie ends the app's own app-server (POST /api/codex/daemon/restart-app,
provider.RestartSwitchedCodexApp), waits for it to be gone and for the
app to start another, which reads auth.json and the new account. The
window stays, as the owner chose on 10-27 (quit and reopen opened a new
window). It ends the app-server now even mid-turn, after the confirm says
a running turn stops.
The app-server is ended as a clean exit (proc.End), never killed: the app
shows a killed app-server as a crash, so there is no force fallback. Each
failure says so in the notice, in the reader's language: the app isn't
running, the app-server couldn't be ended, the app didn't start another
within 20s, or the listing failed ("couldn't tell", not success).
Only the Codex desktop app gets the button (macOS ChatGPT.app/Codex.app,
the Windows Codex app). CLI agents in a terminal get none: restarting
them would lose the user's session. The text stays as it was.
app.js is 457 bytes smaller than main (comments cut), no budget raise.
The button and the confirm and four notices are in zh, zh-TW, ja and de.
Run:
- mote (darwin): gofmt -l clean; go vet agent, provider, gui on darwin
and GOOS=windows; GOOS=linux go vet agent and provider (gui needs
WebKitGTK headers, which neither mote nor magpie-desktop has).
- mote: go test provider -run 'TestRestartSwitchedCodexApp|TestCodexApp|
TestRestartCodexApp' ok; agent TestRestartSwitchedCodexAppSays,
TestEveryNotice ok; gui TestCoreScriptBudget etc. ok.
- win-run: the same provider tests ok, with real helper processes ended
by proc.End (TerminateProcess) and a new one started.
- mote GUI: codex-app-stale + i18n-keys, chromium and webkit, en zh
zh-TW ja de, 900 and 480px: 54/54.
- Broken by hand: TestRestartSwitchedCodexApp and ...Real go red when
the wait for a new app-server always holds ("none back: <nil>").
- Real app: on mote, the real ChatGPT.app 26.1021 opened under the
test's sandbox HOME (not signed in), its app-server 5232 ended, the
app started 5901 within 3s, no diagnostic report; the app was quit.
(A throwaway test, not committed.)
Not tried: a signed-in Codex app switching between two real accounts
(whether its window shows the new account's limits after this); the real
Windows Codex app; the Restart clicked in the real magpie GUI.
|
||
|
|
83e41a22c9 |
agent: Claude Desktop's key, sealed at rest by Desktop 4.4212, isn't said to be changed (Discord)
A Windows user on Discord: the Agents list keeps saying Claude Desktop's
inferenceGatewayApiKey (00000000-0000-4000-8000-6d6167706965.json) was
changed. Reconnect and a Desktop restart help only until the next start.
Cause: Claude Desktop 4.4212.0 (2026-10-29, Windows and macOS) seals
configLibrary secrets at rest. Its custom-3p:keys sweep runs at every start
and rewrites each clear-text secret field, inferenceGatewayApiKey among
them, in place as
"__sealed__:v1:" + base64(protect("anthropic.claude.crossProfileSecret.v1:"
+ {"configLibrary":{"key":k,"value":v}}))
Desktop opens the value again when it reads the profile, so it still sends
magpie's key and the gateway takes it. Only magpie's file check saw another
string. In 4.29.0 the writer was gated on !app.isPackaged; in 4.4212 the
gate is gone. Read from the 4.4212 nupkg and macOS zip's app.asar.
protect is the claude-native addon's userDpapiProtect on Windows (user
DPAPI, entropy "anthropic.claude.crossProfileSecret.v1") and Electron
safeStorage (Keychain) on macOS.
Fix: desktopOpen opens a sealed value before Check and Sync judge it. On
Windows it is opened with CryptUnprotectData and that entropy, the prefix
and the configLibrary key are checked, and the clear key is then compared
as before, so a sealed key that isn't magpie's is still "was changed". A
seal magpie can't open (macOS Keychain, another user, a bad blob) is
unknown, not changed: no notice, and Sync doesn't write over it. The
gateway's auth is unchanged; it still takes only the key magpie wrote,
which is what Desktop sends after opening the seal.
Run (mote, at this head on
|
||
|
|
deb0b8da72 |
codexcat: Codex shows a model's whole window and compacts at Long conversations' threshold (#3975, #3562; 01huadalang on Discord)
01huadalang on Discord: a Command Code model with a 1M window showed
258,400 in Codex. EasonSpirit (#3975) and greenfinchgreen-gif (#3562)
saw the same on OpenCode Go's 1M models.
The cause: magpie put Long conversations' threshold (272K by default, a
Compact at set on the model or provider, or a size typed in Settings)
into the Codex catalog entry's context_window, and the real window into
max_context_window. Codex shows context_window at 95% as the
conversation's context, so 272000 showed as 258400. The plugin was not
at fault: commandcode lists these models at 1M, from Command Code's
own list or its fallback table.
Now each catalog entry carries two values:
- context_window is the model's whole window.
- auto_compact_token_limit is the threshold, written only when it is
below the window. Full window writes none.
This applies to entries magpie writes itself (entriesAt) and to a
relay's own Codex-shape entry (listedEntry). Codex 0.165 compacts at
the lesser of the threshold and 90% of the window. A
model_auto_compact_token_limit the user put in config.toml still comes
first.
Two other changes:
- max_context_window is never written now. It stays a field of
codexcat's model, so Keep doesn't carry an old catalog's value
forward as if the user had added it.
- Tag carries a format mark (catalogFormat), so a Codex holding a list
in the old shape fetches it again.
Codex's own models (codex/) and Codex's base_instructions are
unchanged.
One behaviour moves. Codex used to compact at 90% of 272000 (244,800).
It now compacts at 272,000, the number the setting shows ("Compact at
272K").
Tests:
- TestCodexWindowShownCompactApart (new). Checks Command Code's
claude-opus-5-5 at 1M, a relay entry, and a relay entry with its own
Compact at, under the default, Compact at 400K, and Full window.
- TestCodexCatalogCompactAt, TestCodexCatalogToolSearch,
TestCodexCatalogCompactAtReachesDisk and
TestTypedWindowReachesCodexAndClaudeCode now expect the window in
context_window and the threshold in auto_compact_token_limit.
Broken by hand: I put the old codexcat.go back. TestCodexCatalogToolSearch,
TestCodexCatalogCompactAt and TestCodexWindowShownCompactApart went red
("commandcode/claude-opus-5-5 told window/compact [272000 <nil>]; want
[1e+06 272000]"). With this change restored, all three are green.
Real Codex 0.165.0 in a sandbox CODEX_HOME, against a local fake
Responses server, using the catalog codexcat.Catalog now writes for
commandcode/claude-opus-5-5 at 1M:
- The rollout records model_context_window 950000. The old-shape entry
(272000 with a max of 1000000) records 258400, the reporter's number.
- A turn reporting 260K tokens is not compacted. One reporting 280K is
(CONTEXT CHECKPOINT COMPACTION). The old shape compacted at 260K.
- model_auto_compact_token_limit = 500000 in config.toml keeps the
280K turn uncompacted.
Run (mote-run, at this change on origin/main 9b833205f; rebased onto
|
||
|
|
9b833205f7 |
groups: a found group's id and name come from models.dev's one spelling (XYenon)
XYenon on Discord (#feedback, 10-30): autoGroups() and spelledIn() picked a found group's name and its public id apart, so a group read glm-5-3-flash beside auto/glm-5.3-flash. The id also followed the order the providers were added in. Now: - spelledIn takes the spelling models.dev gives the model most (catalog.Spelling, the normal index normalFor already reads): every member spelling of GLM-5.3 Flash (glm-5-3-flash, Ark's glm-5-3-flash-260828, glm-5.3-flash) gives auto/glm-5.3-flash. A model models.dev doesn't know keeps the old pick (first listed member spelling, else the first member's). - autoGroups names the group from the same choice: catalog.NameOf of that spelling, else a vendor's own name, else the spelling itself. A found group the user changed keeps the name they saved. - Old ids keep working. group/auto-<slug> doesn't change, and any auto/<spelling> is still the group (CanonicalRef: gateway, key allow-lists, fallbacks, members). PublicRef now takes an old auto/<spelling> to the current one too, so hidden, picked and ordered models saved by it hold, and a pick of it written now (Agent.Apply) is written as listed. An agent field magpie set to an old spelling moves on the next SyncCatalog (renameFoundGroups), as group/auto- values already did, because OpenCode checks its model against the list magpie writes. A value the user set stays as it is and is still served. Tests (on mote, via mote-run): - TestFoundGroupIDAndNameAreOneSpelling (5 member orders/spellings, the user's name kept), TestFoundGroupUnknownToModelsDevNamedByItsID, TestFoundGroupMovedOffAnOldSpelling. The catalog fixtures use models.dev's real spellings and names (glm-5.3-flash "GLM-5.3-Flash", volcengine's glm-5-3-flash "GLM 5.3 Flash"). - Broken by hand, one file reverted at a time: group.go reverted, the test is red (named "GLM 5.3 Flash" beside auto/glm-5.3-flash); provider/autoref.go reverted, red (id auto/glm-5-3-flash with Ark first, PublicRef of the old spelling unchanged); agent/autoref.go reverted, TestFoundGroupMovedOffAnOldSpelling red (field stays magpie/auto/glm-5-3-flash). - go test -timeout 45m: internal/catalog, provider, agent, tui, cli, usageapi ok. internal/gui: everything ok except TestMainWindowCorners/ macOS_26_SDK, which is #3949 (AppKit on macOS 27, nothing to do with this change). internal/gateway, codexcat, sessions ok. - gofmt -l clean; go vet darwin, linux -tags nogui, windows clean. - No GUI file changed, so the GUI suite wasn't run. Names reach it through /api/groups. Not tried: a real models.dev sync with real providers in a sandbox app. Groups whose first provider spelled a model differently from models.dev (e.g. claude-opus-4.8 from a relay vs Anthropic's claude-opus-4-8) get the models.dev spelling once. Magpie-set agent fields move with it, and values the user set keep resolving. A key or fallback chip saved under the old spelling still shows it in the editor (it still works). |
||
|
|
fb2e11e288 |
agent: a Codex sign-in OpenAI refused to refresh for good counts as none (#4308)
jjt on Discord: Codex's ChatGPT sign-in was revoked, and magpie's
models were gone from Codex until they signed in again.
Cause: Codex keeps a revoked sign-in's auth.json as it was and remembers
the permanent refresh failure in memory alone (codex-rs
login/src/auth/manager.rs). magpie read auth.json alone
(codexChatGPTKnown), counted the sign-in and wired Codex beside it
(openai_base_url, requires_openai_auth). There, Codex's /models went to
the gateway, which passed OpenAI's 401 token_revoked through, so the
picker had no magpie model; and every turn, magpie's models too, failed
at Codex 0.162.1's workspace routing discovery
(/backend-api/wham/accounts/check, 401).
Change:
- provider: codexRefresh tells a refusal Codex takes as permanent
(request_chatgpt_token_refresh: refresh_token_expired, _reused or
_invalidated, a 400 invalid_grant, or a 401 - here only a 401 that
carries an error code, read as oauth/error.rs reads it). When magpie's
own refresh of Codex's sign-in (codexTokenRenewing, from the usage read
that KeepOnAnAccountWithRoom runs) is refused that way, and the store
still holds that refresh token, codex-signin-gone.json keeps the Codex
home -> sha256 of the refused refresh token (no token stored). A
successful refresh forgets it. Writes Touch the catalog so the agents
resync; the loop's noteCodexGoneNow notices a sign-in made again
elsewhere within minutes.
- agent: codexChatGPTKnown reads such a sign-in as none
(provider.CodexSignInGone), as v0.1.2087 did for forced_login_method =
"api": magpie is Codex's provider without requires_openai_auth, the
user's auth.json stays. A record that can't be read is unknown (as
magpie last wired it). Signing in again gives another refresh token,
which the record doesn't name: Sync writes requires_openai_auth back.
- gateway: codexModels doesn't pass a revoked /models answer
(provider.SignInRevoked) through: it lists Codex's cached models and
magpie's. The desk file does the same while the live list says revoked
(CodexListRevoked). Any other refusal (token_expired, 5xx) is as before.
- docs: agent-wiring and gateway-routing.
Run:
- real codex 0.162.1 (app-server over stdio, and exec) on mote, sandbox
HOME/CODEX_HOME, fake OpenAI (chatgpt_base_url,
CODEX_REFRESH_TOKEN_URL_OVERRIDE, provider.CodexBase) answering 401
token_revoked and refresh_token_invalidated; no real network.
- Old wiring beside the dead sign-in, old gateway: model/list had no
magpie model (jjt's case). With the gateway change: fake/m1 listed,
but exec -m fake/m1 fails at workspace routing discovery (401), and
account/read errors too - why the wiring change is needed.
- Uncommitted e2e in the agent package with magpie's own written
config: Set("fake/m1") wrote it beside the sign-in; magpie's
LoginUsage("codex") then heard the refresh refused, Sync rewrote it
to model_provider = "magpie", model_catalog_json, no
requires_openai_auth. account/read: {"account":null,
"requiresOpenaiAuth":false}; model/list: fake/m1 plus Codex's
models; exec -m fake/m1 answered "hi from magpie"; auth.json byte
for byte the same.
- Red on the old code (broken by hand): without the codexChatGPTKnown
check TestCodexGoneSignInIsNoChatGPT is red; without the
noteCodexSignInGone call TestCodexSignInGoneWhenRefusedForGood is red;
with codexRefreshGone true for every failure TestCodexRefreshGoneRule
is red; TestCodexModelListRevokedSignIn and
TestCodexDesktopCatalogRevokedSignIn are red on the old gateway.
Taking out the store re-check in noteCodexSignInGone leaves the tests
green: a token Codex rotated meanwhile is already held by the hash
comparison, and the re-check only saves a needless record, log line
and resync. Not guarded on its own.
- via mote-run, at this commit rebased on origin/main
|
||
|
|
f5806ed21e |
agent: Codex's forced_login_method = "api" counts as no ChatGPT sign-in (Tiger)
Tiger on Discord: after restarting Codex the Codex app showed a sign-in screen whose only option was "Sign in with an API key", and they couldn't get back in. Cause: a top-level forced_login_method = "api" in ~/.codex/config.toml. Other tools and guides write it; magpie never has (git log -S). With it, Codex won't use a ChatGPT sign-in: the TUI logs it out as it starts (codex-rs login/src/auth/manager.rs enforce_login_restrictions) and the app server reads no account (load_auth). The app takes its allowed methods from configRequirements/read, which then says ["api"]. magpie read auth.json alone (codexChatGPTKnown), counted the sign-in, and wired Codex beside it: the built-in provider, which requires OpenAI auth. The app asked for a sign-in that only an API key could give. Fix: codexChatGPTKnown reads forced_login_method = "api" as no ChatGPT sign-in. magpie is then Codex's provider without requires_openai_auth, and Codex needs no sign-in for magpie's models. The user's line stays (magpie's default never overrides the user's value). Taking it out brings the ChatGPT account back: Sync writes requires_openai_auth = true again. connectinfo's codexChatGPT gets the same answer. Run: - real codex app-server 0.162.1 on mote in sandbox CODEX_HOMEs (stdio JSON-RPC: account/read, getAuthStatus, config/read, configRequirements/read). Beside a ChatGPT sign-in with forced api: account null, requiresOpenaiAuth true, allowedLoginMethods ["api"] — Tiger's screen. magpie as the provider, no requires_openai_auth, same auth.json: requiresOpenaiAuth false, and auth.json kept. - TestCodexForcedAPILoginIsNoChatGPT is red on the old codex.go (it wrote openai_base_url and requires_openai_auth = true beside the sign-in) and green with the fix. - via mote-run: gofmt -l; go vet ./internal/agent for darwin, linux (-tags nogui) and windows; go test -timeout 45m ./internal/agent ok (150.6s); ./internal/provider ok earlier on the same codex.go change. Not tried: the real Codex app (ChatGPT.app) against a running magpie built with this; managed requirements.toml / MDM allowed_login_methods and forced_chatgpt_workspace_id, which this doesn't read; a revoked ChatGPT sign-in (jjt's report): magpie still counts its tokens as a sign-in and wires Codex beside it, and the /models 401 there comes from OpenAI, passed through. |
||
|
|
92f02d677b |
agent: a VS Code fork's own code launcher no longer lists it as VS Code too (ggbr on Discord)
Qoder IDE was listed twice, as Qoder and as VS Code. Qoder IDE ships a launcher named code in Contents/Resources/app/bin beside qoder (checked in the 2026-10-29 Qoder-IDE-darwin-arm64.dmg: product.json applicationName "qoder", nameShort "Qoder", com.qoder.ide), and its Windows installers put that bin folder on PATH. VS Code's detection falls back to a code on PATH, and vscodeCodeBinary ruled out only a product.json naming Cursor (#931), so any other fork's code counted as VS Code. The class fix: a code, code-insiders or codium launcher counts as VS Code, Insiders or VSCodium only when the product.json beside it (app/product.json, or resources/app/product.json on Windows and Linux) names that build in applicationName. With no applicationName, nameShort must be one of VS Code's own (Code, Code - Insiders, Code - OSS, Visual Studio Code, VSCodium). A wrapper with no readable product.json keeps the PATH fallback as before. This covers Cursor, Qoder IDE, Windsurf, Trae, Kiro, CodeBuddy, Antigravity and any other fork, on the mac, Linux and Windows layouts. A VS Code User folder still detects VS Code by itself: a user who has both has both rows. Run: - TestVSCodeDetected gains rows for Qoder (mac with the real build's product.json, linux, windows, symlink), Windsurf, Trae, Kiro, CodeBuddy, Antigravity, an Insiders product behind code, and nameShort-only products; TestVSCodeBuildLauncher checks each build's own command. Broken by hand: with the old vscode.go, 11 of the new TestVSCodeDetected rows fail (mac/linux/windows qoder, qoder symlink, windsurf, trae, kiro, codebuddy, antigravity, insiders product, qoder name). - Real Qoder IDE: on mote, the dmg's bin folder alone on PATH, vscodeCodeBinary(".../Qoder IDE.app/.../bin/code") = false and VS Code not Detected. - gofmt -l clean; go vet ./internal/agent for darwin, linux (-tags nogui) and windows on mote. - go test ./internal/agent -timeout 45m on mote: ok (171.6s) at this change on base |
||
|
|
172e65c80b |
agent: a Windows app closed to the tray is ended at once on Restart, not after 10s
CyberCaius on Discord (10-29): magpie's Restart of Claude Desktop on
Windows is slower than quitting and opening it by hand. The cause:
RestartApp asks the app's windows to close (taskkill without /F), then
waited up to appCloseWait (10s) for every claude.exe to end. Claude
Desktop on Windows hides its window to the tray in ~0.6s and keeps all
its processes, so every Restart sat out the whole 10s before ending the
tree.
waitClosed now also watches the windows (winShown, EnumWindows +
IsWindowVisible over the app's pids): once every window is hidden and
the app still runs appTrayGrace (1s) after the close, it is in the tray
and its tree is ended at once. An app still showing a window (a
question) keeps the full appCloseWait, and one that ends by itself in
the grace is never ended. When the windows can't be listed, it is
treated as shown (the old wait). The Windows part of RestartApp moved
into restartWin, unchanged otherwise.
Measured on the Windows box (xiaomi-gpu, Squirrel Claude Desktop
4.29.0, run in the interactive session through a scheduled task), the
real restartWin path through a test binary, 3 runs each:
before (tray grace off): returned 10.87-11.10s, window back 11.4-11.7s
after: returned 1.88-2.16s, window back 2.4-2.8s
A forced kill and relaunch by hand: ~1.6s. A PowerShell emulation of the
old path on 2.9939.2 earlier: WM_CLOSE hid the window at 0.6s, 9
processes stayed, all gone only after the 10s kill (12.3s total).
Run:
- TestRestartEndsAppInTrayAtOnce (new): tray / asking / quits-itself.
With the winShown check removed by hand, the tray case went red
(took 3.01s, want under 2s).
- mote: go test ./internal/agent -count=1 -timeout 45m: ok (174s).
- win-run: TestRestartEndsAppInTrayAtOnce, TestWorkBuddyRestartOnWindows,
TestRestartAppsOnWindows pass. The -run Restart|ChangedAt|WorkBuddyOwnSave
set has TestWorkBuddyOwnSaveAfterStartIsNoChange red on Windows, red
the same on untouched origin/main
|
||
|
|
13b4a29ab9 |
gateway: Claude Code's tier calls in a Desktop chat on a non-Claude model go to that model (CyberCaius)
CyberCaius on Discord: Claude Desktop's Code tab was on Leee's DeepSeek V4.1 Flash, no tier picked in magpie, and Claude Code's own sonnet call (claude-sonnet-5-5: its auto mode's classifier or a subagent on the sonnet tier, which Desktop leaves at Claude Code's default while no model is tagged for it) went to Leee's claude-sonnet-5-5, which Leee's key may not use: 403, and the error reached Desktop. servedBeside kept such a call on the chat's provider and gave it that provider's Claude model of the tier (its model of the very name first). That fits a chat on that provider's Claude model (#2187: the classifier's sonnet beside an opus chat), but a chat on another vendor's model says nothing of the provider's Claude models, so the user never picked one. Now a call Claude Code makes on its own gets the provider's Claude model only when the chat's model is a Claude model there; otherwise it goes to the chat's model. Desktop's own client is unchanged (its tool-less non-title request is the user's chat turn). A tier the user picked now also takes Claude Code's own id of it where a provider lists a model by that name (before, desktopTierTurn took only an id no provider serves). Claude Desktop's tiers are its own (claude-desktop.tiers.json), apart from Claude Code's agent card; Claude Code CLI is untouched. The Agents page's "Not set" note for Desktop's tiers says the new rule, in en, zh, zh-TW, ja and de. Run (mote, via mote-run): go vet ./internal/gateway ./internal/agent for darwin, linux (-tags nogui) and windows: ok. go test -timeout 45m ./internal/gateway ./internal/agent: ok (519s, 176s). node --test desktop-tiers.test.cjs i18n-keys.test.cjs (chromium and webkit, en and zh): 17/17 pass. gofmt -l clean. Broken by hand: TestClaudeDesktopNonClaudeChatKeepsTierCalls against the old desktop.go is red on all 6 cases (sonnet, haiku and opus[1m] sent to leee/claude-*). Not tried: a real Claude Desktop; the reporter's Leee key. |
||
|
|
c1da9ccda3 |
library: a stopped WSL distro's agents are listed, and a tick for one is written there once it runs (cybercaius on Discord)
cybercaius: with WSL not started, the Library's MCP page didn't list the agents in the distro at all, and nothing ticked for them could be kept. A stopped distro's agents are no targets (#3896: opening their files starts the distro), so they fell off the page. While a distro runs, each agent's places and what its MCP file takes are kept in wsl.json (keepShape, agent.WSLKeep, key library:<kind>). While it is stopped, Read lists its agents from that (asleepView, asleep: <distro>) with the library's ticks; one magpie never saw is listed only on rows that name it, as unseen, its chip disabled and kept by every click (keptOf). A tick on a stopped agent is kept in library.json (Takes accepts a known shape, serversAgents judges it by shape.reaches); nothing is opened or run in the distro. Woken, from KeepLinked's 30s loop, syncs once a distro the library names goes from stopped to running (wsl.exe -l --running starts nothing). The page greys a stopped agent's chip and says why in its tooltip and one line per distro; the MCP hub leaves them out. The CLI says the same on stderr (AsleepIn). en, zh, zh-TW, ja, de. Run at this tree (20695ad8b before this message; on |
||
|
|
7eb7fa5407 |
agent: Pi, OmO and Prime Agent ask a Gemini model on google-generative-ai at the gateway's /v1beta (#3282)
A model served on Google's Gemini API (a custom provider's gemini=, a
Google sign-in's Code Assist, a plugin model declaring @ai-sdk/google)
was written into Pi's models.json with no api, so it inherited the
provider's openai-completions and the gateway translated Chat to Gemini.
magpieModels now gives such a model the Gemini API when no Chat,
Responses or Messages API was chosen for it, and piModelJSON writes it as
api "google-generative-ai" with baseUrl <gateway>/v1beta. A model whose
user picked Chat for it, routing groups and Pencil stay as they were.
Sync rewrites magpie's own model list, so files written before get it.
The patch is skygunner's (279e9bd1 on fix/pi-google-api in their fork).
Changed here:
- StepCode keeps such a model on Chat. Step-Code at 90a57820 registers
only anthropic-messages, openai-completions and openai-responses
(packages/providers/src/compat.ts BUILTIN_APIS); its docs list
google-generative-ai but nothing streams it, so the patch would have
broken every Gemini model there.
- On google-generative-ai, pi-ai's resolveGoogleThinkingLevel maps a level
through thinkingLevelMap and throws on anything but minimal, low,
medium or high, so a level the model names otherwise (xhigh, max) is
set to null there and Pi doesn't offer it.
Checked against each client's source: pi-ai 1.4.0 and OmO's senpi-ai
2026.10.27-1 set apiVersion "" when baseUrl is given ("baseUrl already
includes version path"); Prime Agent's pa-ai providers/google.rs takes a
model baseUrl in place of host and version, and pa-core models/custom.rs
reads a per-model api and baseUrl.
Run (mote, at this tree rebased on
|
||
|
|
adc618bbf9 |
codex: a Codex switched off in magpie still has its held ChatGPT account read, so the Codex app sends magpie's models (sherlock_23333 on X)
sherlock_23333 on X: once the ChatGPT account Codex is signed in to ran out, the Codex app's Send stayed greyed even on a magpie model, through restarts and reconnects. The gate is the Codex app's own (ChatGPT.app 26.1021, composer gM): Send is blocked while its authMethod is chatgpt and its own /wham/usage says rate_limit.allowed false with no credits. magpie's one lever is the takeover (codex.out): magpie becomes Codex's provider without requires_openai_auth, so the app-server reports no ChatGPT account and the gate lifts. That runs only when provider.CodexUsedUp says the account is held, and CodexUsedUp read LoginUsage, which returns nothing for a provider switched off or removed in magpie (leftAlone). So a user who turned Codex off in magpie once its allowance ran out never got the takeover, and one already taken over was put back on the held account. Now, with Codex left alone, CodexUsedUp reads the active account alone (codexHoldReading) while Codex takes magpie's models beside its sign-in or magpie is its provider for the held account (Agent.HoldMatters, via the new provider.CodexHoldMatters hook). At most once a minute (the loginReading cache), with the token as Codex keeps it, never renewed or written (codexTokenAsKept); the Usage page still shows nothing of it. Codex's prompts and base_instructions are untouched. Run at |
||
|
|
0c4e3455ee |
agents: a line magpie writes into a TOML, YAML or env config has a note above it saying so
Jevik_AI on X deleted magpie's folders by hand. Codex's config.toml kept openai_base_url = "http://127.0.0.1:3425/backend-api/codex", with nothing in the file naming magpie, and every Codex turn failed with a 502. Each line magpie writes that points at the gateway, or at magpie's model list, now gets a comment line of its own just above it: # magpie: Codex on magpie's local gateway; Disconnect in magpie or # `magpie uninstall` undoes it, or delete this line and the model line model_provider = "magpie" - Only a line the write adds or changes, or one that had a note, gets one. A line of the user's own that magpie leaves alone gets none. - The note is never on the value's line. Grok App's providers.rs reads the rest of a line as the value, and an end-of-line comment broke TestGrokApp in a first try. - Every write takes the notes out and puts back the ones still needed, so a note goes with its line and Disconnect leaves none. - No note in JSON. A YAML note that would change what the file reads as isn't added. - Wired in run (agent.MarkWritten); tests leave edit.Mark nil so their exact bytes stay. Run at this commit's tree (worktree, sandbox HOME, private GOCACHE): - gofmt -l clean; go vet darwin, GOOS=windows, GOOS=linux -tags nogui ok. - go test -tags nogui -run Mark ./internal/edit ./internal/agent: ok. - ./internal/agent and ./internal/edit whole with edit.Mark forced on for every test (a snapshot with lineNote set in agent's TestMain): edit ok; agent fails only TestDshRouteKeepsTheAPIPickedInDsh and TestDshSearchThroughGateway, which compare exact bytes and see the note line. With Mark unset (as shipped) they pass. - Real Codex: built magpie from this tree, `magpie codex fakeai/fake-1` in a sandbox HOME. config.toml got the three notes above model_provider, model_catalog_json and openai_base_url; `codex mcp list` and `codex features list` (codex-cli 0.162.1) read it, rc 0, and Python's tomllib reads the same values. `magpie codex default` took them out. - Broken by hand: a note on every line, not only changed ones -> TestMarkTOML and TestMarkOnlyWhatMagpieWrites red. - The notes' line filter is withoutNotes, unexported: an exported Unmarked put a word the routing plugin translates into a Go file, and i18n-keys' "a plugin's words are its own" went red on it. It passes now. Full suite: run with the uninstall commit that follows, recorded there. |
||
|
|
51f66fe8bb |
gateway: Claude Desktop's haiku calls stay on the chat's provider, not another provider's Claude haiku (cybercaius on Discord)
cybercaius picked AgentRouter's gpt-6.1-sol in Claude Desktop, and the Routing page showed Claude Code's background calls in the same chat (3-9k tokens) going to leee/claude-haiku-5-5: "为什么Claude Desktop中模型 选择的是AgentRouter · gpt-6.1-sol,但在对话过程中还是会去请求leee供应商的 模型呢?" Cause: magpie's own default, not a pick of theirs. desktopModels tagged every Claude model magpie serves with its own tier in the /v1/models it gives Desktop (anthropic_family_tier, |
||
|
|
4534561f6b |
codex: a thread open when magpie quits goes on through a relay, not a 503
idkatbro on X: a Codex session started while magpie was open keeps failing after magpie quits with "unexpected status 503 Service Unavailable: Unknown error, url: http://127.0.0.1:3425/backend-api/codex/responses", until magpie is opened again. Cause: Codex signed in to ChatGPT, with more of its accounts on in magpie, gets openai_base_url = the gateway's /backend-api/codex (failover). At quit EndCodexFailover takes it out of config.toml, but a thread already open, in the Codex app and its app-server above all, keeps the base URL it started with. Every turn after went to a closed port. With a system or env proxy in between, the proxy answers 503 with an empty body, which Codex shows as "Unknown error"; without one Codex says "Connection refused" and reconnects. Reproduced on mote with codex 0.162.1 and a proxy answering 503 for the closed port. Masking plays no part: it runs only in the gateway, is opt-in, and its own 503 carries a readable message. Fix: when quit really ends failover (EndCodexFailover now says so), the gateway is on loopback, and Codex processes run (provider.CodexPIDs), magpie starts a detached `magpie codex-relay` (internal/codexrelay). It waits up to 60s for the gateway's port, then passes /backend-api/codex/* on to the ChatGPT backend with the same transforms the gateway applies to Codex's own turns, signed by the caller's own Authorization; it adds no credential (gateway.CodexRelay). - Refused with a readable 400 (Codex retries a 5xx five times over): a magpie model, a turn naming one of magpie's Codex accounts, and a turn masking would have masked, which is never sent unmasked. - 403 for any Origin (null too) or a non-loopback Host, as corsGuard. - Any other path gets 503 "magpie isn't running", never readable as magpie by ServedBy. - It ends once every Codex process it was left for is gone and nothing is in flight. - The next magpie (GUI or `magpie serve`) calls codexrelay.Leave first: a POST with the token from a 0600 state file. The relay closes its listener at once, so the port is free when Leave returns, and finishes its streams (up to 30 minutes). No running turn is cut. Run (at 6df7dc287 on origin/main |
||
|
|
ded4935745 |
providers: an image model can be unticked in its provider's editor, and leaves the lists (321sssrt on X)
A provider's editor lists its image models as chips under "Image models"
("图像模型"); a click unticks one, and Save keeps it as the provider's
HiddenDrawers, a deny list beside the Models allow list. An unticked
model leaves Settings > Images' picker, Automatic's choice (and so the
Magpie Image MCP's when nothing is picked), the gateway's /v1/models
image entries and Aside's image options (gateway.OfferedDrawers).
A hidden model still draws when a request names it (resolveDrawing reads
Drawers), and a Settings > Images pick made before it was hidden stays
the pick: it is still listed, as picked, and the row says it is unticked
in its provider and leaves the list once another is picked
(ImageGenHidden), so a pick never stops drawing in silence. A Save that
leaves hiddenDrawers out keeps them; [] clears them. Strings in en, zh,
zh-TW, ja, de. docs/subsystems/gateway-routing.md has the section.
Run, at this and the next commit on
|
||
|
|
e84f40369a |
testenv: wsl.exe is a failing stand-in, so no test reads the real distros (#4177)
wsl.exe wasn't among testenv's stand-ins, so on a Windows machine with
WSL (the xiaomi-gpu box) internal/agent listed the real distros and
their homes, and gui's TestGatewaySessionHistoryAndCalendar counted the
real distro's Codex sessions into its history and calendar. Windows CI
has no WSL, so only a developer's box showed it.
- tools now ends with wsl.exe: Isolate puts a failing stand-in first
on PATH, as for the keychain tools and agent CLIs.
- TestIsolateStandsInForWSL: wsl.exe resolves inside the test's home
and running it fails with no output.
- TestWSLCodexLive (opt-in, MAGPIE_WSL_TEST_DISTRO) puts System32 first
to reach the real wsl.exe it means to test.
Run:
- Windows (win-run): TestGatewaySessionHistoryAndCalendar red at main,
green fixed. The whole internal/gui package fixed leaves only #4115's
five (TestGatewayHeldByAContainer, TestLodyImportHandoff,
TestImportStatusUnreadableIsUnknown, TestAionUiImportRow,
TestUpdateThatWontStart). TestUsageLedgerDayRoutes and
TestUsageLedgerRoutes, red at main on that box, are green too.
- Windows agent, library, wslrun, testenv, proc, cli: wslrun, testenv,
proc ok. Every red in agent, library and cli is red at main too, run
by name on both trees: filed in #4115 (incl. its group B Hermes and
library WSL tests, which this stand-in doesn't reach: another path),
#1388/#1827 and #4140 (TestLibraryMCPHub).
- macOS (mote): TestIsolateStandsInForWSL red with main's testenv.go,
green fixed; internal/testenv ok.
- Linux (wsl-run): sessions, testenv, wslrun ok; agent's TestGrokInstalled
(#3548) and TestOmpDetectedWithPiDir (#4033) are red at main too.
- vet: GOOS=windows, GOOS=linux -tags nogui and darwin, on mote: ok.
Broken by hand: main's testenv.go (no wsl.exe stand-in) under the new test:
TestIsolateStandsInForWSL red; the gui test is red on Windows there.
Not tried: TestWSLCodexLive against a real throwaway distro; the full
go test ./... on mote (six other suites were running there).
At the rebased head (on origin/main
|
||
|
|
9474eaf9cb |
sessions: Raft's Pi agents' sessions are listed as Raft's, with their prompts, calls and delete
Raft (slock's raft-computer) runs its agents on Pi and keeps each one's Pi SDK session files in that agent's folder: <slock>/agents/<id>/ .pi-sessions/<ts>_<id>.jsonl, or .builtin-sessions/ for its built-in runtime. <slock> is $SLOCK_HOME or ~/.slock (%USERPROFILE%\.slock on Windows, the distro's ~/.slock under WSL). Read from raft-computer 1.0.14's PiDriver (buildPiSessionDir), BuiltInDriver and resolveSlockHome, and a read-only listing of ~/.slock here. runtime-sessions/ holds handoff notes, no sessions, and is not read. - The Sessions page lists them as Raft's (agent "raft", in agent.Clients' others), titled and opened with their prompts as Pi's are. - Their calls count on the Usage page as Raft's; calls through magpie stay the gateway's, as Pi's do. - Raft's Pi uses the user's own ~/.pi/agent, so a request it sends through magpie reaches the gateway as Pi's under the same session id. sessions.GatewayKeys gives a Raft session both "raft|ID" and "pi|ID", so the gateway's copy is not listed twice nor counted twice (Merge, stats, NativeIDs, the GUI's Via). - Delete and restore work as Pi's: the one file goes to the trash, and a folder beside it is left (the agent's workspace is not the session's). A session written in the last minutes is refused as active. - No resume command, no carry and no trace export: Raft starts its own agents, and nothing outside it can resume one. - SLOCK_HOME is passed through agentenv like the other agents' homes. Run (at 958ad9f10 on |
||
|
|
fccf86d62e |
agents: Claude Code found only inside Claude Desktop says so
cybercaius (Discord, Windows): with Claude Code uninstalled and only Claude Desktop installed again, the Agents page still listed Claude Code by its ~\.claude, with nothing saying why. Desktop 2.7032 fetches its own Claude Code for its Code tab (<userData>\claude-code\<version>\claude.exe, Claude-3p's folder in its gateway mode), which reads the same ~/.claude/settings.json, so the card is right to stay. desktopdir finds that copy and its newest version; with no Claude Code of its own, the CLI reports InDesktop (and DesktopVersion once Desktop fetched one), and the card carries an "In Claude Desktop" tag (en, zh, zh-TW, ja, de) whose tooltip names the version and settings path and says Desktop's Code sessions in WSL use the WSL card. A Claude Code of its own still wins. Run: - TestClaudeCodeInDesktop and the desktopdir tests: ok. Broken by hand: red with the change taken out. - node --test internal/gui/tests/claude-in-desktop.test.cjs (en, zh, zh-TW, ja, de; 980 and 560 wide): mote Chromium 10 of 10 ok; WSL box (magpie-desktop) Chromium 18 of 18 and WebKit 28 of 28 ok with i18n-keys and agent-app-version beside it. On the old app.js the 10 Chromium cases are red (that run ended without its summary line). - i18n-keys: ok. Not run on macOS WebKit: a bare WebKit launch on mote hangs at 60s with no test involved. agent-app-version's Chromium closed mid-run on mote (display link error under load ~60); it passes on Linux. |
||
|
|
741b843cd0 |
agent: a stopped distro's Claude Code offers efforts as effort, not models
A stopped WSL distro's Claude Code took magpie's model list for every field but model, effort and login, so each tier's effort, the subagents' effort and ultracode offered model ids; picking one was then refused by the running field's Set. The efforts now offer the levels of the model last seen (tierEfforts, as a running distro's do), and ultracode keeps its own options, which read only the last-seen model. Found while giving the WSL card the Claude rows (cybercaius, Discord). Run (mote): go test ./internal/agent -run TestWSLClaudeStopped -count=1, ok. Broken by hand: with the old wsl.go, TestWSLClaudeStoppedEfforts fails (opus_effort offers "relay/glm-4.6"). Not tried: a real stopped distro on the Windows box. |
||
|
|
628ac36fc9 |
agents: Add magpie says when nothing here opens the app's import link (sungt)
sungt (Discord #feedback, Windows, magpie 0.1.1976, Cindy 0.1.119, Cindy
open): on the Agents page Cindy's 添加 magpie "spins, no response".
What magpie got wrong: Cindy, AionUi and Lody take magpie only through
their import link, which magpie hands to rundll32 / open / xdg-open and
never waits on. A link nothing opens did nothing, the button never awaited
/api/open nor caught its error, and `magpie cindy add` printed "opened"
whatever happened.
- agent.OpenAppLink asks the system, without opening anything, whether
something opens the link's scheme: Windows' HKCR\<scheme> (what
Electron's setAsDefaultProtocolClient writes) and then the user's
UrlAssociations UserChoice; macOS Launch Services (cgo builds); Linux
`xdg-mime query default`. Only "none", or a registered program whose
full path is gone, refuses the link (NoLinkHandlerError); anything
unknown hands it over as before.
- /api/open (Cindy, AionUi, Lody after OpenLody) answers
code no_link_handler with app, exe and said, an i18n.js key from
linkSaid that api() puts through t() as it does bunSaid's.
- The import button now waits for /api/open and shows the result: "Sent
to {name}: confirm adding magpie there", or the reason in the
reader's language.
- The CLI's add returns the same error.
This is not verified as sungt's cause. Cindy was open, and Cindy
registers cindy:// at every start, so the check most likely passes on
their machine. If so, the spinner is Cindy's own import dialog
(previewProviderImport / fetching magpie's /v1/models). Cindy 0.1.119
wasn't available here. We still need Cindy's log around "received deep
link" from sungt.
Run (worktree at origin/main
|
||
|
|
fae438b4a5 |
agent: Codex switched on again is joined, and its own models say where a pick goes
NancyTom18 on X: Codex on a routing group, Disconnect and restore, switched on again, then an OpenAI model picked: every OpenAI row said 直连. After a routing group again they said 经 magpie. Reproduced in a sandbox HOME (ChatGPT sign-in, a group): reconnect put the group back by Apply alone, so Codex was beside its sign-in and not joined (codex.joined went with the Disconnect). Picking one of its own models then took magpie out (set → unroute, #940): config.toml had no openai_base_url and no model_provider, so Codex went straight to OpenAI and the 直连 tags were true. Back on the group, the rows said via magpie from routed(), while a pick would again go straight to OpenAI, with no ask: that label was false. - reconnect calls Join first where the agent has one, so a Codex switched on again comes back as the switch first connects it: joined, its own models staying through magpie. - modelOptions: beside its sign-in, not joined (with ChatGPT), and failover off, Codex's own models say Direct "OpenAI", so the picker tags them 直连 and asks before a pick takes Codex off magpie. Tests: TestCodexReconnectStaysJoined (red on the old applied.go: "connected again, not joined"), TestCodexBesideOwnModelsSayDirect (red on the old codex.go: "gpt-5.5 says via"). Each fix reverted by hand, its test went red. Run on mote at this tree: go test -timeout 45m ./... all ok except internal/gui TestMainWindowCorners/macOS_26_SDK, mote's macOS 27 red filed as #3949 (window chrome, untouched here). go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go build ./..., gofmt -l clean. GUI files unchanged; agent-leave-magpie and agent-path-same pass in Chromium and WebKit (4/4 each). Not tried: a real Codex binary with a real ChatGPT sign-in sending a turn; the route is read from config.toml as Codex's own provider rules read it. A Codex already beside a group from before this release stays so: its OpenAI rows now say 直连 and ask; switching it off and on joins it. |
||
|
|
b4267de595 |
gateway: a provider's fallback can be a routing group, routed as the group
01huadalang on Discord: "还有备用模型增加路由组的选择,现在只能选模型". A
provider's Fallback list held models only; a "group/<id>" entry resolved
to the group's first member alone. Now such an entry is served through the
group, as a request to the group would be:
- plan → planPaused: a fallback naming a group (provider.FallbackGroup,
the group as routed, Live) hands its members to planLevel
(planFallbackGroup): the group's own routing, its sink and asides, and
its pause rules (serve passes provider.PausedOut for the agent's folder).
Its trace rows are marked Fallback with the group in Via.
- No loop, each provider/model once a round: a member that is the primary,
a model named earlier, or another fallback group's member is left out
where it comes second. Groups have no fallbacks of their own and a
member's fallbacks are not followed, so nothing leads back. A group that
is gone or off is passed over, as a model none serves is.
- Every sibling that reads p.Fallback now reads a group's members through
provider.FallbackModels: redaction (unredactedRoute: an unmasked
provider with a fallback group holding a remote model is masked),
careful accounts (carefulOf), native compaction, Codex's own turns
(codexFallsBack) and Claude's auto-mode review (claudeReviewed, which
moves from provider.Resolve to ResolveRoute, as the gateway reads
fallbacks).
- CLI: `magpie provider fallback` already took group/<id> (Resolve knows
groups); its usage and error now say so. Pinned by
TestFallbackCmdTakesGroup.
- GUI: the provider editor's Fallback picker lists the routing groups
(providers.gateway.groups) beside the models as chips with the Routing
fan and a muted "routing group" tell; a picked group's row has the same
fan and tell, and a gone one says "No routing group {id} now; it is
skipped". A filter matches a group's name, id and its members'
providers. New strings in zh, zh-TW, ja and de.
- app.js budget raised 187 bytes on main (1,311,922; core 1,531,060), the core's
own editor, no room added; the addition was cut from ~900 bytes first.
- docs/subsystems/gateway-routing.md: the Candidates row says all this.
Not done: a fallback group's turn rules (ruleFor/ruleOver, which can ask
a classifier) are not applied. The plan is made before the primary is
tried, so they would cost a classifier call on every request the primary
answers. Its routing order, sink and pause rules are applied.
Run (at f6e7214af; after the rebase, the last bullet):
- gofmt -l: clean. mote: go build ./...; go vet on the touched packages;
GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...: ok.
- mote: go test -timeout 45m ./...: every package ok except internal/gui:
TestCoreScriptBudget (fixed above, then ok) and ten AppKit window tests
(TestDockJoinLeadsCommandTab, TestPanelCloseHidesIt, TestMainWindowCorners
…) killed at their 30s bars while four other sessions' GUI suites held
mote at load 70-110. Run alone, all ten
pass (TestDockJoinLeadsCommandTab skips) except TestMainWindowCorners,
red at base
|
||
|
|
3c6b7d585f |
agent: OpenClaw is wired up like the other agents
arthur041691 (Discord #help) runs OpenClaw for WhatsApp and asked for it in
Agents. Connecting writes magpie as a custom provider of OpenClaw's own, in
openclaw.json, and makes the picked model agents.defaults.model's primary.
What is written, from OpenClaw's source at 5bab0c14 (npm 2026.10.8, dc2523e):
- the file: OPENCLAW_CONFIG_PATH, else $OPENCLAW_STATE_DIR/openclaw.json,
else ~/.openclaw-<profile> for a named OPENCLAW_PROFILE, else
~/.openclaw; ~ is OPENCLAW_HOME when set (src/config/paths.ts,
src/config/state-dir.ts, src/cli/profile-utils.ts). OPENCLAW_PROFILE is
a name, not a path (agentenv.NotPaths); the other three expand a
leading ~, as resolveUserPath does (appdir.usable).
- models.providers.magpie: baseUrl (the gateway's /v1), apiKey (the
OpenClaw-named gateway key), api "openai-completions", and every model
magpie serves with id, name, input, reasoning and contextWindow
(src/config/zod-schema.core.ts, docs/gateway/config-tools/custom-providers.md).
A user's own keys on a model entry (headers, maxTokens…) stay on Sync.
- agents.defaults.model keeps its shape (string or {primary, fallbacks});
agents.defaults.models gets the ref's {} entry as `openclaw models set`
adds it (src/commands/models/shared.ts), only when that map exists; a
non-empty modelPolicy.allow gets "magpie/*" when nothing there lets
magpie's models in (src/agents/model-selection-normalize.ts).
- Model changes are hot-reloaded (docs/gateway/configuration/hot-reload.md);
a chat that already has a model keeps it (docs/concepts/models.md), so
the notice says to send /model default there. Translated in every
language.
- The file is written through temp-and-rename; a new one is 0600 in a
0700 folder, as OpenClaw makes it (src/config/io.write.ts). A file that
isn't JSON after comments are blanked (JSON5's bare keys) is left alone
with an error, never read as empty.
- Disconnect puts back the model there was, removes magpie's provider,
its {} entries, the allow entry and any object magpie made, and the
file itself if magpie made it.
Icon: a mask drawn from OpenClaw's ui/public/favicon.svg (MIT).
Run, on mote at this tree:
- go test -tags nogui ./internal/agent -run OpenClaw plus the every-agent
tests (drift, port move, sync on another machine, reverse proxy, LAN,
pinned key per writer, notices translated), ./internal/appdir,
./internal/agentenv: ok.
- Broken by hand, each red then green again: no stash restore
(TestOpenClaw, Shapes, AllowList), user keys dropped
(SyncKeepsTheirs), no allow entry (AllowList), no JSON5 guard
(JSON5LeftAlone), profile ignored (Paths), OPENCLAW_PROFILE back as a
path variable (Paths).
- Real OpenClaw 2026.10.8 from npm, Node 24.22.2, sandbox HOME on mote:
onboard --non-interactive made the file (its bytes are the test
fixture); magpie's code connected it; `openclaw config validate` ok;
`openclaw models list` shows magpie/kimi/k2 as default; `openclaw agent
--local` sent POST /v1/chat/completions with Bearer magpie-openclaw and
model kimi/k2 to a fake gateway on 3425 and showed its reply; no
agents/*/models.json override was written; Disconnect gave the file
back byte for byte and it validates.
- GUI: i18n-keys, agent-notice-lang, icon-tile, about-notices,
agent-connect (Chromium and WebKit): 53/53.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows ok.
- Full suite, go test -tags nogui -timeout 45m ./... at
|
||
|
|
a0ba8e1f2e |
grok: each model's context_window follows Long conversations, and one set by hand stays through a sync (uk.jent)
uk.jent (Discord #feedback) reported that magpie writes every Grok Build model's context_window as the model's whole window. They wanted about 300K without editing dozens of models, and they lost hand edits on each sync, because SetTOMLTables replaces the [model."magpie/..."] tables whole. Grok Build now uses Long conversations, the mechanism Codex and Claude Code already use. grokWindow gives: - min(window, Compact) when the model or provider has its own threshold; - otherwise settings.Working(window): 272K by default on longer windows, the typed size, or the whole window with Full context. What magpie wrote is stashed under grok:<path>:windows, and grokOwnWindow uses it to tell a hand edit apart: - A value that differs from what magpie last wrote is the user's, and it stays. - In a config written before the record, a value other than the model's whole window is the user's. - Disconnect forgets the record. The agent sheet's Long conversations row now shows for Grok Build (AGENT_PREFS). Its texts, the provider editor's hint, the Context tab's note and `magpie model compact` now name Grok Build, in en/zh/zh-TW/ja/de. setCompact and setAsync now share prefWrite. That dedupe keeps app.js under its budget, which is not raised. Behaviour change: a Grok Build model whose window is over 272K now gets 272K by default, as Codex does, unless Full context is on. Run on mote, at this head (c893c2229, rebased on |
||
|
|
62045475b4 |
library: Codex on magpie reaches a command's MCP server through the gateway, run only while a thread uses it (#3885)
Codex starts every stdio server in its config once for each thread it has loaded and keeps them as long as the thread: YPYT1 counted 204 node processes, 21 GB, beside one Codex. While Codex is on magpie (Wired, not disconnected, this machine's gateway key, not WSL) the library now gives it a server run by a command as url = <gateway>/mcp/run/<name>, which magpie serves over streamable HTTP and runs the command for itself (internal/library/mcp_run.go): - a session (Mcp-Session-Id) starts its own child only when it sends something past initialize, the first page of tools/prompts/resources lists and ping; those are answered from what the first child said for the same command, args and env, and a list_changed from a child drops that list; - a (re)started child gets the session's own initialize replayed, so a server that keeps state per client still keeps it per thread; - a child idle for 15 minutes is stopped (a later call starts it again), DELETE stops it, and a server changed or removed from the library has its children stopped at the next sync; - server-initiated requests and notifications go to the session's newest open stream (GET, or a POST answered as SSE). The gateway route lets only this machine in: no Origin, a loopback Host, no forwarded or LAN address (TestRunMCPThisComputerOnly). A server with an env var magpie hasn't, a remote one, and Codex off magpie, in WSL or on another machine's key keep the command as before. agent.Rewired re-syncs the library when Codex is connected or disconnected, so it is handed the commands back when it leaves magpie. Tests (internal/library/mcp_run_test.go, a fake server): starts on a call and not on initialize/lists, idle end and DELETE, a server's own request round-trips, list_changed, a changed/removed spec, an unknown session, and the Codex entry in a sandbox (url when wired, the command back when not, a keyed env var kept as a command). Each was red with its part broken by hand: the init cache removed, the sweep off, runsFor forced false, forget a no-op, the Origin/Host guard dropped. Real runs: - mote, sandbox HOME, real codex 0.162.1 + @modelcontextprotocol/ server-memory: config.toml gets url = "http://127.0.0.1:3581/mcp/run/ mem"; codex app-server's mcpServerStatus/list lists its 9 tools through the bridge. - this Mac, sandbox HOME with only the DeepSeek provider copied, codex 0.162.1 on deepseek/deepseek-flash: a real turn called mem create_entities and read_graph through the bridge and answered with the stored observation. Three codex exec turns at once that used no tool started 0 memory-server node processes (before: one each). - Windows 11 (xiaomi-gpu), sandbox profile, codex 0.161.0: url entry written, app-server lists the 9 tools, 0 memory-server node.exe left after Codex closed. Run at the pushed head (mote): GOOS=linux/windows/darwin go vet -tags nogui ./internal/library/ ./internal/gateway/ ./internal/agent/: ok. go test -count=1 -timeout 45m ./internal/library/ ./internal/gateway/ ./internal/agent/ ./internal/gui/: library ok (167s), gateway ok (596s), agent ok (279s); gui FAIL only TestMainWindowCorners/macOS_26_SDK ("a toolbar doesn't change the corners ... yet the main window's was taken off"), #3949, red on mote's macOS 27 on main too; no gui or AppKit file is touched here. Windows (win-run): go test -run 'TestRun|TestFakeRunServer|TestMCPProxy' ./internal/library/ ./internal/gateway/: ok. Not tried: the Codex desktop app (the same config.toml), a server that asks the client for sampling or elicitation in a real agent. Codex picks up the new entries when it restarts. Reported-by: YPYT1 |
||
|
|
1ff54f079f |
grok: each model is asked on its native API (responses, messages), not Chat for all (uk.jent)
uk.jent on Discord: magpie wrote api_backend = "chat_completions" on every
[model."magpie/…"] table of Grok Build's config.toml, so a Responses-only
GPT or a Claude on an Anthropic endpoint was translated through Chat by
the gateway. Grok Build 1.0.67's own docs (the "Supported API Backends"
page bundled in its binary) take api_backend per [model.*] table:
"chat_completions" (default), "responses" and "messages" (Anthropic
Messages), sent to base_url + /chat/completions, /responses or /messages.
grokBackend now writes the model's native API from catalog.Model.APIs, as
Pi, droid and dsh pick theirs; Chat stays for a Chat-native or unknown
model and for a group whose members differ. All three go to the same /v1.
Grok App (grokapp.go) is unchanged: it has one channel, [model.magpie],
whose model the App's composer switches, so a backend written for the
picked model would be wrong for the next one picked there.
Run:
- TestGrokAsksEachModelNatively (new): red with the old "chat_completions"
put back by hand ("resp/gpt-6-sol: api_backend "chat_completions" ...
want "responses""; same for anth/claude-sonnet-5 / "messages"), green
with the change.
- At this head (rebased on origin/main
|
||
|
|
72ca3d593b |
codex: magpie as Codex's provider keeps the Codex app's ChatGPT account while it has room, so its Work chats and projects stay
Qyburn3 on X: with magpie taking Codex over, the Codex app's "Work"
sessions don't load while the model still answers; turned off, they
come back.
Cause: [model_providers.magpie] had no requires_openai_auth, so Codex's
app-server answers account/read and getAuthStatus with no account and no
token whenever magpie is Codex's provider (magpie API, or the codex.out
takeover). ChatGPT.app 26.1021 then switches to an identity of no
account: onboarding again with no name, ChatGPT mode's projects and
chats ("Work") empty, no avatar, no Chrome control (#1824).
Now putProvider writes requires_openai_auth = true while Codex has a
ChatGPT sign-in with room (openaiAuth: codexChatGPTKnown and not
codexUsedUp), and takes it out otherwise:
- API key alone: left out. With it Codex drops image_gen (captured: 11
tools without, 10 with), and there is no account to keep.
- No sign-in: left out (the app would ask for a sign-in).
- A sign-in the Codex app holds (codex.out, or magpie API while used
up): left out, since the app's composer gate (authMethod chatgpt +
allowed false, #540) would grey Send for magpie's models again. The
takeover's note now names "its ChatGPT chats and projects" among what
is off till the reset, beside Keep on ChatGPT.
- An unknown sign-in read leaves the table as it is.
Sync rewrites the key on any table that disagrees (authStale), an older
magpie's included, and the key joins codexAppRoute, so the Codex app's
app-server is restarted onto its account with nothing for the user to
do. The magpie API note no longer says Chrome control needs ChatGPT (en,
zh, zh-TW, ja, de); agent-wiring.md says why.
Real app (mote, ChatGPT.app 26.1021 with its codex 0.164.0-alpha.11,
sandbox CODEX_HOME, copied real ChatGPT auth, auth.json unchanged after):
- native config: the account's projects and recent chats listed.
- magpie table without the key: onboarding, "ChatGPT Work" with no
projects, no chats. app-server: account null, authMethod null.
- magpie table with requires_openai_auth = true (the keys this commit
writes): every project and chat back; account/read chatgpt pro,
getAuthStatus authMethod chatgpt with a token.
- Model requests to a capturing server, with and without the key:
Bearer is magpie's experimental_bearer_token, no ChatGPT-Account-ID,
15 tools both ways with a ChatGPT sign-in (image_gen kept).
Tests: TestCodexMagpieProviderKeepsChatGPTAccount (ChatGPT + magpie API,
used up and back; taken over and the reset; an older magpie's table from
live config bytes; API key and no sign-in, fresh and after ChatGPT) and
TestCodexAppRouteFollowsOpenAIAuth. Broken by hand: on the old codex.go
5 of 7 subtests red; without the Sync re-derive 3 red; with the key kept
while used up 2 red; agents.go without the route key, the route test red.
Run (mote-run, at this tree on origin/main 157d575c3; the build and the
agent run again after the rebase onto
|