From 805e5c29a33540a4e968613a0ef41682c43f423f Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 12 Nov 2026 10:59:09 +0800 Subject: [PATCH] provider: six more plugins' sign-ins rotate before the host list is read (plugins #1027) plugins #1027 made eight auth hooks say rotating: Cline, CodeArts (with OfficeAce), Factory, MiniMax, Nous Portal, Qoder, SenseNova and WorkBuddy. magpie reads that from the plugin host's list, but a sync that runs at start can come before the list is read. rotatesKnown covers that window, and it held only MiniMax and Qoder. It now holds all twelve provider ids, so none of those sign-ins is carried to another computer by an early Sync, backup or Restore. MiniMax and Qoder stay listed for the same reason. TestRotatingKnownBeforeHostList checks each id. With the old list put back by hand it was red (workbuddy-ai and the others named). Run on mica at this tree: go test -count=1 ./internal/provider/ ok (128s); go vet ./internal/provider/ on darwin, windows and linux ok. Not run: the full suite (it runs after the push, per the ship rule). Not tried: a real sync between two computers. --- internal/provider/signins_carry.go | 12 ++++++++++-- internal/provider/signins_rotating_test.go | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 internal/provider/signins_rotating_test.go diff --git a/internal/provider/signins_carry.go b/internal/provider/signins_carry.go index f7190e7e6..d6402d1a8 100644 --- a/internal/provider/signins_carry.go +++ b/internal/provider/signins_carry.go @@ -196,8 +196,16 @@ func (s *SignIns) records() map[string]signInRec { // rotatesKnown are the community plugins whose vendor spends a refresh // token once, read from their sources: MiniMax Code ("MiniMax spends a // refresh token once", invalid_grant 400 after) and Qoder ("a refresh -// token is spent once, so two refreshes would spend it twice"). -var rotatesKnown = []string{"minimax-code", "minimax-code-global", "qoder", "qoder-cn"} +// token is spent once, so two refreshes would spend it twice"), and the +// six whose auth hooks say rotating since plugins #1027: Cline (a spent +// token is 400 invalid_grant), CodeArts and OfficeAce ("one-time refresh +// token"), Factory (WorkOS rotates), Nous Portal (refresh_token_reused), +// SenseNova (Hydra rotates) and WorkBuddy. The hooks say so too; this list +// holds for a sync that runs before the plugin host's list is read. +var rotatesKnown = []string{ + "cline", "codearts", "factory", "minimax-code", "minimax-code-global", "nous-portal", + "officeace", "qoder", "qoder-cn", "sensenova-token-plan", "workbuddy", "workbuddy-ai", +} // rotatingPlugins are the ids of the plugins whose auth hook says their // refresh tokens rotate (Rotating): a sign-in of theirs is never carried, diff --git a/internal/provider/signins_rotating_test.go b/internal/provider/signins_rotating_test.go new file mode 100644 index 000000000..2cd8f2dc4 --- /dev/null +++ b/internal/provider/signins_rotating_test.go @@ -0,0 +1,18 @@ +package provider + +import "testing" + +// Before the plugin host's list is read, a sync still knows which +// plugins' sign-ins rotate: every plugin whose hook says rotating +// (plugins #1027) or whose source says a refresh token is spent once. +func TestRotatingKnownBeforeHostList(t *testing.T) { + got := rotatingPlugins() + for _, id := range []string{ + "cline", "codearts", "factory", "minimax-code", "minimax-code-global", "nous-portal", + "officeace", "qoder", "qoder-cn", "sensenova-token-plan", "workbuddy", "workbuddy-ai", + } { + if !got[id] { + t.Errorf("%s is carried before the plugin host list is read", id) + } + } +}