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 e056779a, the same provider under each spelling:
provider: pick -> magpie-relay/relay/glm-4.6, no provider.magpie
providers: pick -> magpie/relay/glm-4.6, provider.magpie added
provider: Spelled=true Models=[relay/glm-4.6]
providers: Spelled=false Models=[]
Both now read a provider under providers as OpenCode 2 reads it: the
base URL from settings.baseURL (openCodeBaseURL), and a name under both
is the one under providers. They serve OpenCode, OpenChamber's pickers
on OpenCode's config, MiMo Code and DevEco Code; a config without
providers, as OpenCode 1 and the forks on it write, is read as before.
This changes what magpie reads, not what it writes, so there is no old
data to bring up. agent-wiring.md says so beside DevEco Code.
What was run (tree 77e2237e, on origin/main 2b038757, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
- TestOpenCodeKeepsItsOwnGatewayProvidersUnderProviders, new: a pick
of magpie/relay/glm-4.6 with the user's magpie-relay under providers
is written as magpie-relay/relay/glm-4.6 with no provider.magpie; a
model on relay under providers at the gateway is in Models; with
relay under both, the one under providers is read, for Models and
for a pick: ok
- broken by hand, one at a time, with
TestOpenCodeKeepsItsOwnGatewayProviders (the same under provider)
green under each:
- openCodeSpelled reading provider only, as on main: red, "models =
[]"
- ownGatewayProvider reading provider only, as on main: red, "model
= "magpie/relay/glm-4.6""
- the one under provider read over the one under providers, in
openCodeBaseURL: red, "the provider under provider read over the
one under providers: [relay/glm-4.6]"; in ownGatewayProvider: red,
"picked on the provider under provider: model =
"mine/relay/glm-4.6""
- the 26 internal/agent tests matching OpenCode, OpenChamber, MiMo,
DevEco or Spelled: ok
- OpenCode 2.1.4 itself (opencode models, sandbox HOME): with
magpie-relay under providers as the test writes it, it lists
magpie-relay/relay/glm-4.6; with relay under both, it logs "retained
native value over legacy value" for $.providers.relay and lists only
the models under providers (a model only under provider is gone)
- go test -tags nogui -count=1 -timeout 45m ./... (log kept), Bun
1.4.2: 68 packages ok and 8 red, none in what this changes; in
internal/agent every test this adds or touches passes. The reds: agent
TestFolderVarsAreListed (#3884, fixed on main since in 3116b8f5),
TestCodexDriftReached (#3398), TestInstalledVersion,
TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI and
TestOmpDetectedWithPiDir (#3141),
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout (#3641); edit
TestWriteAtomicReadOnlyHardLink and testenv TestProgram (umask 077,
#3640); gateway TestPluginToldWhereTheAgentWorks (#3675); gui
TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie
(#3649); proc TestEnvOfChild and provider TestCodexAppServersOnHome
(#3906), then "close of synctest channel from outside bubble" from
TestUnreadLoginsWriteErrorsKeepCredentials (#3632); tui
TestTUIFetchesSubscriptionModels/agent (#3919).
- gofmt -l clean. go vet -tags nogui and go build -tags nogui for linux,
windows and darwin, and go vet and go build for windows without the
tag: exit 0 each. go vet and go build without the tag on linux: exit 1
(this box has no GTK or WebKitGTK dev packages).
Not tried: OpenChamber's app itself, a request sent through such a
provider, Windows and macOS.
Batch run, at tree 104d75f0a (the twelve coffemon ports together, on
origin/main 7d022bdb6), mote, macOS, go1.26.8:
- go test -tags nogui -count=1 -timeout 45m on the packages the batch
changes (agent, autostart, daemon, gateway, library, proc, provider,
sessions, testenv, tui, gui): ok each.
- GUI, node --test with Playwright 1.62.0, Chromium and WebKit:
library-*.test.cjs and i18n-keys.test.cjs, 1044 of 1044 pass.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... and go build ./...: ok at cdd7c8e46, the same
batch on origin/main 00098f12b one rebase before.
- The whole go test ./... at cdd7c8e46: 86 packages ok, one red,
internal/cli TestEveryRouteHasACommandOrIsNamed (GET
/api/context/reply has no command), red on main too (#5026).
- Linux (wsl-run, Ubuntu 24.04, at 339055896, the batch on f4c664a09):
proc, autostart, testenv, tui ok; agent: only TestGrokInstalled red
(#3548); #4033's proc.Look reds (Zed, Copilot, Qoder, Cursor, Omp)
pass.
- Windows (win-run, Windows 11, at 339055896): proc, autostart, testenv,
tui ok; library and agent red in the same tests as on origin/main
f4c664a09 (#4115, #1827, #4786; #5068, #5069, #5070 filed now).
- Rebased onto origin/main fb1f4856a (three commits, no file in
common with the batch) and run again at the pushed tree: gofmt -l
nothing, go build ./... and go vet ./... ok; go test -tags nogui
sessions, agent, autostart, tui, proc, testenv ok; i18n-keys and
library-* 1044 of 1044 pass.
- Not run before the push: the whole GUI suite (a run at cdd7c8e46 was
cut off at 1170 of ~1174 tests when mote rebooted; it runs again after
the tag and any red is filed).