Files
magpie/internal
yetone 1a67ca614e provider: Fetch models refreshes each key's own models, keeping what the user un-ticked (young02036)
young02036 on Discord: a provider holds several keys, each at a group of
a relay's that serves different models. Each key's own list was read
only when the key was added (PrefillNewKeys); Fetch models merged every
key's list into the provider's (fetchPerKey marks each model with the
keys that list it) but never changed a key's own models, so a model a
group took on later was never sent to its key and one it gave up still
was.

Fix: refetch, which every Fetch goes through (the editor's button, the
CLI, the TUI, the automatic re-list), takes each key's marks before and
after the fetch and carries the difference into that key's
AccountModels (key_models_refresh.go): a model the key's list has now
and didn't before is ticked for it, one it had and has no more is taken
out. A model the user un-ticked that the list had before and still has
stays un-ticked; one the user ticked that the list never had stays
ticked. Only keys with a list of their own are touched (a key serving
every model still does), a key with no marks before or now (one key
on, just added, a list that failed) is unknown and left alone, nothing
is ever narrowed to an empty list, and a key whose models the user
changed while the lists were asked keeps the user's. The provider's own
picks (what agents get) are not touched. No GUI change: the editor's
Fetch already redraws the key rows from the saved provider.

Test: TestFetchRefreshesEachKeysModels, against an httptest relay whose
per-key lists change between fetches: add a key (prefill), un-tick by
hand, groups change, fetch; un-tick again and tick a model the list
lacks, fetch twice; a key's list failing; the provider's picks unset.

Red on the old code (the refreshKeyModels call removed): "sk-a after a
fetch: [gpt-5.5 deepseek-v4], want [gpt-5.5 kimi-k3]", "sk-c after a
fetch: [deepseek-v4 qwen3-max], want glm-5 ticked", and the gateway's
AccountServes check. Broken by hand: ticking every listed model instead
of only those new to the key turns the un-tick, hand-tick and failed-list
cases red (4 errors).

Run on mote at this tree (on 78128b510): gofmt clean; go vet
./internal/provider ./internal/gui, GOOS=linux -tags nogui and
GOOS=windows go vet: ok. go test -count=1 -timeout 45m
./internal/provider ./internal/cli ./internal/tui: ok. ./internal/gui:
TestCoreScriptBudget (#5139) and TestMainWindowCorners/macOS_26_SDK
(#3949) red, the same as for 78128b510; no gui file changed here.
GUI files, chromium and webkit, every language they run:
account-models and account-refresh 26/26 ok. provider-fetch-again,
provider-picks-stay and gateway-key-models (en) are red, and red the same
way at a clean 78128b510 checkout with no change of this commit: #5232
and #5233.

Not tried: a real relay with per-group keys, and the full suite before
the push.
2026-11-04 19:30:08 +08:00
..
…
…
…
…
…
…
…
…