Files
magpie/internal/plugin/testdata
yetone 47b51c8225 plugin: an OAuth sign-in with no refresh token is kept, and one with nothing to keep fails (plugins#998)
host.js keeps an OAuth sign-in only when "refresh" is in the plugin's
result, as OpenCode's CLI does. codearts' "Sign in from CodeArts Agent"
returned an access with no refresh field, so the callback said ok and
nothing was stored: the CLI printed "signed in" and no account showed.
callback now keeps an access with no refresh as an OAuth sign-in with an
empty refresh, and a success with nothing to keep (no refresh, key or
access) fails with "<provider>'s sign-in gave nothing to keep", as
apiKey's "gave no key" already did. The plugin side is fixed too
(codearts 0.3.14, plugins 4e3a7868); this covers any other plugin that
leaves the field out.

TestSignInWithNoRefreshIsKept drives both through the signinend fixture
(methods 8 and 9) and checks the kept record is oauth with refresh "".

Ran on mica: go test -count=1 ./internal/plugin/ ./internal/provider/ ok;
GOOS=windows and GOOS=linux go vet ./internal/plugin/ ok; gofmt -l clean.
Broken by hand: with host.js at its parent, the new test fails on both
cases (nil error, nothing kept).
Not tried: the full suite at this head (one is running on mica for
805e5c29a), a real CodeArts Agent sign-in.

Reported-by: AyakaChen1 <AyakaChen1@users.noreply.github.com>
2026-11-12 11:14:56 +08:00
..
providers, sign-in, tray, plugins: four of StringKe's reports on Discord — (1) Removing a provider left its editor open and listed, and a second Remove said there was no such provider: the removal had been made, but moving the agents off its models failed on one agent whose config couldn't be written, and Reseat returned that as the change's error; now such an agent is a move with its error ("still on X, not moved: …", a warning in the panel, a line in the CLI and TUI), the others are moved, and the panel, told a delete failed, re-reads the list and closes the editor when the provider is gone. (2) The sign-in waiting sheet shows the sign-in link itself, selected whole on a click, with a copy button, for a browser other than the one that opens. (3) A subscription with several accounts offers "Account in use" among the menu bar's usages, following the account the gateway goes to first. (4) The Antigravity plugin's sign-in never started: magpie called every plugin's authorize with an inputs object, the way OpenCode's CLI does, and opencode-antigravity-auth then asked its Project ID on the terminal — magpie's stdin — until the minute ran out; inputs now go only to a method with prompts, as OpenCode's TUI passes them (checked against the real package under Bun in a sandbox: the Google sign-in URL comes back at once). TestReseatUnmovable, TestTrayInUse, TestInUseOf, TestAuthorizeNoPrompts, provider-remove.test.cjs, signin-link.test.cjs and tray-inuse.test.cjs fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; click-scroll, old-webkit, tray-usages, plugin-signin, signin-callback, factory-sub pass.
2026-09-30 20:45:23 +08:00