ac4af582301a4e8a29245dbba767eba31334ddf9
180
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d1f8d8aae7 |
agent: Cherry Studio adds magpie through its providers link (plugins#865)
Cherry Studio (CherryHQ) shows on the Agents page, and with
`magpie cherrystudio`, on macOS, Windows and Linux. Its row is the link
its main process takes, cherrystudio://providers/api-keys?v=1&data=, with
the gateway at <gw>/v1 as an OpenAI-compatible provider named magpie and
the named key agentKeyAt("cherrystudio"). Cherry Studio asks the user to
confirm it. magpie writes nothing into its store. "Added" is read
untouched from its 2.x database (Data/cherrystudio.sqlite, user_provider),
in the default userData and every one boot-config.json moved it to. A
database or boot-config that can't be read, or a 1.x userData (Local
Storage, no database), is unknown. The data is standard base64, because
Cherry Studio swaps raw + and / before parsing and back after. /api/open
lets that link through. aionui's database status is generalized into
dbStatus{has} so both apps share it. Icon: Cherry Studio's own logo, not
cherryin-color (a different product).
Run (mote, at this change on origin/main c66cdbea9; then rebased on
|
||
|
|
a210b3bd5f |
agents: a reply limit typed by hand into Pi or OpenCode is kept
sayagoodbyeplz on Discord set Pi's maxTokens for WorkBuddy's
deepseek-v4.1-flash to 128000 in models.json, and magpie's next sync
wrote models.dev's 384000 back. magpie writes its models block whole,
so a hand edit inside it was never kept.
output_kept.go records, in the stash, per file and model, every reply
limit magpie has wanted there (the last 8). A value in the file that is
none of them is the user's, and the next sync keeps it. Pi's
providers.magpie.models[].maxTokens and OpenCode's
provider.magpie.models.<id>.limit.output go through it. A Max output the
user sets in magpie (Model settings, Advanced, or `magpie model output`)
is still written over the hand edit, since that is their word in magpie.
With no record (a model new to the file, an unreadable stash) the value
is magpie's, as before. The record keeps every wanted value, not only
the last one written, because the same block is also built for Drift
and never written.
Other agents that write a reply limit are not covered yet: #5693.
Run (mote, at this tree):
- go test ./internal/agent/ (whole package): ok, again at the rebased
head on
|
||
|
|
32fc5809e1 |
agents: OpenMausBot gets magpie as an engine of its own, written as its own Claude endpoints are (a user on X)
A user on X asked for OpenMausBot (github.com/milind-soni/OpenMausBot,
read at 516ca75; released 0.1.145). Its bots run on engines from
`instances` in ~/.openmausbot/config.json ($OMB_DATA_DIR,
server/config.ts:713). Without this, a Claude bot reached magpie only
through ~/.claude/settings.json, and its picker listed Claude's static
models alone: OpenMausBot doesn't read the model from env
(readClaudeModelCatalog, claude.ts:296-316).
- openmausbot.go writes `instances.magpie` in the shape of OpenMausBot's
own "Claude endpoint" (newClaudeEndpoint, claude-endpoints.ts:91-139):
- driver claudeAgent, access custom
- config.configDir is <data>/providers/magpie. Given that,
OpenMausBot starts Claude Code with that CLAUDE_CONFIG_DIR and
strips account keys the engine doesn't set (claudeEnvironment,
claude.ts:111-136, 158-179), so the engine owns its routing.
- requireApiKey
- ANTHROPIC_BASE_URL, AUTH_TOKEN, API_KEY and MODEL point at the
gateway
- endpointModels holds magpie's models, kept to the ids
CLAUDE_MODEL_ID accepts. One bad id makes OpenMausBot refuse the
whole engine (claude.ts:636).
- A non-empty `instances` is the whole fleet (config.ts:1173). With
none saved, magpie writes DEFAULT_FLEET (instance-fleets.ts) beside
magpie, stashed as openmausbot.fleet. Off takes the fleet out again
if the user hasn't changed it.
- What stays the user's: the engine's name, a model they picked from
the list, their other env and an inherited `cli`.
- Check reports the base URL drifting away from the gateway.
- OpenMausBot reads config.json once at start (index.ts:780), and an
engine edited in it writes back the fleet it holds
(routes/instances.ts:132, config.ts:997-1012). So Set is refused
while it runs (errOMBRunning), and the notice asks to quit it first,
since Windows can't tell.
- ListOnly, ListsModels, OMB_DATA_DIR in agentenv. The icon is
OpenMausBot's build/icon.svg (Apache-2.0).
- i18n in zh, zh-TW, ja and de. Docs: reference, agent-wiring, both
READMEs.
- Codex bots use ~/.codex (codex.ts:373-386), which the Codex wiring
already covers.
- The agent package's TestMain holds ombRunning false. An OpenMausBot
open on the test machine refused every test that turns magpie on for
each agent: my own sandbox OpenMausBot on mote turned
TestSyncKeepsAnAddressOnAnotherMachine, TestListOnlyAgentsReadConnected
and TestReverseProxyIsStillMagpie red. With a process named
openmausbot running, they now pass. LiveAgent's, OpenPencil's and
NewMax's running checks have the same hole and are left to #5587.
Run (all on mote):
- gofmt -l: clean
- go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows: ok
- go build for the same three targets: ok
- go test -tags nogui ./... -timeout 45m at e1453a168 (this change on
origin/main
|
||
|
|
49f207c784 |
agents: DS Bot, wired in the DSH home it runs on
DS Bot (github.com/Fei2411/DS-Bot, Apache-2.0, dsbot.app) is a DSH plugin and an Electron app built on it. The app ships its own DSH (0.2.2-rc.1 in 0.3.0) and runs it with DSH_HOME at a data folder of its own, booting the profile ds-bot, and never reads ~/.dsh: magpie's dsh row didn't reach it. It is a row of its own now, ds-bot (dsbot.go), wired by dsh's code on its folder (dshOn, split out of dshAt): magpie's routes and start in profiles/ds-bot/cordis.patch.yml, the key in that folder's .env and .credentials.yaml. The folder is $DS_BOT_HOME, else locations.json's dataDir in the app's userData ($DS_BOT_SHELL_DATA, else <config>/DS Bot, or the legacy DeepSeek Bot), else ~/.ds-bot, as the app's first-run.mjs and legacy.mjs choose it. A locations.json that can't be read or names no folder is unknown: nothing is read or written. The routes there list the models shown for DS Bot on the Agents page (dshListFor), and the serving round fills a profile the app makes there as it does ~/.dsh's (dshHomesRounds). Found by DS Bot.app (io.github.fei2411.dsbot) or its Windows per-user install (guid from its electron-builder.yml). Three notices, translated into zh, zh-TW, ja and de. DS_BOT_HOME and DS_BOT_SHELL_DATA are in agentenv's sandbox list. Run: - go test ./internal/agent/ ./internal/agentenv/ ./internal/gui/ ./internal/cli/ ./internal/appdir/ on mote: ok but internal/gui TestMainWindowCorners/macOS_26_SDK, red on mote's macOS 27 whatever the change (#3949). - go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... on mote: ok. gofmt -l: clean. - node --test i18n-keys, i18n-en-no-cjk, agent-notice-lang (chromium), and agent-notice-lang in webkit: all pass but i18n-keys "a plugin's words are its own", red on main for three plugin words (#5332, #5426, #5482). - Real DS Bot 0.3.0 (DS-Bot-0.3.0-mac-arm64.zip) on mote, all in a sandbox HOME with DS_BOT_HOME, DS_BOT_SHELL_DATA and DS_BOT_WORKSPACE under it: a magpie built from this tree (nogui), MAGPIE_ADDR 127.0.0.1:3572, a fake OpenAI upstream on 3571 added as a provider. `magpie ds-bot magpie/fake/m1` before the app was ever opened wrote the profile; the app's first start kept it (agent-default-model still magpie's) and added its own files beside it. Its Chief Bot offered "Magpie: m1 · fake, m2 · fake"; picking m1 and sending "ping" over CDP went through magpie to the fake (POST /v1/chat/completions model m1, stream) and "pong from fake" showed. `magpie ds-bot default` then took every magpie entry out and the .env with it. Only my own pids (app, serve, fake) were stopped. Broken by hand, each red, then put back: - dsbot's desktopApps entry out: TestDsBotWired (not detected). - dshListFor always "dsh": TestDsBotOwnModels. - dshHomesRounds without DS Bot's home: TestDsBotProfileMadeWhileServing. - a bad locations.json taken for ~/.ds-bot: TestDsBotDataFolder. On the old code the tests don't build (no ds-bot row at all). Not tried: the Windows app (install path and registry guid read from its electron-builder.yml, not from an installed copy); Linux (its AppImage and deb aren't looked for; the data folder its first start makes finds it); a real vendor behind magpie; a default Bot model set in DS Bot (the notice says it wins, per its models.js). Not done: usage gives DS Bot no User-Agent of its own (its DSH's requests likely count as dsh's), and the Sessions page doesn't read its data folder's sessions. Reported-by: rnhung |
||
|
|
37c1bc043b |
agent: a group whose members all serve Responses, one best there, is asked on Responses
zyh6036 on X: several subscriptions that all serve the Responses API were asked on Chat once they were put in a routing group. Pi, OmO, omp, StepCode, droid, dsh, Hermes, Grok CLI and the live agents ask each model on the one API catalog.Model.APIs names, and a group had Responses only when every member's Native was Responses (allResponses, #1594). A relay that serves Chat and Responses, best on Chat (no Base URL API given, not OpenAI's own host), counts as Chat there, so one such member put the whole group on Chat, and the gateway then translated Chat to Responses for the ChatGPT, Copilot GPT or Responses-relay members. Found groups (auto-<slug>) hit this without the user doing anything: a new relay that also lists gpt-5.5 moved auto/gpt-5.5 from openai-responses to Chat (pi_api_test shows it). provider.GroupAPI now gives Responses when one member is best on Responses and every other takes a Responses request as it is (Responses among the APIs it relays), or translates every request anyway (a Claude Code subscription). So no member is translated that Chat would have relayed, and the ones best on Responses are relayed, not translated from Chat. The gateway already relays a /v1/responses request to each member that serves it (usable), so nothing changes there. Mixed groups: a member that Responses doesn't reach (a Chat-only key, a Messages-only Claude) keeps the group on Chat, where that member is relayed; picking Responses there would translate it on every turn. A Messages-only group stays on Chat as before (#1594's reason: a Claude member's thinking is known by its own model id, not the group's). An agent plugin's connect is told a group's native_endpoints now (provider.GroupEndpoints: the APIs every member relays), where it had none. /v1/models still leaves them out for a group: TestRemoteMagpieNativeAPI holds that a remote magpie sends a group's request on in the client's API for the other side to pick per member. No setting added: the group's API follows from its members. Run (mote, through mote-run): - go test ./... -timeout 45m at 65780f04f on |
||
|
|
6bc5702cd4 |
agent: magpie's OpenCode provider sets setCacheKey, so OpenCode sends its session's prompt_cache_key (#5468)
mariamatrix (#5468) and mahiro233 on Discord: magpie writes OpenCode's magpie provider with @ai-sdk/openai-compatible and only baseURL/apiKey, so OpenCode sends no prompt_cache_key and an upstream that caches by it misses. Checked against OpenCode's source and real runs (sandbox HOME on mote, a recording Chat server): - 2.2.5: v1/config/migrate.ts maps options.setCacheKey to compatibility.supportsPromptCacheKey, and openai-chat.ts sends prompt_cache_key only then. Without it: no key; with it: "prompt_cache_key":"ses_…" on the turn and the title request. A config with magpie's provider under providers, compatibility.supportsPromptCacheKey true, sends it too; without, none. - 1.19.5: setCacheKey true sends camelCase promptCacheKey (the previous commit sends it on as prompt_cache_key). - 2.0.25: ignores the option; the run answers as before, no error. Now: - the "opencode" shape's options have setCacheKey: true. Every writer of provider.magpie goes through it and openCodeKept: OpenCode, its OPENCODE_CONFIG_DIR copies, MiMo Code, DevEco, Air's OpenCode and OpenChamber's. - openCodeNative writes it as OpenCode 2 does: compatibility .supportsPromptCacheKey, not a setting. - a setCacheKey the file has already under provider.magpie.options, or a supportsPromptCacheKey under providers.magpie.compatibility, is the user's (false too) and stays, through a sync and a pick. Kilo has no wiring in magpie; no other agent's config has this option. TestAirProviderWritesKeepCustomFields compared every option as a string; it now compares a bool as its JSON. Run on mote: go test ./internal/agent (full package) ok; go test -run 'OpenCode|CacheKey|Air|OpenChamber|Deveco|Mimo|KeepTheir' ./internal/agent ./internal/gateway ok; go vet on darwin, GOOS=linux, GOOS=windows; go build ./... (darwin, windows); gofmt clean. Broken by hand, each failing TestOpenCodeSetsCacheKey: no setCacheKey in the shape ("no setCacheKey"); no keep under provider ("the user's false not kept"); no keep under providers (same); no move out of settings ("setCacheKey in OpenCode 2's settings"). Not tried: a config written by a running magpie fed to a real OpenCode (the real runs used configs of the same shape, written by hand); a real upstream's cache hit rate before and after. Reported-by: mariamatrix Reported-by: mahiro233 |
||
|
|
e7948e2484 |
agent: a routing group with a Claude member tells Pi its cache keeps five minutes (#5037)
Pi's cacheWarming weighs a model by its promptCache and stops with
"cache lifetime unavailable" without one. magpie declared it only where
piPromptCache saw the entry's own api — anthropic-messages for a Claude,
openai-responses for a GPT — and a routing group has no api of its own
(a Messages-only group stays on Chat, allResponses), so auto/claude-*
went out with none and Pi never warmed the group's cache, while the
cache itself was there: on the Chat path the gateway marks its own
translation to a Claude member ephemeral for five minutes (addedMark).
So the group now derives the field from its members: one asked on
Anthropic's Messages by its own provider, and the entry declares the
five minutes the gateway's own marks keep. long stays out — the gateway
marks an hour only where a session's turns are often far apart, so it
isn't always true — and a subscription's Claude (asked through Claude
Code, which caches on its own) still declares none, as before. An
all-Responses group keeps what it had: its entry's own api answers.
Reviewed and ported: every line read against origin/main
|
||
|
|
4f624241f7 |
codex: the ChatGPT app left on "hit a snag" after an app-server restart is reopened when idle (#4550)
ysm119 on Discord: each Restart of Codex in magpie left the ChatGPT desktop app on "ChatGPT 遇到了问题 / 请重试" till it was quit and opened again. magpie ends the app's own app-server cleanly (code 0); a signed-in ChatGPT 26.1021 then fails "Hosted AppServerManager identity is not ready" on the one it starts, logs fatal_error_broadcasted and shows the page. That is the app's bug; magpie now follows it up. - provider/codex_app_crash.go: for 60s after every end magpie makes (the watcher's step, RestartCodexApp, RestartSwitchedCodexApp) the app's logs are read for a whole fatal_error_broadcasted line stamped after the end. On one, with no request through magpie since or in flight and no Codex turn opened since, the app is quit and opened once. Otherwise it is left as it is and logged. Where it can't be reopened (Linux, an app that didn't quit) the Agents row says "The Codex app hit an error · quit it and open it again" (appSnag) until the app-servers seen then are gone or the app is closed. Unreadable logs reopen nothing. - agent/codex_app_crash.go: the logs as the app's file logger writes them (macOS ~/Library/Logs/com.openai.codex, Windows %LOCALAPPDATA%\Codex\Logs and the Store package's LocalCache, Linux $XDG_STATE_HOME/codex/logs; YYYY/MM/DD folders, tail-read, half lines dropped). The relaunch is the Agents row's: on macOS ChatGPT.app found by its bundle id, quit as ⌘Q does and opened once it has ended, never forced; on Windows codexAppReopen. - GUI line in en, zh, zh-TW, ja, de; docs/subsystems/agent-wiring.md. Run on mote (macOS) at this head on origin/main |
||
|
|
dabb5722f8 |
claude: Claude Code routed through magpie stays signed in where the user put it when that account is spent
oreoft on Discord has two Claude accounts: A, the main one, whose sign-in carries their claude.ai connectors (MCP), and B, a quota account. A's allowance was used up. They set A first and signed in, B second, and "跑着跑着" B came first again and became Claude Code's sign-in, and the MCP broke. They set it back more than ten times. Cause: the used-up switch (#208). KeepOnAnAccountWithRoom looks at Claude Code's sign-in every minute or five; A is spent, so NextLogin returns B and SwitchWhenSpent rewrites Claude Code's live credential to B. The GUI's list puts the account in use first (loginsInOrder), so B "moves to first". Each time the user signed A in again, the next look moved it back. Decision: when Claude Code's settings send its requests to magpie's gateway (ANTHROPIC_BASE_URL is the gateway, whether it signs in with magpie's key or keeps its claude.ai sign-in), NextLogin never moves its sign-in off a spent account. The gateway already routes every request to an account with room (it skips spent ones on its own), so moving the sign-in served nothing and only took away what the user signed in as. This keeps the user's choice and needs no setting. Still switching, unchanged: - not routed (Claude Code asks Anthropic as its own sign-in): the switch is the only thing that keeps it working (#208); - "Only switch Claude Code's sign-in" (SwitchOnly): the gateway serves none of those accounts, so switching is all magpie is asked to do; - the move back to the first account / the kept account (returnsToFirst, KeepLoginAs), which go toward the user's choice; - `magpie accounts switch claude next` and the GUI's own switch. - Codex is left as it is: the Codex app stops sending once its own account is out, so it needs the sign-in moved. ClaudeThroughMagpie is a provider hook the agent package sets (claudeRouted, the same check claudeIn's "routed" uses), like CodexAppRoute. Run (all on mote via mote-run): - new TestClaudeRoutedThroughMagpieKeepsItsSignIn (sandbox HOME: A spent, B with room; routed: three looks, no switch, credential still A's; SwitchOnly: switches to B; not routed: switches to B) with TestClaudeSwitchedWhenSpent, TestClaudeSwitchOnly*, TestKeepLoginAs*, TestNextLogin*, TestClaudeSwitch*, TestNextInOrder, TestCodexDrain*: ok. New TestClaudeThroughMagpieReadsItsSettings (agent): ok. - gofmt -l clean; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...; go build; GOOS=linux go build -tags nogui; GOOS=windows go build: ok. Broken by hand: with the NextLogin gate turned off ("if false && ..."), TestClaudeRoutedThroughMagpieKeepsItsSignIn FAILs at line 80, "Claude Code routed through magpie was signed in to b@example.com". Not tried: real Claude accounts and a real Claude Code with claude.ai connectors; Windows and Linux boxes. Full suite runs after the push. A sign-in already moved to B stays on B until the user switches back once. |
||
|
|
c03dee7e3e |
agent: LiveAgent, magpie's models in its model picker (xiaoxiaofei. on Discord)
xiaoxiaofei. asked for LiveAgent (Stack-Cairn/LiveAgent, v2). LiveAgent 2 is a Tauri app that runs its models through K-brain, a Go backend it starts as `k-brain backend -data-dir <root>`; every provider lives in <root>/config.json (JSONC, Pi's provider shape). Root: $LIVEAGENT_HOME, else $K_BRAIN_HOME, else the folder ~/.liveagent/data-dir.json points to, else ~/.liveagent, on every OS (LiveAgent's data_home.rs and kbrain_backend.rs, K-brain's internal/config and internal/storage). Connect adds providers.magpie: type claude_code + api anthropic-messages (what LiveAgent's own settings write for an Anthropic-compatible provider), baseUrl the gateway root (K-brain appends /v1 and posts /messages with X-Api-Key), the key naming LiveAgent, activeModels null, modelOrder in magpie's order, models sorted by id with display name, window, output limit and input [text, image]. K-brain decodes with unknown fields refused, so only its fields are written. A default or compact model still K-brain's endpoint-less demo model1 becomes magpie's first; the user's own pick stays. Through a sync the user's name, the models they turned off, their order, K-brain's metadata and a model's own displayName stay; a new model is on and last; nothing to change writes nothing. A file K-brain wouldn't read as providers (not an object, providers not an object, top-level models, a bare provider) is left alone. Disconnect takes the entry out, puts picks back to K-brain's default, gives a file left with no provider K-brain's demo back (its CLI restores config.json.bak, which could hold magpie's, from a file with none), and removes a file holding only what magpie made. LiveAgent's backend holds the settings and writes them whole on any change, so a change is refused while liveagent or k-brain runs (macOS/Linux; the notice says to quit it first, in every language). Logo: the app's own 64px icon (src-tauri/icons/64x64.png, MIT) in an SVG. Run on mote at this tree: - gofmt -l clean; go vet ./internal/agent ./internal/agentenv for darwin, linux (nogui) and windows - go test -tags nogui ./internal/agent -run 'LiveAgent|GatewayKey|ListsModels' ok; ./internal/agentenv ok; ./internal/gui: only TestCoreScriptBudget red, which is red on its base too (app.js untouched here; #5139) - GUI icon-tile, i18n-keys, agent-notice-lang, gui-zh-tw, gui-ja, gui-de: Chromium 27/27, WebKit 27/27 Broken by hand on mote, each red: the user's activeModels not kept (TestLiveAgentProvider "activeModels after sync [], want [...]"); the demo provider not put back (TestLiveAgentMakesItsFile "emptied file"); the demo default not replaced (TestLiveAgentProvider, TestLiveAgentMakesItsFile). Real use on mote (sandbox HOME and LIVEAGENT_HOME, this magpie on 127.0.0.1:3562, a fake Anthropic upstream on 3561, LiveAgent 2.0.5's bundled k-brain from the release dmg): - k-brain backend's first start wrote config.json as {}; magpie liveagent magpie then wrote providers.magpie and the default pick - `k-brain run "Reply with exactly: pong"` (K-brain's CLI, same config and routing code) answered "pong"; the upstream saw POST /v1/messages from magpie - the backend LiveAgent starts listed magpie's model in /v1/models with it as the default, and its /v1/text/generate answered "pong" through magpie - with k-brain running, connect/disconnect were refused with the notice; after it quit, disconnect removed the file magpie made Not tried: LiveAgent's window itself (its model picker was not opened; the backend's API it reads was); LiveAgent on Linux or Windows; a real vendor reply (fake upstream). |
||
|
|
d8b3749ef7 |
agents: Copilot CLI reaches magpie's models through its providers.json (BYOK)
tony9759 on Discord asked for Copilot CLI to be wired to magpie, since its
docs say it takes a custom model provider URL.
What Copilot does (1.0.105, @github/copilot-darwin-arm64's cli-main.js,
`copilot help providers` / `help environment`; GitHub docs
docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/use-byok-models):
env BYOK (COPILOT_PROVIDER_BASE_URL, _TYPE openai|azure|anthropic, _API_KEY,
_WIRE_API completions|responses) and a providers.json at
$COPILOT_PROVIDERS_CONFIG, else <COPILOT_HOME or ~/.copilot>/providers.json:
{providers:[{name,type,baseUrl,apiKey}], models:[{id,provider,name,
maxPromptTokens,maxOutputTokens,...}]}, picked as <provider>/<id> in
settings.json "model". Neither needs a GitHub sign-in. The multi-provider
file is marked experimental in the SDK types. The version BYOK started in is
not verified (github/gh-aw#25014 says 1.0.19; GitHub's changelog of
2026-04-07 announces it).
magpie writes the persistent file, not the environment: provider "magpie"
(openai chat completions, the gateway's /v1, the agent-named key) and one
models entry per catalog model, then model = magpie/<ref>. Only entries
naming magpie are magpie's; the user's providers, models and other keys stay
through connect, Sync and Disconnect (which also restores the model they were
on); a file that does not parse is never written over. COPILOT_HOME and
COPILOT_PROVIDERS_CONFIG are honoured (the latter added to agentenv.Vars).
Copilot's own models stay in the field's list.
Run at this head (a4fb75bfd's tree on
|
||
|
|
d3de7e8f3e |
agent: a provider of the user's own at magpie's gateway, under OpenCode 2's providers, stays theirs (#3915)
Found while fixing #3883. OpenCode 2 keeps a provider under providers, its base URL in settings.baseURL, and reads it there before the same name under provider, OpenCode 1's spelling: the one under providers is taken whole, and the other is only a WARN, "retained native value over legacy value" (packages/core/src/config/normalize.ts, mergeMaps, at v2.1.4). OpenChamber's provider form saves a provider there and takes it out of provider (packages/web/server/lib/opencode/config-v2.js, writeSectionEntry). magpie read the user's own providers under provider only, in the two places that look for them: - ownGatewayProvider: a provider of the user's own at magpie's gateway that lists the model, as a layout of one provider per family of magpie's models has, gets a pick of that model of magpie's as <theirs>/<model>, with no provider.magpie beside it. One under providers wasn't seen, so the pick went to magpie/<model> and magpie's provider was added beside the user's. - openCodeSpelled: a model on a provider named as one of magpie's and at the gateway (relay/glm-4.6 on the user's own relay) counts as magpie's. Under providers it didn't, so Agent.Models left it out. On origin/main |
||
|
|
0ed9891de0 |
agent: magpie's provider under OpenCode 2's providers is kept current (#3883)
Murciee (#3883, OpenCode 2.1.4 as OpenChamber bundles it, Windows): a model added in magpie never reached OpenCode 2, though magpie said it was exposed. ~/.config/opencode/opencode.json held magpie's provider twice, provider.magpie with 43 models and providers.magpie with 38, and opencode models listed the 38. OpenCode 2 keeps a provider under providers, in words of its own, and still reads OpenCode 1's provider: a provider named under both is the one under providers, whole, and the other only a WARN in its log, "retained native value over legacy value" (packages/core/src/config/normalize.ts, mergeMaps, at v2.1.4). OpenChamber's provider form saves a provider under providers and takes it out of provider (packages/web/server/lib/opencode/config-v2.js, writeSectionEntry). Once it had saved magpie's, magpie's next sync put provider.magpie back, as a model of magpie's was picked, and from then on brought only that one up to date. Where an OpenCode config keeps magpie's provider under providers, each sync and model pick now write it there too, and the wiring check reads it there (opencode_providers.go). It is written as OpenCode 2 reads magpie's provider.magpie (packages/core/src/v1/config/migrate.ts, migrateStandardProvider and migrateModel): npm as package "aisdk:<npm>", options as settings, a model's modalities as capabilities beside tools, its variants a list of {id, settings, body} with the options OpenCode 2 reads itself in settings and the rest in body (provider-options.ts, COMPATIBLE_KEYS: a fast variant's service_tier), and reasoning, which it doesn't read, left out. As under provider (theirsKept, openCodeKept), magpie's models are written whole, a key of the user's in the block stays, and so does a variant the user put on a model of magpie's. A variant is magpie's when it says what magpie's of its name says, split as OpenCode 2 splits it or all in settings, as OpenChamber carries one over from provider (toModelVariants). A config without providers.magpie doesn't get one: provider.magpie is still what magpie writes, and OpenCode 1 and 2 both read it. Taking magpie out of OpenCode or OpenChamber takes out both blocks, as OpenChamber's own delete does. agent-wiring.md says so beside #2379's variants. Old data: a config already in the reporter's state is brought up to date by the next sync, which SyncCatalog runs over every agent at each start and update of magpie. A providers.magpie an older magpie left behind when taking magpie out (it took out provider.magpie alone) is kept up to date from now on, and goes the next time magpie is taken out. Not changed: - Air: its magpie-opencode.json is magpie's own and holds provider.magpie alone. With OpenChamber's providers.magpie in the global config and nothing else of magpie's there, OpenCode 2.1.4 handed Air's file as OPENCODE_CONFIG still listed the model only Air's file had. - MiMo Code and DevEco Code go through the same code. Their configs hold no providers block unless something of theirs writes one; not checked against their source. - A provider of the user's own at magpie's gateway kept under providers isn't read by openCodeSpelled and ownGatewayProvider, which read provider alone: #3915, filed with this. - What else OpenChamber's form puts on a model of magpie's under providers (a modelID, a cost) goes with the rest of the model at the next sync, as a key on one under provider does today. What was run (tree 61b3fff7, on origin/main |
||
|
|
f37742e14d |
agent: a used-up ChatGPT account magpie can't serve past leaves the Codex app on its sign-in (xiaoq6285)
xiaoq6285 on Discord (magpie 0.1.2798, the Windows Codex app, one ChatGPT Plus account, Codex on its own model joined beside the sign-in): at the five-hour limit the app showed an error and had to be restarted, then its account menu showed only "magpie" with no quota; at the reset it restarted by itself and the account came back. Cause. When the active account was held (used up, no credits), Sync's own-model takeover made magpie Codex's provider on codex/<model> whenever magpie's catalog listed that model on any Codex account -- the same used-up one included. With one account and no fallback every turn it took over is refused on that account anyway, while the takeover: - has account/read answer no account, so the menu drops the user, Plus and the usage meter until the reset; - changes the route twice (into it, back at the reset), and KeepCodexAppOnItsProvider ends the app's app-server each time, which ChatGPT desktop 26.1027.x shows as "ChatGPT 遇到了问题" and relaunches (#4550, still open, the app's own reaction to an ended app-server). Separately, magpie's [model_providers.magpie] requires_openai_auth follows the account out and back (openaiAuth), and codexAppRoute counted it even when that table was not Codex's model_provider, so staying beside the sign-in would still have ended the app-server at the limit and at the reset. Change. - provider.CodexServesWhileOut(model): the Codex subscription has fallbacks for codex/<model> (FallbackModels), or another ChatGPT account is not known held and not lapsed. - Sync's own-model takeover runs only when that holds. Otherwise Codex stays on its sign-in: the app keeps the account, its quota and reset, and shows its own limit message. With a fallback set it moves as before ( |
||
|
|
5573f79231 |
agent: an agent's own models say they go direct, and a pick of one asks before 接入 goes off (maxleebeta)
maxleebeta in #feedback: Pi 1.5.0 connected to magpie; picking one of Pi's own OpenCode Go models (opencode-go/<model>) turned 「接入」 off at once, with nothing said, while magpie's models kept it on. The cause: the pick writes defaultProvider opencode-go, so Pi asks OpenCode Go itself and magpie is no longer in its config, and Wired() is rightly false. What was missing is that the model said so. Options from ownProvider (every ownOptions agent: Pi, OpenCode, Crush, Goose, Cline, Hermes, Morph, OpenChamber, Qoder, StepCode, plugged agents, the WSL twins) and ompOwnOptions carried no Direct, unlike Claude Code's and Codex's own models. So the picker neither tagged them "direct, not via magpie" nor asked before a pick took the agent off magpie. Each now carries Direct = its vendor's name. The GUI already does the rest (pathTag, the leave-ask, direct options listed after magpie's). Tests: - internal/agent TestOwnModelsSayTheyGoDirect: Pi, OpenCode, Crush and omp, signed in to OpenCode Go, each give every opencode-go/ option Direct "OpenCode Go"; magpie's options have none. Picking one writes defaultProvider opencode-go. - internal/gui/tests/agent-own-direct.test.cjs: the tags, magpie's first, the ask (Cancel keeps 接入 on, nothing written), magpie's other model not asked, confirmed → written and off. Run in chromium and webkit × en/zh/zh-TW/ja/de × 980/420. Run at this head (rebased on |
||
|
|
5f0a84a003 |
agent: Air in JetBrains IDEs gets magpie's Magpie agent in ~/.jetbrains/acp.json (Jumy on Discord)
Jumy asked for the "air-plugin" new in IntelliJ IDEA 2026.3 (Settings ›
AI › Air). magpie's air agent wrote the Air app's acp.json, in
~/Library/Application Support/JetBrains/Air, which the IDE plugin never
reads: the plugin (com.intellij.air, air-plugin-262.8665.521-mac-arm64
from JetBrains Marketplace) loads its custom ACP agents in
AcpConfigurationLoader (intellij.air.backend.acp.runtime) from
user.home/.jetbrains/acp.json on every system, the file AI Assistant's
custom agents use too; AgentServerConfig takes command, args, env,
use_idea_mcp and use_custom_mcp. The standalone app (Air-262.1037.14,
Fleet-based) reads acp.json from its own configs folder
(genericAcpConfigPath), so the two are separate files.
Air's own agents have no base URL: JetBrains AI, the agent's own login,
or an Anthropic, OpenAI, Gemini or OpenRouter key under AI › Air ›
Accounts. So the IDE gets the same route as the app: a new air-ide agent
("Air (JetBrains IDEs)", aliases air-plugin, air-in-ides) writes a
Magpie entry (opencode acp, OPENCODE_CONFIG naming magpie-opencode.json
beside acp.json) and nothing else; the user's agents and
default_mcp_settings stay, and disconnecting takes out that entry and
that file. air and air-ide share airAt. air-ide shows for an IDE config
folder of 2026.2 or later (the plugin is bundled from 2026.3), or with
its entry already in acp.json. Notice in en, zh, zh-TW, ja, de; README,
reference and agent-wiring rows.
Run at this head (rebased on
|
||
|
|
a8d6a861a4 |
agent: Pi's codemode gets magpie's decision and image models (extensions/magpie.ts)
wangbinyq on Discord (#feedback) asked for magpie's System One and image
models in Pi's config, since Pi's codemode can call classifier and image
models (models.classify, models.generateImages; Pi docs/models.md "Use
classifier models").
Pi's models.json can't hold them: its model entries have no type, so
every one is a chat model (ModelDefinitionSchema, modelFromJson in
provider-composer.ts, Pi 1.4.0 / c9f4c7b9f). A custom provider's
classifier and image models come from an extension alone
(docs/custom-provider.md, "Register mixed-operation models"). So while
models.json has providers.magpie, magpie now writes
extensions/magpie.ts in Pi's agent folder, which Pi loads by itself:
- provider magpie-systemone: provider.OfferedDeciders, labelled as
/v1/models labels them, on Pi's own typesafe-system-one client
(builtinProviders' typesafe .classify), which posts the TypeSafe
System One body to the gateway's /v1/systemone. Text input only.
- provider magpie-images: gateway.ImageModels (new; mediaModels with
labels, the Settings > Images default first, none while it is off),
drawn by POST /v1/images/generations with the input's images as data
URLs, b64_json back as image blocks.
Separate ids because an extension's models replace those models.json
gives the same provider id: registered as "magpie", Pi 1.4.0 listed no
chat models at all ("No models available").
The file is rewritten at each Sync and on a pick, and removed with
providers.magpie (pick of none, Disconnect, a Sync that finds it gone).
A magpie.ts whose first line isn't magpie's mark is the user's and is
never written over or removed. Pi only, not OmO or Prime Agent. On a Pi
older than its classifier models the extension returns without
registering anything. Codemode itself is not turned on: that is the
user's defaultTools.
Run at the pushed head (on mote):
- At
|
||
|
|
611ce90d15 |
agent: OpenBot, magpie's models in its model picker (jiezhengj)
OpenBot (nightly-labs/openbot, openbot.run, v0.58.0) is a new row on the
Agents page. jiezhengj on Discord asked for it: today they type magpie's
address into OpenBot by hand and add each model one at a time.
OpenBot lists the user's own OpenAI-compatible endpoints from
openbot-custom-providers-v1.json in its userData folder:
~/Library/Application Support/OpenBot, %APPDATA%\OpenBot, or
~/.config/OpenBot. Connecting adds an entry with id "magpie" pointing at
the gateway's /v1 and holding the models picked for OpenBot, with
secret null. OpenBot seals an entry's key in safeStorage, which magpie
doesn't open, so the entry has no key. OpenBot hands it to OpenCode
keyless, and the gateway accepts it as a request from this computer.
What the entry keeps to:
- OpenBot's decoders drop the whole list over one bad entry. So the entry
has at most 64 models, only ids OpenBot accepts as magpie/<id>, and a
context window only inside 1,024 to 100,000,000.
- The user's other entries stay. The name, harness and secret they give
magpie's entry in OpenBot stay too.
- A sync with nothing to change doesn't write.
- A file whose version isn't the number 1, or whose providers isn't a
list, is one OpenBot refuses itself, so magpie leaves it alone.
- Disconnect takes out magpie's entry, and the file too when only the
version and an empty list are left.
OpenBot reads the file at start, so while it runs, a notice says to
restart it. The notice is in every language.
OpenBot is detected by its userData folder, OpenBot.app
(app.openbot.desktop), or OpenBot.exe under %LOCALAPPDATA%\Programs or
%ProgramFiles%. Docs updated: agent-wiring.md, reference.md, and both
READMEs.
Run at the pushed head, on mote:
- gofmt -l: clean.
- go vet -tags nogui for internal/agent and internal/gui, and for ./...
with GOOS=linux and GOOS=windows: ok.
- go test -tags nogui -count=1 -timeout 45m on internal/agent and every
package that imports it (., backup, cli, davsync, gui, library,
profile, stats, tui, uninstall, plugins/...): ok.
- GUI: agent-notice-lang, i18n-keys, header-relang and about-notices in
Chromium and WebKit: 58 of 58 pass.
After rebasing on
|
||
|
|
7c712847b7 |
agent: Antigravity's desktop app is a row, wired through its gateway setting (ryougi_hachi on X)
Antigravity (Google's desktop app, 2.15 and later; not Antigravity IDE)
takes a gateway from ~/.antigravity/settings.json: Google's Antigravity
Enterprise Gateway, documented at
docs.cloud.google.com/gemini/enterprise/docs/ai-developer-tools/connect-enterprise-gateway.
magpie writes gateway {enabled, url: magpie's, apiKey: magpie-antigravity,
wireProtocol: openai} and models.defaultModelId, and takes out models.list
(it would narrow the picker). The user's gateway, default model and list
are stashed and put back on disconnect or when a model of their own is
picked; caCertPath and the rest of the file are untouched. Sync keeps what
the user added to magpie's block, and so does a set again (a moved port,
Reconnect). Check speaks when admin_settings.json or AGY_LLM_GATEWAY_URL
wins over the file, and when the block's url or key is no longer magpie's
(wiringOff), so drift and a port move see it. AGY_LLM_GATEWAY_URL joins
agentenv.Vars, cleared in every sandbox. Found by its bundle
(com.google.antigravity, 2.15+) or the file its backend writes
(~/.gemini/antigravity/agyhub_summaries_proto.pb); ~/.antigravity alone is
the IDE's and agy's too. The notices are translated (zh, zh-TW, ja, de).
`magpie antigravity` now names the app; agy stays `magpie agy` /
`antigravity-cli`.
Run (worktree base
|
||
|
|
cdfdb62c69 |
agent: a model field's list is joined with the catalog once while neither changed
Each agent's model field returned append(its own models,
viaMagpieShared(...)...), a copy of the whole catalog's options for
each field of each agent on every poll: Picks was 94.7 MB of 496 MB
over forty polls of the Agents page with real accounts. withVia keeps
the joined list per agent and prefix while the own models read the same
(sameOption, field by field) and the catalog's list is the very one
kept (same array), and joins it again when either changed. The list is
read only and clipped, as viaMagpieShared's is; every caller of a
field's Options reads it, Picks clones it before it drops anything.
The 52 `return append(own, viaMagpieShared(...)...)` sites call it.
omp's and Reasonix's planner edit the joined list after the append, and
Grok's writes Same into its copy, so they keep their own copies.
TestWithViaKeepsTheJoinedList: the same own models give the same array,
own models changed in a value or only an icon are joined anew, a
provider saved since is listed, and nothing joined is the catalog's own
list. TestSameOptionReadsEveryField sets each field of Option alone and
fails when sameOption doesn't see it. Broken by hand: never answering
from the kept list ("the same own models joined the catalog again"),
and FastFor left out of sameOption ("sameOption doesn't read
Option.FastFor").
Run on mote: both tests alone 3 of 3; internal/agent, internal/tui and
internal/cli ok; internal/gui red only on TestSettingsSaveKeepsWhatItDoesNotSend
(#4514) and TestMainWindowCorners (#3949); gofmt, vet and GOOS=windows
and linux vet clean. Real accounts in a sandbox HOME, forty polls:
Picks 94.7 MB -> 51.2 MB, state 190.8 MB -> 154.0 MB, state and drift
replies byte for byte the same as before. Footprint peak 136 MB.
|
||
|
|
2c33db2499 |
agent: VS Code 1.139's versioned layout hides the launcher's marker
Tony-ooo's retest (magpie 0.1.2322, VS Code 1.144.0 on Windows): the false positive of #3269 is back — bin\copilot-shim on PATH, no ~\.copilot, and magpie ls still lists Copilot CLI. The marker check |
||
|
|
68ebd1ec4a |
agent: a provider's options an agent reaches on its own are kept
Goose's model field asked ownOptions each poll, for the picker and again for Drift, and each provider's models were made into options anew (catalog.Provider, options, group, its icon): ownOptionsFrom was 21.2 MB of forty polls with real accounts. For agents without a registry of their own (native == nil), each provider's options are now kept in ownBuilt per provider.StampNow (a minute at most) and copied into the caller's list; Pi's and omp's, which read their own registries, are built as before (ownProvider is the old loop body). TestOwnOptionsKept: a catalog of 200 OpenAI models; asking again takes a fifth or less of the allocations building does, a caller's write doesn't reach what is kept, and a model the catalog lists since is offered. Run on mote at |
||
|
|
1cf66e4b17 |
agent: a tool asked on Responses says strict: false, its optional parameters stay optional (#3055)
What changed: OpenAI's Responses API takes a function tool whose strict is left out as a strict-mode one and normalizes its schema, where every property is required, so a tool's optional parameters came back filled (#3055, ArakawaHenri). pi-ai (dsh's llm-pi-ai, Pi and its kin) says strict: false on an ordinary tool only when the model's compat says supportsStrictMode, which it takes as false where the compat is left out. magpie now says it: every model of a dsh route whose api stands as openai-responses carries compat.supportsStrictMode, by the api the route has now (the one the user picked in dsh's Models page kept), not by its name, beside the keys they set there (dshKeepCompat); and piModelJSON says it for a model best served on Responses, which Pi's and StepCode's models.json carry (Pencil's entries stay on Chat throughout). omp's models.yml is left alone: omp turns a models.yml away over a field its schema doesn't name (16.3.5 over a max), so the compat needs an omp version of its own pinned first. docs/subsystems/agent-wiring.md says so. Run: new TestDshTellsAResponsesToolsStrictIsOff and TestPiTellsAResponsesToolsStrictIsOff fail without the change (the first with "a model asked on Responses isn't told strict is off: Compat:<nil>", the second with "resp/gpt-5.5 is asked on Responses and isn't told strict is off") and pass with it; removing only the dsh case turns the first red and only it, removing only the piModelJSON compat line turns the second red and only it. go test ./internal/agent/ (TestMothX fails the same with both files back at the baseline here, so not from this change), gofmt -l on the changed files (nothing), go vet ./..., GOOS=linux GOARCH=amd64 go vet -tags nogui ./..., GOOS=windows GOARCH=amd64 go vet ./..., go build . (darwin arm64), GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -tags nogui ., GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -tags nogui ., GOOS=windows GOARCH=amd64 go build -o /dev/null . Landed (yetone). Broken by hand on mote: with the dsh case and piModelJSON's compat line taken out, both new tests are red ("a model asked on Responses isn't told strict is off: … Compat:<nil>", "resp/gpt-5.5 is asked on Responses and isn't told strict is off"). Run at the pushed head: go test ./... -timeout 45m on mote with this branch on |
||
|
|
93879515a0 |
agent: QwenPaw, each of its agents' active_model one of magpie's (pkh1585 on Discord)
pkh1585 asked for QwenPaw (AgentScope, github.com/agentscope-ai/QwenPaw)
on Discord. Read in its source, 2.2.2.post1, as data:
- Its folder is QWENPAW_WORKING_DIR, else ~/.copaw when that exists (the
old name), else ~/.qwenpaw; WORKING_DIR/.env is loaded without
overriding the environment. config.json's agents.profiles lists the
agents, each with a workspace_dir whose agent.json holds active_model
{provider_id, model}, read again on each message.
- Providers are no plain config: SECRET_DIR (QWENPAW_SECRET_DIR, else
"<WORKING_DIR>.secret") holds providers/{builtin,custom}/<id>.json,
read once at start. A plain api_key there is encrypted to "ENC:" at
start, so that is the place QwenPaw itself keeps keys.
What magpie does now:
- `magpie qwenpaw <model>` and the GUI: a row per QwenPaw agent
(qwenpaw#<id>, the default one as plain qwenpaw), skipping agents whose
backend is ACP (another CLI runs those) and agents turned off.
- Connecting writes providers/custom/magpie.json (mode 600, the gateway's
/v1 and the magpie-qwenpaw key, magpie's models as extra_models with
their window, output and tool use) and sets that agent's active_model
to {magpie, <provider>/<model>}. The old active_model is stashed as it
was and put back verbatim on disconnect, absent and null included.
The provider file is removed only when no QwenPaw agent still uses it.
- A sync after QwenPaw re-saved the provider (encrypted key, discovered
models, its own defaults) keeps what QwenPaw wrote and changes only
what magpie owns, so a second connect leaves the file as it is.
- The notice says QwenPaw reads providers at start-up: restart it once
after connecting and after magpie's models change. New text in every
locale.
- appdir: QWENPAW_WORKING_DIR and QWENPAW_SECRET_DIR take ~/ as QwenPaw's
expanduser does; agentenv clears them in tests.
- README (en, zh), docs/reference.md, agent-wiring.md, the site's agent
list and start pages (en, zh, ja), icon.
Run:
- internal/agent's QwenPaw tests (Connect, AgentsAreRows, SyncKeeps-
WhatQwenPawChanged, Check, NotStartedYet, Folders, OwnModelAfter-
Magpies, SyncAfterQwenPawSaved, NullModelRestored) on mote, and the
all-agent tests (applied, rewire, lan_kept, proxy_kept, spelled) with
a QwenPaw fixture.
- Broken by hand, each red: always rewriting the key
(SyncKeepsWhatQwenPawChanged), removing the provider while another
agent uses it (AgentsAreRows), no backend filter (AgentsAreRows lists
qwenpaw#coder), dropping the keep of QwenPaw's own fields
(SyncAfterQwenPawSaved), IsObject for Exists (NullModelRestored).
- Real QwenPaw 2.2.2.post1 (Python 3.12 via uv) in a sandbox HOME on
the Linux box (WSL magpie-desktop), magpie on 3741, a fake OpenAI
upstream on 3742: first start wrote config.json and agent.json;
`magpie provider add fake …`, `magpie serve`, `magpie qwenpaw
magpie/fake/echo-1`; after a restart QwenPaw encrypted the key (ENC:)
and `qwenpaw agents chat` answered "PAWPAW-OK from the fake upstream",
its log "built agent … model=magpie/fake/echo-1"; the upstream saw
/v1/chat/completions model echo-1 streamed, magpie's usage.jsonl
agent qwenpaw status 200. A second connect and `magpie models` left
the provider file unchanged. `magpie qwenpaw default` took
active_model back out (the only diff in agent.json) and removed the
provider; QwenPaw started clean after.
- gofmt -l clean; go vet darwin, GOOS=linux and GOOS=windows -tags nogui.
- Full suite on mote (go test -tags nogui -count=1 -timeout 45m ./...)
at 9554883db on
|
||
|
|
dd7442f283 |
agent: a look at the via-magpie options shares the kept list
viaMagpie handed every caller its own copy of the options list it keeps per stamp, and a window poll asks for it from most agents' fields and pickers. In a real-account sandbox (abr.sh, 20 polls of drift, state and providers on v0.1.2463) those copies were 33.7 MB of slices.Clone, plus ~8 MB more on the way, of the 713 MB the polls allocated. viaMagpieShared returns the kept list itself, clipped, so an append makes the caller's own array. The 58 callers that only read it, or append onto it, now take it; viaMagpie (a copy) stays for the ones that change it. TestKeptListSharedWithoutACopy checks that 20 shared looks return the kept array, and that an append onto a shared look and a write into get's copy leave the kept list as it was. Run on mote at this tree: - gofmt, go vet (darwin, GOOS=windows, GOOS=linux with gateway), go build ./...: ok. - Broken by hand (shared returns slices.Clone): the test is red, "a shared look copies the kept list". - go test -count=1 ./internal/agent: ok (480s). Not run: internal/gateway and internal/gui packages on this tree. |
||
|
|
cdd470ce9f |
agent: opencode.json lists magpie's models in the order the user set
The models of magpie's provider in opencode.json were a
map[string]any, whose keys encoding/json marshals sorted: the order the
user dragged to on the Agents page reached magpieModels and died at the
last step, the file listing the models A to Z (#4575). A pure
re-ordering wasn't even written — syncJSONInOrder's sameOrder compared
two alphabetical lists and found them alike. The variants under each
model kept their order since #713 (orderedJSON); the models keep theirs
the same way now, and openCodeKept looks a model up in the ordered
block to put a variant of the user's on it.
Every config in OpenCode's shape moves with the one fix: OpenCode,
OpenChamber, Air, MiMo Code and DevEco Code (openCodeLike and the
openCodeKept calls in air.go and openchamber.go). Pi, Crush and Codex
list models in arrays and were never touched.
Run: TestOpenCodeModelsInOrder in internal/agent (written first) fails
on the unmodified code — the fresh block lands alphabetical and a
dragged order is never written — and passes with the fix. The
models-as-map assertions in TestInferredGroupImagesReachAgentCatalogs,
TestMiMoCodeCatalogNarrowedSeparately and
TestGroupModelsCarryTheirFirstMembersPrice read the ordered block now.
go test -tags nogui -count=1 ./internal/agent ok (150s) but for
TestMothX, which fails the same on unmodified main
|
||
|
|
02ff0e908f |
agent: the Codex app's route opens config.toml to see it can be read, not reads it whole
codexAppRoute runs every 3s for as long as magpie does (the Codex app's app-server watcher). It read the whole of Codex's config.toml with os.ReadFile only to learn the file could be read; the keys it uses come from filememo, which parses the file once per change. Codex keeps every project's trust level in that file, and the owner's is 1.5 MB, so this was 1.55 GB of the 33 GB a live magpie allocated in 53 minutes (heap profile: KeepCodexAppOnItsProvider → codexAppStep → os.ReadFile). It is now opened and closed: a file that can't be opened is still an unknown route, a missing one still a known one. Run on mote: - TestCodexAppRouteReadsNoWholeConfig (new): a 1.6 MB config, 10 looks allocate under 1 MB; a config with mode 0 gives no route. - Broken by hand: ReadFile put back, red (14.4 MB for 10 looks); the unreadable check dropped, red. - go test -run CodexAppRoute ./internal/agent: ok. - go test -count=1 -timeout 45m ./internal/agent ok (185.3s), at this tree rebased on 4a7d1c63a; gofmt -l clean; go vet ./internal/agent for darwin, linux and windows ok |
||
|
|
73a12e8bf6 |
wsl: a distro's agent folder that is a link is opened where it leads (#4502)
On Windows, adding a skill or switching RTK on for an agent in WSL failed with `mkdir \\wsl.localhost\<distro>\root\.codex: Cannot create a file when that file already exists` (linusxiong). In the distro ~/.codex is a link to /mnt/c/Users/<user>/.codex. Through \\wsl.localhost Windows can't follow a link the distro has: a mkdir of it says it exists, and nothing below it can be made, written, read or listed. ggbdpq found and explained the link (thanks); their patch, which takes that EEXIST as "there", wasn't used: the writes below the link fail next (its test passed because a symlink here is followed). The fix, for every agent folder and every writer through \\wsl.localhost: - The WSL probe asks `readlink -f` in the distro where each agent folder, its skills folder and the folders beside them lead (wslLinkPaths -> distro.Links; a $HOME that is itself through a link is left alone), and which drive each Windows mount is (win:/mnt/c C: -> distro.Drives). - distro.open opens a path at or below a link where it leads: on a Windows drive, the drive's own path (C:\Users\<user>\.codex); elsewhere in the distro, through \\wsl.localhost again. native spells it back through the link, so the agent is told its own path. - A link readlink couldn't resolve is never guessed at: distro.open errors, and the agent is unreached (Agent.Unreached: its notice says why; every field Set and Sync returns it). - Writers: the agents' own files (place.join/place.open, every filepath.Join(at.home, ...) in internal/agent), the library's WSL targets (wslOpen/wslOpened; one "wsl" problem per agent and nothing written), RTK (rtkAt, rtkInstall checks agent.WSLOpen before its mkdir), the Sessions page's WSL reads (sessions.WSLHome.Open) and the Copilot CLI sign-in read (provider.CopilotWSLHomes -> CopilotWSLDirs). - Not changed: magpie's image MCP server opens arbitrary paths an agent in WSL gives it the same way; filed as #4578. Links deeper than the probed paths (other than <agent dir>/skills) aren't resolved. A distro probed by an older magpie has no Links until probed again (each run). Run: - Real Windows box (xiaomi-gpu, distro magpie-desktop, sandbox /tmp/x4502/home with .codex -> /mnt/c/Users/yeton/runs/x4502-target/.codex, .claude -> /tmp/x4502/data/claude, .pi -> a missing folder), a throwaway Windows test running the real probe with that HOME: probe said link:.codex /mnt/c/..., link:.claude /tmp/x4502/data/claude, link:.pi, win:/mnt/c C:, win:/mnt/d D:. The old way, MkdirAll(\\wsl.localhost\ magpie-desktop\tmp\x4502\home\.codex\skills\pdf) = "Cannot create a file when that file already exists" (the report's error). distro.open wrote SKILL.md to C:\Users\yeton\runs\x4502-target\.codex\skills\pdf and to \\wsl.localhost\magpie-desktop\tmp\x4502\data\claude\skills\pdf, both read back with cat in the distro through the links; .pi said "~/.pi in WSL magpie-desktop is a link magpie couldn't follow". Sandbox and target removed after. - New tests with a fake distro whose ~/.codex and ~/.claude are links to /mnt/c/... that don't exist here, so, as through \\wsl.localhost, nothing below them can be made: TestWSLFolderIsALinkToC, TestWSLFolderLinkUnresolved, TestRTKWSLFolderIsALink, TestRTKWSLFolderLinkUnresolved (library); TestWSLProbeLinks (runs the probe script), TestWSLOpenThroughLinks, TestWSLAgentFolderIsALink (config and a Claude session read on C:), TestWSLAgentFolderLinkUnresolved (agent). - Broken by hand: the library tests on the base (with a no-op FakeWSLDrives) fail with "mkdir .../home/me/.codex: file exists", the report's error; with ggbdpq's patch applied they still fail (the skill mkdir, and RTK's hook not written). - mote: go build ./...; go vet of agent, library, sessions, provider for darwin, GOOS=windows (and linux for agent, library); gofmt -l clean; go test -timeout 45m ./internal/agent ./internal/library ./internal/sessions ./internal/provider: all ok. - Windows (win-run): the same four packages. The new tests pass (the RTK ones skip: the fake distro runs sh). 32 tests are red, all already red at the base |
||
|
|
70d50254cb |
codex: a change to the model list alone no longer ends the Codex app's app-server
The Codex app crashed and relaunched every few minutes (indekkusu141209 on X, #4550: 08:06, 08:12, 08:26). Cause. KeepCodexAppOnItsProvider ends the app's app-server whenever codexAppRoute changes. Since |
||
|
|
6f435677c3 |
agent: VS Code's bundled copilot launcher is not the Copilot CLI (#3269)
Tony-ooo's Windows (magpie 0.1.1320): VS Code 1.143 ships a copilot launcher of its own in <install>\bin\copilot-shim and puts it on the user's PATH, while the CLI was never installed and ~\.copilot doesn't exist. magpie ls and magpie agents still said Copilot CLI was installed, and it showed up as a Library target; renaming the shim folder away made the row go. Detected's last resort took any command of the agent's Bin name that binAt found, and cliBin (what CLI magpie offers to update) took the same launcher. An Agent may now turn away a command found for its Bin (binNot, binsOwn). Copilot CLI turns away one an editor keeps, told by the product.json beside the editor's program (editorLauncher, as vscodeCodeBinary tells an install). Ported from ggbdpq's patch on the issue. Changed from the patch: - editorLauncher resolves a symlink first and looks in bin's own folder and the two above it only. The patch walked up to the root, so a product.json in any folder above (a home, a checkout of an editor's source) turned away a real CLI under it. - BinPath and cliHeld (gone.go) go through binsOwn too. BinPath returned the shim, and cliHeld counted it as the CLI holding ~/.copilot. - The windows-tagged test is dropped: it wrote into a folder of the real registry PATH and passed without the fix. Run at the pushed head (parent |
||
|
|
fa5e86cf2b |
agents: Kimi Code and Kimi Code Desktop requests show their own name and icon, not the raw id and the cube (jiabubu)
jiabubu on Discord (magpie 0.1.2245, Windows, Kimi Code 2.4.1, Kimi Code
Desktop 1.2.1.0): the Routing page's request list drew Kimi Code's
requests as the grey cube and "kimi-code-cli", and Kimi Code Desktop's as
the cube and "kimi-code-desktop".
The request list, Usage and Sessions already take a client's name and
icon from one table, /api/state's clients (agent.Clients). The drift was
in usage.AgentOf: Kimi Code 2.x sends "kimi-code-cli/…", which matched
neither the kimi agent's "kimicli" prefix nor its "kimi-code" alias, and
Kimi Code Desktop ("kimi-code-desktop/…", its bundle's clientName) had
no entry at all, so both kept their raw product names.
- kimi's UA list takes kimi-code-cli.
- Kimi Code Desktop is a client of its own (agents.go's others). It runs
Kimi Code's engine on ~/.kimi-code, so it is set up through Kimi
Code's row. Its icon is the app's own: the 128px entry of build/icon.ico
in KimiCode-1.2.1-win-x64.exe, the installer winget's
MoonshotAI.KimiCodeDesktop 1.2.1 points to on code.kimi.com (sha256
75111cb6…c312, as the manifest says). Nothing was drawn by hand.
- app.js's pngIcons names it (comment shortened, app.js 5 bytes smaller,
budget untouched); app.css's tile rule names it, as icon-tile measures
it solid to its edges.
- Old records re-resolve through AgentOf, so earlier kimi-code-cli
requests read as Kimi Code too.
Guard: TestEveryClientHasNameAndIcon checks that every client has a
name and an icon file app.js's icon() really loads (a PNG only if
pngIcons names it), and that the ids the gateway records by more than a
User-Agent (claude-desktop, claude-science, cursor-local, codex, magpie)
and kimi / kimi-code-desktop are all clients. The cube is allowed only
for the six clients with no logo yet (ante, pencil, openpencil, newmax,
kirocrew, raft), filed as #4487. routing-client-icons.test.cjs draws the
request list from a history fixture and checks names, data-icon, and that
the desktop PNG loads.
Run (mote unless said):
- Red on the old code: TestAgentOf (got "kimi-code-cli" want "kimi"),
TestEveryClientHasNameAndIcon (kimi-code-desktop not among the
clients); routing-client-icons in Chromium on the old app.js
(0/2, the desktop row is the cube).
- Broken by hand: pngIcons without the entry makes the guard fail ("a PNG
app.js's pngIcons doesn't name, so it is drawn as the cube").
- go test ./internal/agent ./internal/usage ./internal/usageapi: ok.
./internal/gui: ok except the ten real-window AppKit tests killed at
their deadline on mote (#4125, #2645). ok with those skipped, after
the rebase.
- go vet (darwin), GOOS=linux -tags nogui and GOOS=windows vet of
internal/agent and internal/gui: ok. gofmt -l: nothing.
- routing-client-icons: Chromium 2/2 on mote, WebKit 2/2 on Linux
(wsl-run; WebKit launch hangs on mote, #4125).
- routing-*, i18n-keys, icon-tile, mono-icon-redraw and
models-add-and-icons in Chromium on mote and WebKit on Linux: i18n-keys
green. icon-tile caught the missing tile entry (fixed here). The other
Routing reds are still being compared against a fresh origin/main copy
in both engines (running at push time). Any that turns out to be ours
gets a follow-up commit.
Not tried: a real Kimi Code 2.4.1 or Kimi Code Desktop 1.2.1 against
magpie (the UA strings come from their bundles: appName kimi-code-cli,
clientName kimi-code-desktop). Only the Windows installer's icon was
read; the macOS app's wasn't compared. Full Go suite to follow the tag.
|
||
|
|
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
|
||
|
|
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 |
||
|
|
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).
|
||
|
|
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 |
||
|
|
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 |
||
|
|
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
|
||
|
|
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
|
||
|
|
f25871cddc |
agent: the Codex app's route is read from one look at Codex's config (#1665)
KeepCodexAppOnItsProvider asks codexAppRoute every 3s for as long as
magpie runs, and it read config.toml's keys one getter at a time, each a
look at the disk: 42 looks in 25s on Windows, where an antivirus works on
each. It now holds what it read (filememo.Hold) for the call, so each
tick looks once, and its keys come from one version of the file.
Measured on xiaomi-gpu (Windows 11), an empty sandbox HOME, magpie web
--gateway, second start, 27s, counting looks with an uncommitted build,
with the warm-up's hold (
|
||
|
|
f6ed2c99bc |
effort: a vendor's light and extra_high are low and xhigh, in dsh, Pi and the gateway
nianshou5 (Discord) runs Trae's DeepSeek V4.1 Flash through the Our Free Model plugin (github:mu-zi-lee/magpie-our-free-model). Its variants are Trae's own names, light, high and extra_high, and dsh offered only default and high: dshModelLevels (and Pi's piThinkingLevels) matched a model's efforts to pi-ai's level names only, so light and extra_high were dropped. The gateway dropped them too: effortOf read "light" as no effort, and NearestEffort fitted an agent's low or xhigh to the plugin's high. catalog.EffortAliases names light as low and extra_high as xhigh (EffortLevel). NearestEffort places a model's levels by the level they name and returns the model's own word; the gateway's effortOf reads an alias as its level. dsh's reasoningEfforts and Pi's thinkingLevelMap map dsh's low/xhigh to the model's own word (modelEffort), which llm-pi-ai sends on the wire as written (resolveModelReasoning in dsh-llm-pi-ai reads each value as "the spelling dispatch sends"). Levels a user kept are untouched: only the names a model lists are mapped. Tests: TestDshOffersTraeNamedLevels (agent), TestNearestEffortTakesVendorWords (catalog), TestPluginThinkingOff's new fake-trae subtests (gateway, a real plugin host with the fake plugin listing light/high/extra_high). Broken by hand: modelEffort without the alias, dsh levels [high] (the report's picker); NearestEffort without EffortLevel, low/xhigh sent as high; effortOf without the alias, light/extra_high sent as nothing. Run on mote at this tree (base |
||
|
|
6d24d4f4ea |
agent: a hung wsl.exe no longer holds every Windows command 20s
On a Windows box whose wsl.exe hangs (`wsl -l` there never answered), every magpie command took ~20s, `magpie version` too. A goroutine dump taken 8s in showed start-up's moves (RenameLegacy, then the Cursor and Antigravity effort moves) walking All(), whose WSL agents list the distros: `wsl -l -q` waited out its 10s timeout, then `wsl -l --running -q` waited out another. `magpie providers` waited too, through Copilot's sign-in looked for in each distro's home. - Start-up's moves look at this machine's agents only (local()). They came before WSL agents (the dial rename 09-23, the effort moves 09-28, the day WSL Codex came), so a distro has nothing for them. - A listing that failed isn't followed by the running list: no distro was listed, so none runs. That was a second timeout under wsl's lock, which the GUI waits on. - A listing that hung (failed after 5s or more) is remembered in wsl-hung beside magpie's settings for 10 minutes: a new process doesn't list again in that time, and a listing that answers removes it. A process that runs on (the GUI) lists again each minute as before. Real run on the Windows box (10.0.0.132), wsl.exe hung, sandbox USERPROFILE, old build (main |
||
|
|
ca8a6f346a |
agent: a renamed routing group moves its agents, and the Codex app reloads a changed catalog
lucis0116 on X: renaming a provider or a group in magpie didn't reach
every agent.
Display names already reached the agents' files: store and SaveGroup
drop the catalog, and SyncCatalog writes the new "<model> · <name>" and
"<group> · routing group" labels into Codex's model_catalog_json, Claude
Code's picker, OpenCode and Pi (checked in a sandbox HOME). Two gaps
were left:
- A routing group given another id (Routing page, `magpie groups
rename`, TUI) left every agent on group/<old>, which magpie no longer
has. The CLI even said "agents set to group/from need group/to now".
agent.RenameGroup now moves each agent field on group/<old> to
group/<new>, spelled as the agent spells it. It goes through
renameRefs, the move RenameProvider already made, now shared by both,
then SyncCatalog. The GUI, CLI and TUI call it in place of
provider.RenameGroup.
- The Codex app's own app-server reads model_catalog_json only as it
starts, and KeepCodexAppOnItsProvider restarts it only when
codexAppRoute changes. The route named the catalog's path, not what
the file holds, so a renamed provider or group, or a model added,
stayed on the old list until the user quit the app. The route now
carries a hash of the catalog's bytes (codexCatalogTag, read again
only when the file's size or time changes). The restart goes through
the existing idle gate: no Codex request in flight, 10s idle, no turn
open. A write of the same bytes is no change.
Run, in a sandbox HOME only:
- TestRenameGroupMovesTheAgentsOnIt (new): Codex, Claude Code, OpenCode
and Pi on group/smart, renamed to clever: each said moved and each
file on group/clever, none naming group/smart.
- TestCodexAppRouteFollowsTheCatalog (new): the route changes when a
renamed provider rewrites the catalog, and stays put when the same
bytes are written again.
- Broken by hand: RenameGroup's match turned off makes the first test
red (no agent moved, every file on group/smart). The catalog line
dropped from codexAppRoute makes the second red ("a provider renamed
left the Codex app's route as it was").
- At aded9beea (base
|
||
|
|
df83749218 |
codex: Disconnect and Connect restart the Codex app's own app-server, so the app stops sending to magpie without a restart
JiangLiuer222 on X: after Disconnect the Codex app kept sending to 127.0.0.1:3425, now and then. The app's app-server reads config.toml only as it starts, so one started while Codex was connected kept the gateway's base URL until the user quit the app. Now the gateway's watcher (KeepCodexAppOnItsProvider, from |
||
|
|
8b0132b3d2 |
codex: the Codex app sends again on every system as soon as magpie takes a used-up ChatGPT account over, and gets it back at the reset
Ethereal499 and Isdavexxx on X, MasterYi on Discord, #540. The Codex app greys Send for every model, magpie's too, while the ChatGPT account it is signed in to is used up. Its composer's gate (ChatGPT.app 26.1013) reads authMethod "chatgpt" plus rate limit allowed=false, and it asks account/read only when its app-server starts. |
||
|
|
e7173958e9 |
agent: NewMax, magpie's models in its model picker (jwaitq on Discord)
jwaitq asked in #general (10-27) for NewMax (newmax.cc), an Electron app
built on the Claude Agent SDK. NewMax keeps its settings in
~/.newmax/newmax.db ($NEWMAX_USER_DATA_DIR wins), a SQLite table
settings(key, value) whose "app" row is JSON.stringify of every setting.
Connect adds one Anthropic-format provider, id magpie-gateway, with
magpie's gateway root (NewMax adds /v1/messages itself), its key and up to
20 models (NewMax's MAX_MODELS), appends it to providerOrder and, when
the user had kept NewMax's default, picks it. The row is edited by
splicing raw JSON in one immediate transaction, so every other byte the
user has stays as written. Disconnect removes the entry and its order id,
puts providerId/model back to "default" when they were magpie's, and
deletes the row when magpie made it. NewMax holds settings in memory and
writes the whole row on any change, so magpie refuses to write while
NewMax runs (macOS/Linux, matched on the program, not on a folder named
newmax) and says why in every language.
Run:
- go test -tags nogui -count=1 -timeout 45m ./internal/agent
./internal/agentenv ./internal/appdir ./internal/sessions at this head
(rebased on
|
||
|
|
3fd7e16983 |
agent: PenguinHarness is installed from the Agents page and served by magpie with nothing to set up
rankyurky asked on Discord #feedback for PenguinHarness (npm @prismshadow/penguin-cli, command penguin). Every value comes from Penguin's own source (0.2.17): - Config: $PENGUIN_HOME (else ~/.penguin/data, every OS) / $PENGUIN_PROJECT_ID (else default_project) /.project_config.toml. magpie writes [providers.magpie] (base_url, client_type, api_key), one [[models]] entry per magpie model (context_window, vision, max_tokens, [models.pricing] in usd_per_mtok) and default_model in Penguin's own inline spelling. Penguin's server reads the file again when its mtime changes, so no restart; a default naming no entry is refused by Penguin, so Check fails when one is missing. - A file magpie creates is 0600 in a 0700 folder, as Penguin keeps it. Disconnect restores the user's own default_model (or none), drops a magpie vision model, and removes the file when magpie made it. Penguin's own entries, providers and command_policy rules are kept. - A sync that changes nothing writes nothing (bytes and mtime kept), so Penguin's watcher isn't woken. - Install: curl -fsSL https://penguin.ooo/install.sh | sh, or irm https://penguin.ooo/install.ps1 | iex on Windows; update: npm, or penguin update --yes for the tarball, except on Windows where update.ts refuses it. - WSL: a penguin kind with no restart notice; the WSL test now expects an empty Notice for a kind with no restart. - agentenv: PENGUIN_HOME, PENGUIN_PROJECT_ID; the project id is in NotPaths, or appdir dropped a value like "work" as a relative path. - edit.SetTOMLArrayTables: replaces every [[name]] entry with key = value (with child tables) by blocks, or removes them; blank lines between replaced entries go with them, and an unchanged result isn't written. - GUI: penguin-color.svg icon; README (en, zh-CN), docs/reference.md and docs/subsystems/agent-wiring.md. Run (worktree at |
||
|
|
b30734f964 |
sessions: Antigravity CLI (agy) conversations are listed, with title, folder, tokens and resume (RickyWei, #1718)
agy's conversations were on no Sessions page: internal/sessions had no lister for them, only the calls reader of #2097. Now each ~/.gemini/antigravity-cli/brain/<id>/.system_generated/logs/transcript_full.jsonl is a session (agy.go). Its steps give the start and last times, the first prompt (taken out of agy's <USER_REQUEST> wrapper), prompts, replies, tool calls, and tokens under the model "agy", since no step names one. A step written again replaces its tokens, read on or read whole. The title and folder come from the conversation's conversation_summaries.db row: title, and workspace_uris through agyFolder, which turns file:///C:/... and file:///c%3A/... into C:\... and a host into \\host\share on Windows. agy writes the title after the transcript, so the row is the file's rev. The database is read again only when it or its -wal changed, and a failed read keeps the rows read before. A row with conversations/<id>.db and no transcript (#1718's case) is listed from the row alone, with no tokens and no conversation to open. Resume is "agy --conversation <id>". When agy is set to use magpie, it is the agent's launch command (gateway variables and --model, the PowerShell form on Windows) with --conversation after it, through sessions.AgyStart, which package agent sets. The transcript (user text, thinking, text, tool calls, tool results) can be opened and searched. Format read from real files: agy 1.3.5 and 1.4.7 in a sandbox HOME against a fake Gemini endpoint, with plain replies, a read_file tool call with thinking, invalid tool calls, and a conversation picked up again with --conversation from another folder. testdata/agy-sessions is three of those conversations with paths rewritten to /work. Resume tried for real in the sandbox: `agy --conversation <id> -p again` from another folder appended steps 2-4 to the same transcript and kept the row's folder. Interactive `agy --conversation <id>` (in tmux) showed the earlier turns. Run at this tree, rebased on origin/main: - gofmt -l internal clean - go vet: darwin; GOOS=linux -tags nogui; GOOS=windows - GOOS=windows go build ./...; GOOS=linux go build -tags nogui ./... - go test -count=1 ./internal/sessions ./internal/gui ./internal/agent: ok before the row-only change. After it, sessions ok, and gui had one red, TestMainWindowCorners killed at its 40s deadline at load ~300 (#1936). It passes alone (47s). - GUI (playwright 1.62.0, chromium and webkit, en and zh): i18n-keys, gui-de, gui-ja, gui-zh-tw, session-terminal, sessions-bar-names, sessions-manage, sessions-talk, sessions-toolbar: 49 of 49. No GUI asset changed. Tab names come from the agent registry. Fails without the change (broken by hand, each one red): - agyFiles out of allFiles: TestAgySessions, TestAgyTitleLater, TestAgyTranscript - agy out of refresh's DBRevision check: TestAgyTitleLater - no dropUse of a rewritten step: TestAgyGrows (4510 input, want 3010) - AgyStart ignored: TestAgySessions (wired resume) - drive letter not handled: TestAgyFolder - agy out of HasTranscript: TestAgySessions, TestAgyTranscript - the row-only listing off: TestAgyRowOnly; readable() off: TestAgyRowOnly Not tried: agy on Windows. The Windows box (10.0.0.132) didn't answer ssh, so the Windows paths are covered by unit tests only (agyFolder, the Set-Location resume form). A wired resume through magpie's real gateway was not tried. Not done: subagents (parent_conversation_id), which I never saw agy write. The model name, which is only in conversations/<id>.db's protobuf (#3147). Deleting an agy session from magpie. agy in WSL: #3595. Side effect: agy's self-updater ran in the sandbox and replaced the live ~/.local/bin/agy, 1.3.5 -> 1.4.7. |