Commit Graph
3 Commits
Author SHA1 Message Date
yetone f4e52659a8 plugins: a pick listed as another id leaves with its model (axelburks)
A plugin's model the user lists as another id ("list as", SetModelID) is
picked under that id, but pluginListedIDs held the plugin's own ids. The
hourly relist and Refresh compared the pick with a list that never had
it, so "in the old list, not in the new one" was false, and a model the
plugin dropped stayed picked and on, as if typed in by hand. The built-in
providers' liveIDs already mapped through modelIDsOf; the plugin path
now does too. The list-as stays in settings, so when the plugin lists the
model again relistPicks puts the pick back under the same id.

Run: TestListedAsPickLeavesWithItsModel (new: aaa listed as
claude-opus-5.5 and picked, next list lacks aaa -> pick set aside, alias
kept, a hand-typed pick stays; aaa back -> pick back, alias intact), on
mote. Broken by hand: with pluginListedIDs returning the raw ids the test
fails ("dropped []"). go test internal/provider, internal/plugin: ok.
internal/gui: TestCoreScriptBudget (1535230 > 1533802) and
TestMainWindowCorners (mote's macOS) red, neither touched by this change.
Not tried: a real plugin sign-in.
2026-11-04 11:56:33 +08:00
yetone 8febe3a50c provider: a pick a plugin's list leaves for a while comes back when it is listed again (多喝热水 on Discord)
多喝热水 picked models of the Our Free Model plugin
(mu-zi-lee/magpie-our-free-model) and had to pick them again after every
magpie update. A minute after magpie starts, and hourly, KeepPluginsListed
reads every plugin's models again and dropGonePicks deleted for good each
pick the list didn't have. OFM, started again with magpie, lists its free
pools at once and its account channels' models ("qoder/...", "kiro/...")
only once it has read them, so the first list was short and the channel
picks were lost. A relay's Fetch models or RefreshEvery list that left a
model out once did the same.

Now a pick the list leaves out moves to Delisted (providers.json
"delisted"): not served while it isn't listed, put back in Models when a
list has it again (relistPicks), for plugins and fetched lists alike.
After a list left picks out, the loop asks again in 5 minutes
(relistSoon), not an hour. A provider whose every pick is set aside serves
none of its models (waitsForPicks), not the whole list. Editor saves keep
Delisted (delistedWith, withPicks, the account whitelist); Select none or
the vendor's list picked clears it. While picks are set aside, new picks
saved keep the earlier PickedFrom too, so a model seen and left unpicked
isn't served as new when the list has it again; a list short of no pick is
taken as it is, as TestClaudePicksOfEveryModelTakeOnesListedSince wants.

New tests: TestPluginPicksComeBackWithTheirList (through the real
KeepPluginsListed loop), TestEveryPickDelistedServesNone,
TestRelayPicksComeBackWithTheirList (through Refetch on an httptest
/v1/models). Broken by hand, each red: relistPicks returning false (the
old behaviour: picks not restored), relistSoon as relistEvery ("wasn't
asked for again soon"), waitsForPicks removed (pool-a served with every
pick set aside), the PickedFrom union off (kiro/claude-z served).

The plugin side, for its author: OFM's managed runner answers `models`
before its channels and first model refresh are read; awaiting them (with
a timeout) or answering fallback(previous) with the magpie.fellBack marker
would keep magpie's last good list. OFM itself was not run here (its
install scripts weren't run, by instruction).

Run at base 5b267fbd8: gofmt -l clean; go vet ./... for darwin, linux
(nogui) and windows: ALL-VET-OK. go test -timeout 45m ./... (load
~200-400): every package ok except provider, agent, gateway, library.
provider: TestClaudePicksOfEveryModelTakeOnesListedSince red from the
unconditional PickedFrom union; fixed by scoping it to set-aside picks,
then go test ./internal/provider/ ok (1324s), vet for the three OSes ok.
agent, gateway, library ran past the timeout (agent again past 1h in a
rerun, at TestOmpEnabledModelsLeftAlone; no test failed): filed as #2544,
#2723, #2870, #2853. No GUI files changed.
2026-10-19 21:31:23 +08:00
yetone 88519703cd provider: a magpie left running lists the plugins' models again every hour, and a model a plugin dropped leaves the picks (Jeremy.Zhou on Discord)
Jeremy.Zhou asked that the free-models plugin's dropped models go and new
ones come by themselves. A plugin's list was read on start, sign-in, a
plugin change or Refresh, never again while magpie ran; and Refetch skipped
dropGonePicks for plugin providers, so a dropped model stayed picked.

- KeepPluginsListed, started beside KeepRetiringMoved in the gateway's
  ListenAndServe, asks the plugins again a minute after start and then
  hourly (plugin.Providers, 2 min timeout). A failed ask logs and keeps the
  lists. A list that fell back (vendor unreadable) drops nothing, and the
  last read list stays the comparison for the next ask (keptListed).
- dropGonePluginPicks drops a pick the old list had and the new one lacks;
  a pick neither listed (typed by hand) stays. Refetch uses it for plugin
  providers too.

Run: TestPluginsListedAgainWhileRunning -race -count=5 green; red with the
drop removed, and red with keptListed replaced by before = now. internal/
plugin ok; gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui
./internal/provider ./internal/gateway ok. The full gateway package hit
the 10 min test timeout at load average ~150 (stacks in mcpauth sleeps), not
rerun before disk fell under 10G.
2026-10-10 23:22:01 +08:00