Aside: a hand-written magpie provider blocks Connect with a message the user can't act on; apply needs aside on the shell's PATH
Follow-up from #1499 (reported by @fjrtdk on v0.1.1168).
- Unactionable message. A
magpieprovider hand-written into~/.aside/u/<n>/models.jsonwith anapiKeyother than magpie's (gateway.TokenFor("aside")) is treated as foreign and left alone, which is right, but the message is only "Aside's magpie provider belongs to another configuration; it will not be overwritten" (internal/agent/aside_native.go:316). It should name the file and say what to do: remove that provider entry (and its credentials.json entry) and connect again, or let magpie replace it. - PATH.
internal/agent/aside.go:92runsproc.CommandContext(ctx, "aside", "repl", ...)by bare name. Run from a shell whose PATH lacks the aside CLI (e.g.~/.local/bin), apply fails withexec: "aside": executable file not found in $PATH, although magpie found the binary itself (the agent'sPath). It should run the binary magpie found.
Both are small; one commit each.
Taking this one — the issue was open with no claim when I started.
Both defects are in internal/agent:
1. The message names nothing. provider() returns the foreign detail at internal/agent/aside_native.go:316 (and its no ownership credential sibling at :313):
Aside's magpie provider belongs to another configuration; it will not be overwritten
No file, no key, nothing to do. Both foreign messages now name the account's models.json by its path, the providers.magpie entry, and the removal that lets magpie write its own:
Aside's magpie provider belongs to another configuration: it was not added by magpie, so magpie will not overwrite it. To let magpie connect Aside, remove the providers.magpie entry from ~/.aside/u/0/models.json (and its entry from the credentials.json beside it), then connect again.
The leave-it-alone behaviour itself is unchanged — magpie still never overwrites a foreign entry.
2. The repl ran by bare name. asideSet (internal/agent/aside.go:92 before this branch) ran proc.CommandContext(ctx, "aside", "repl", …), asking only the PATH of the shell magpie was started from, while magpie itself finds the binary through proc.FindTool — whose folders include ~/.local/bin, npm's, bun's and the rest of a user's tool dirs (the #839 / #1482 class, found for the sign-in but never applied to Aside's repl). Now asideBin() (internal/agent/aside.go:97) answers with the found path, asideSet runs it (:110), and the sibling asideRead (internal/agent/aside_native.go:28) runs it too. When nothing is found the bare name stands, so the failure says what it always said.
Tests (red before the fix, green after)
TestAsideForeignProviderMessageSaysWhatToDo(internal/agent/aside_test.go:204) — both foreign shapes (a key of the user's own, and no key at all) must surface the file path,providers.magpie,credentials.json, and "remove … connect". Red on the old message:message "Aside's magpie provider belongs to another configuration; it will not be overwritten" does not say "providers.magpie".TestAsideSetRunsTheFoundBinary(internal/agent/aside_test.go:230) — an executableasidein~/.local/binwithPATHempty must run through the found binary. Red with the resolution reverted to the bare name:apply could not run the aside magpie found: Aside did not accept the settings change: exec: "aside": executable file not found in $PATH.
Verification
go test -tags nogui -timeout 45m ./internal/agent/— 1225 passed (full package, rebased on the currentmain).CGO_ENABLED=0 GOOS=windows go vet -tags nogui ./internal/agent/andGOOS=linux— clean.gofmt -lon the three changed files — empty.- Not touched:
.github/,site/, dependencies, the GUI (app.js/i18n.js). The messages embed a dynamic file path, so they are not i18n keys — the previous foreign strings had noi18n.jsentries either, so nothing is left untranslated that was translated before. GUI dual-engine tests not run: no GUI surface changed.
The branch sits on the current main (b1d02fa6), one commit per point of the issue:
git fetch https://github.com/Niko-Wu/magpie.git fix/1871
git cherry-pick 9c2091ad 0165541b
9c2091ad— agent: a hand-written Aside provider says which file to edit, not just that it belongs elsewhere (#1871)0165541b— agent: Aside's settings change runs the binary magpie found, not the name on the shell's PATH (#1871)