partnerIcon keeps a partner's logo in the icons folder beside
providers.json and, while its iconUrl stays the same, uses the file it
kept as it is (97902e93), so the file only ages. No provider points at
it until one is added from the partner, and pruneIcons, after every
save of providers.json, removes a picture no provider or plugin names
once it is an hour old. A logo kept from an earlier day is that old at
once, so the first save after a start (a key, a model picked, an order,
a sign-in, a sync's pull) took it: /api/icons/<name> answered 404 while
the partner still named file:<name>, the add sheet's img fell back to
the generic icon, and the next fetch, finding the file gone, downloaded
it again, for a save an hour on to take. Before 97902e93 every fetch
downloaded it again, six hours apart, and a save an hour after each
took it the same way.
Now pruneIcons also leaves the pictures of the partners listed now
(keptPartnerIcons), as it leaves a plugin's (keptPluginIcons). A
process that hasn't asked for the list reads it from partners.json, as
Partners does, so a save from the CLI leaves them too. A partner no
longer listed loses its logo at the next prune unless a provider added
from it names it, as before. With the list off (MAGPIE_PARTNERS=off,
and every test that names no list) nothing is kept for it.
Lock order: store, then pruneIcons, then partnerMu. Nothing under
partnerMu saves providers.json or takes a lock store holds, and no
fetch runs under it.
Old data: a logo pruned before this is fetched again by the list's next
fetch (at start, then hourly), as it was; nothing to move.
What was run (tree 0409d43e, on a93190ae, go1.26.8):
broken by hand, with this change: pruneIcons without the
keptPartnerIcons loop:
partners_test.go:489: the listed partner's logo was pruned: stat
.../icons/d1774929a9b62027.png: no such file or directory
partners_test.go:496: the logo was downloaded 2 times, want once
a real run: magpie web in a sandbox HOME with the real list
(usemagpie.ai/api/partners, Kimi Code) and stats off. A first start
kept Kimi Code's logo; its file was set two hours back, as one kept
from an earlier day is; a second start's fetch used it as it was;
then magpie provider add Local url=http://127.0.0.1:9/v1 saved
providers.json:
main (a93190ae): the file gone, GET /api/icons/<name> 404,
/api/providers still naming file:<name>, and a new Chromium drew
Kimi Code in the add sheet with the generic icon
this change: the file kept, 200, and the add sheet drew the logo
(128 px wide)
gofmt -l internal/provider: nothing
GOOS=linux, darwin, windows go vet -tags nogui ./internal/provider:
exit 0; CGO_ENABLED=0 GOOS=darwin and windows go build -tags nogui
.: exit 0
full suite, go test -tags nogui -count=1 -timeout 45m ./...: a first
run stalled, the test binaries of 14 packages sitting in close(2) for
45 minutes until the timeout (internal/provider ok); run again with
nothing changed (445 s): 62 packages ok, internal/provider among them.
13 tests red in 8 packages, none in a file this change touches:
internal/agent TestInstalledVersion, TestOmpDetectedWithPiDir and
TestZedAppPath: proc.Look keeps "not found" for a tool written in
the tick of its folder's last change (#3141).
internal/agent TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout: their fixture build under
/tmp meets a /tmp/.git that isn't a repository of this user's
("error obtaining VCS status: exit status 128").
internal/claudebridge TestCallbackGoesPastTheAgentsProxy,
internal/gateway TestClaudeToolCallbackOnANonLoopbackAddress,
internal/gui TestGatewayHeldByAContainer and
TestGatewayFixQuitsOnlyAMagpie: the processes this run started had
their outgoing connections sent through a proxy (graftcp).
internal/edit TestWriteAtomicReadOnlyHardLink and internal/testenv
TestProgram: umask 077 here; the fixtures' own modes go through it
(0444 is written as 0400).
internal/netproxy TestBunProxyLoginWithReservedCharacters: Bun
1.3.11 on PATH names port 80 in the request line (#3397).
internal/middleware TestFailOpen: "spin took 1.508697807s", past
its 1 s bound under the run's load; alone, -count=10: ok.
Not tried: the desktop app's webview (a browser that drew the logo
before keeps drawing it from its cache, since /api/icons answers
immutable for a year), macOS, Windows.