1e654d8ce fixed T3 Code's sync, which rewrote magpie's provider instance
whole. The same shape lost user-set keys in eight more agents. On every
Sync and every pick, each one rewrote magpie's own block in the agent's
config whole. Each app's schema was taken from its own source, never
guessed:
- Qoder 1.1.70 (@qoder-ai/qodercli bundle): providers.magpie lost routing
(the compact and subagent models), firstPayloadTimeoutMs,
streamIdleTimeoutMs, type, authType, anthropic and a displayName.
- fx (vercel-labs/fx configured_provider.zig): reviewer_model was lost,
and a tool_choice_mode of "omit" went back to "send". auth stays
magpie's whole, since fx refuses an env beside type none.
- Hermes (hermes_cli/config_providers.py): `hermes model` itself writes
default_model into providers.magpie. That was lost, as were key_cmd,
the timeouts, extra_body, a name and extra headers. This held in every
profile spread() writes.
- omp (models-config-schema-bundle.ts): modelOverrides, discovery,
disableStrictTools, headers and compat flags were lost. auth and
apiKey stay magpie's, or go, so a loopback's auth: none never sits
beside a WSL key.
- Kimi Code (configSection.ts ProviderConfig): SetTOMLTable replaced
[providers.magpie], losing inline custom_headers, env and
default_model. Its three keys are now set in place.
- Cline (local-provider-registry.ts): models.json lost the provider's
other keys, and the per-model overrides that the VS Code model editor
writes. A model magpie no longer lists still goes.
- Goose (declarative.rs): the custom provider file was rewritten whole,
losing display_name, timeout_seconds, toolshim, other headers and the
like. Goose's own editor carries those keys over.
- ZCode (provider-data-schema.ts, strict): the provider rule lost
providerName, logo, visibility, api.headers and
access.apiKeyManagementUrl. Only keys already in the file, which ZCode
accepted, are kept.
Each merge lays magpie's block over what is there. magpie's parts (the
address, the key, the format and the model list) are named, and a key
magpie stops writing goes with them. The JSON ones use theirsKept or
mergeKept. A new yamlKept does the same for Hermes and omp.
agent-wiring.md lists what each one keeps.
Tests: Test{Qoder,Fx,Hermes,Omp,Kimi,Cline,Goose,ZCode}KeepsTheUsersSettings.
Each one:
- connects;
- sets the user's keys the way the app writes them, plus a stale
address and a stale model;
- adds a provider, then syncs 3 times and picks again;
- checks that the user's keys stay, that magpie's parts are rewritten,
and that the stale model is gone.
All eight fail on origin/main's agent code (each reports "the user's
settings not kept") and pass with this change.
Run, in a sandbox HOME, with GOCACHE in the scratchpad and Go 1.26.8:
- gofmt -l on the changed files: clean.
- go vet ./... (darwin), GOOS=linux go vet -tags nogui ./... and
GOOS=windows go vet ./...: clean.
- go test -tags nogui -timeout 45m ./internal/agent: ok, 805s.
- go test -tags nogui -timeout 45m ./...: all ok.
Not tried: none of these apps was run against a real config written by
this change. Their schemas come from their source (Qoder's npm bundle,
fx, Hermes, oh-my-pi, kimi-code, cline, goose and ZCode at their current
heads), not from a live install.
What changed: ZCode 3.14 has a 数据存储路径 (data storage path) setting.
Changing it copies ~/.zcode/v2 to <folder>/.zcode/v2, and from the next
start ZCode reads its providers (provider_config.json, config.json),
credentials.json and runtime/provider from there. The choice stays in the
home folder's .zcode/v2/setting.json as dataBaseDir, which ZCode's main
process reads first (readBootstrapDataBaseDirFromDisk, then setDataBaseDir;
getDataBaseDir is that, else ZCODE_DATA_BASE_DIR, else HOME). magpie always
wrote ~/.zcode/v2, so for such a user it said ZCode was connected while
ZCode's 模型设置 showed only BigModel and Start Plan and no magpie.
appdir.ZCodeDataIn reads dataBaseDir the way ZCode does (trimmed, ignored
when empty or relative); the ZCode agent target, the ZCode subscription's
credentials.json and its zcode-builtin.json glob use it. Skills, AGENTS.md
and the CLI's cli/config.json stay under the home folder: ZCode reads
those from HOME/USERPROFILE (getUserZcodeSkillRoot, the MCP config path),
so internal/library is unchanged. ZCode's session database
(internal/sessions) is not changed here: where ZCode's CLI keeps it under a
moved folder was not checked.
Read from ZCode 3.14.3's app.asar (copied to the scratchpad):
out/main/index.js (bootstrap, setDataBaseDir, buildHostProcessEnv passing
ZCODE_DATA_BASE_DIR), out/host/chunk-*.js (getAppConfigDir =
<base>/.zcode/v2) and out/host/index.js (provider_config.json under it).
flower hasn't said they moved the folder; this is the one way found in
ZCode's code for "magpie says connected, ZCode has no magpie" with a
provider_config.json magpie wrote. That file, and the one this build
writes, decode with ZCode's own decodeProviderConfigFile (run from a copy
of glm/zcode.cjs): providers ["magpie"].
What was run:
- TestZCodeMovedDataFolder (new): with dataBaseDir set, Set("magpie")
writes both files under the moved folder and none in ~/.zcode/v2; an
empty, blank or relative dataBaseDir keeps ~/.zcode. On the old
zcode.go it fails: "no magpie in the moved folder's
provider_config.json".
- Sandbox, built binary: HOME=<sandbox>, setting.json dataBaseDir=<sandbox>/D,
`magpie zcode magpie` wrote D/.zcode/v2/{config,provider_config}.json
and nothing under the home folder's .zcode/v2 but setting.json.
- go test -tags nogui ./internal/agent ./internal/appdir ./internal/provider
under a temp HOME; gofmt -l; GOOS=linux and GOOS=windows go vet -tags
nogui on the three packages.
- Not run: the ZCode app itself with a moved folder (not launched against
any config), and Windows.
The gateway takes gateway.Token, and the keys that name an agent
(gateway.TokenFor), only from loopback. When MAGPIE_ADDR pins the
gateway to an address beyond loopback and sharing is on, keyAt gives the
LAN sharing key, and most writers use it. T3 Code's instance still wrote
gateway.Token, so every call it made got 401. Air's and OpenChamber's
Checks compared against gateway.Token, so they said the wiring Sync had
just written was off.
The same mistake was in every writer that pairs gateway.URL() or
gatewayV1() with a fixed token:
- agy, Alma, Cindy, Claude Desktop, Copilot for JetBrains, Cursor's
local agent, OpenHanako, Pencil, VS Code / Insiders / VSCodium,
WorkBuddy-family models.json, ZCode (both files), Zed's credential,
Aside's provider, and the legacy Claude token rename.
- Fix: these now take agentKey(agent) or hereKey(), which are keyAt and
agentKeyAt for gateway.URL(). On loopback they are unchanged.
- Alma re-keys a provider that holds any of magpie's keys other than the
one it should have now.
- WorkBuddy and Aside also count the new key as theirs.
- ZCode treats a saved address equal to the pinned gateway as this
machine's, not another magpie's.
What was run:
- New tests: TestT3CodeKeyBeyondLoopback and
TestAirAndOpenChamberChecksTakeTheKeyForTheGateway (from the
reporter's patch), and TestPinnedGatewayKeyForEveryWriter, which covers
the other writers.
- With the product files reverted, all three are red. The T3 token reads
"magpie", and each of the 11 writers shows its old key. They are green
with the fix.
- go test -tags nogui ./internal/agent/ is green.
- gofmt -l and go vet are clean on darwin, linux and windows.
Not tried with a real T3 Code, Air, OpenChamber or a real pinned
MAGPIE_ADDR on a second machine.
settings.hiddenModels had no "zcode", and ZCode's ~/.zcode/v2/config.json
and provider_config.json listed every model. The files magpie writes for
ZCode already leave out what is hidden for it (magpieModels(id) reads
provider.CatalogFor), but its row had no list to hide one in: ZCode's only
field puts magpie in its own picker, with no option among the catalog, and
the Agents page gives a models line and menu only to an agent that has
one (takesCatalog) or ListsModels (Cursor Private Inference).
Audit of every agent row: each agent with a field among the catalog
(viaMagpie) already had the list. Those whose only field puts magpie's
models in their own picker had none: zcode, pencil, t3code, workbuddy,
workbuddy-ai and copilot-jetbrains. They now set ListsModels; Claude
Desktop's tier pickers list the catalog once connected, and cursor-local
had it already.
- agent: ListsModels on those six, its doc says when it applies.
- gui/api.go: the row's JSON says menu (ListsModels), so app.js gives it
the models button as it does Claude Desktop's and Cursor's, rather than
a hard-coded set of ids.
Tests:
- TestEveryPickerOfMagpiesModelsCanBeNarrowed: any built-in agent that
puts magpie in a picker with no option among the catalog and no
ListsModels fails, so a new agent can't miss it.
- TestZCodeListsOnlyThePicked: from a config the user edited by hand (own
providers, theme, rules, a manual rule for one of magpie's models, ui
lang), hiding one model takes it out of both files at the next sync and
showing it puts it back; the user's entries stay at every step.
- TestZCodeModelList: through the GUI handlers: connect, the row has
menu and 2/2, hide one, settings.hiddenModels.zcode is set, the row
reads 1/2, and after SyncCatalog both files list only the other.
- tests/zcode-models.test.cjs: ZCode's row in en, zh, zh-TW, ja, de, in
the window (1100px) and the tray panel (420px), Chromium and WebKit:
the line, the menu button, unticking one posts it and the count drops,
ticking it back; no scroll, no <select>, no overflow. 20/20.
Without ZCode's ListsModels, the first and third fail (tried); without
a.menu in app.js, all 20 GUI cases fail (tried). All in a sandbox HOME;
the live ~/.zcode was never touched.
Run: go test -tags nogui ./internal/agent ./internal/gui; gofmt -l;
GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent
./internal/gui; node --test on zcode-models, agent-model*, agent-models-*,
agent-notice-lang, click-scroll, cursor-local-*, gui-de/ja/zh-tw and
i18n-keys, both engines: all pass (three load timeouts under a machine
load of ~140 passed rerun alone).
go test -tags nogui -timeout 40m ./... on the rebased tree: every package
ok but internal/gateway, whose TestQueuedStreamKeptAliveForTheMinute hit
its 1.5s read deadline at a machine load of ~130; it passes -count=3 run
alone, and this change touches nothing it runs.
A Chinese window said "ZCode 已接入 magpie. ZCode reads its providers at
start-up — restart ZCode …": the notice an agent gives after a change
(state.notice) was English text written in place in each agent's file, and
i18n.js had no entry for any of them.
What changed:
- internal/agent/notice.go: a notice is a template registered with
newNotice ("Restart {agent} to …"), filled with say(kv...); Notices()
lists every one. All the agents' notices (claude, codex daemon, zcode,
agy, cursor-local, wsl, AstrBot's added today, …) are now such templates, the issue's list
being a sample of them.
- i18n.js: every template has a zh, zh-TW, ja and de translation, and
NOTICES lists them. tNotice() reads a notice of several joined: longest
template first, a {slot} never runs over a sentence's end, and a notice
with any part that has no template (a plugin's own) reads as given
rather than half in each language. withNotice() joins the status line
and the notice with 。 in zh/ja.
- app.js: the six places that showed state.notice use withNotice.
Tests:
- TestEveryNoticeIsTranslated: every Notices() template is in NOTICES and
in each language table, with the same slots. Fails with the zh ZCode
line deleted from i18n.js (tried).
- TestNoticesAreTemplates: an AST scan for English written in place as a
Notice. Fails with zcode.go's literal put back (tried).
- tests/agent-notice-lang.test.cjs: every template, filled, alone and
joined, plus a plugin's notice, and connecting ZCode as the reporter
did; en, zh, zh-TW, ja, de at 1100 and 420px, Chromium and WebKit:
22/22. Its zh subtests fail without the zh line.
Run: go test -tags nogui ./internal/agent ./internal/gui; gofmt -l;
GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent
./internal/gui; the full GUI suite (node --test, both engines, -concurrency 6,
machine load ~140): 5130/5195, 64 failing in 22 files. Rerun alone, 16
files pass; mobile-web, old-webkit, panel-usage and routing-context/
group/keys-fold fail the same on the base commit, b6a263b9.
go test -tags nogui -timeout 40m ./... on the rebased tree: every package
ok but internal/gateway, whose TestQueuedStreamKeptAliveForTheMinute hit
its 1.5s read deadline at a machine load of ~130; it passes -count=3 run
alone, and this change touches nothing it runs.
What changed: zcodeRules wrote api.type "anthropic-messages" into
provider_config.json, and zcodeProviderJSON wrote kind "anthropic" into
config.json, on every sync (magpie's start, any catalog change). A user who
switched the provider to OpenAI Chat Completions or Responses in ZCode had it
switched back the next time magpie started. zcodeFormat now reads the format
already there and keeps it, in both files: provider_config.json's api.type
(ZCode 3.14 on) or config.json's kind (older ZCode), the one written last
where they differ, mapped as ZCode maps them (anthropic-messages/anthropic,
openai-chat-completions/openai-compatible, openai-responses/openai). A new
provider, or a format ZCode doesn't have, is Anthropic Messages as before.
Why it's safe: magpie's gateway answers all three at the same base address.
Checked with ZCode 0.16.9's own agent CLI (glm/zcode.cjs -p, run from a
copy under a sandbox HOME, never ~/.zcode) against a sandbox gateway with
the DeepSeek provider: anthropic-messages asks /v1/messages,
openai-chat-completions /chat/completions, openai-responses /responses, and
a tool-using turn (Read a.txt) answered 200 on each, to deepseek-flash.
What was run:
- TestZCodeKeepsUserFormat (new): a format picked in provider_config.json,
for each of the three, survives two syncs and is carried to config.json's
kind; one picked in config.json is carried to provider_config.json; an
unknown one isn't kept. On the old zcode.go it fails: "picked
openai-chat-completions: kind "anthropic", api "anthropic-messages"".
- Sandbox, real binaries: provider_config.json set to openai-responses,
then `magpie zcode magpie`: the old build wrote anthropic-messages back,
this one kept openai-responses (config.json kind openai). Then
openai-chat-completions, resynced, and the real ZCode CLI ran a turn on the
file magpie wrote, served over /chat/completions.
- gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent;
go test -tags nogui ./internal/agent under a temp HOME: ok.
The "bcww: Field required" 400 on Anthropic Messages is not part of this
commit: ZCode's real requests (captured from its CLI, plain and with web
search) to deepseek/deepseek-flash through magpie returned 200, and DeepSeek
answers schema errors in serde's words, not "Field required".
WorkBuddy's Settings > Models saves an edited custom model whole into
~/.workbuddy/models.json: reasoning.defaultEffort (absent for its Auto), and
the vendor of the provider it matches, which for magpie's entries is the
"Custom" provider's (WorkBuddy 5.x app.asar: inferProviderIdFromLocalCustomModel,
the form's save in ui-docs-viewer). buddyWrite knew its entries by vendor
"magpie" only, so a sync kept the edited entry as the user's and added
magpie's own with the same id and magpie's default effort; one set by hand
under vendor magpie was simply rewritten.
buddyWrite (WorkBuddy and CodeBuddy Code) now also knows magpie's entries by
their key (magpie-<agent>, or a NAS magpie's key already on its entries),
and keeps each model's defaultEffort (or the older reasoning.effort) while
the model still offers that level; WorkBuddy's Auto stays Auto. A new model
gets magpie's default; a model magpie no longer has is taken out, the edited
one included. The same rule (keptEffort) keeps a hand-set default in ZCode's
config.json (defaultVariant), Kimi Code's config.toml (default_effort) and
MiniMax Code's config.yaml (thinking.defaultEffort), which a sync rewrote too.
The composer's own effort pick is WorkBuddy's localStorage
(cb-effort:by-model), which magpie never touched.
Verified: kept_effort_test.go (TestWorkBuddy/CodeBuddy/ZCode/Kimi/MiniMax
KeepsTheUsersDefault*) fail on the old writers, WorkBuddy's with
"think/wide twice" and the rest with magpie's default back; pass with this,
-race -count=3. go test -tags nogui ./... green under a temp HOME; go vet,
GOOS=linux and GOOS=windows builds. Not tried in the real WorkBuddy app: the
fixture follows its save code, not a file it wrote.