Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

provider: a built-in whose plugin the user removed is no move candidate (plugins#404)

yetonec54dd7dab2b4
diff --git a/internal/provider/migrate.go b/internal/provider/migrate.go
index 212738222..d3ae57273 100644
--- a/internal/provider/migrate.go
+++ b/internal/provider/migrate.go
@@ -339,7 +339,14 @@ type MoveCandidate struct {
}
// MoveCandidates are the built-ins not on their plugins that have accounts
-// to move, by name.
+// to move, by name. One whose plugin the user removed (MoveRemoved) is
+// none: its accounts moved already and are kept with the plugin's sign-ins,
+// and installing the plugin again gives it back (HandOver), as MoveRetiring
+// and HandOver leave it too. A login row of the built-in's left behind kept
+// it here, so the Providers page's line said its accounts "haven't moved
+// yet" for good, with a Move that would install the plugin the user had
+// just removed (plugins#404: Grok, after the plugin, the provider and its
+// sign-ins were removed; #3542: ZCode).
func MoveCandidates() []MoveCandidate {
if settings.AccountDiscoveryOff() {
return nil
@@ -349,6 +356,9 @@ func MoveCandidates() []MoveCandidate {
if Moved(id) {
continue
}
+ if m, ok := MigrationOf(id); ok && m.State == MoveRemoved {
+ continue
+ }
if accts, err := mv.out(); err == nil && len(accts) > 0 {
c := MoveCandidate{ID: id, Name: nameOf(id), Package: mv.pkg, Accounts: len(accts)}
if m, ok := MigrationOf(id); ok && m.State == MoveFailed {
diff --git a/internal/provider/migrate_test.go b/internal/provider/migrate_test.go
index fb811646e..b2a327b26 100644
--- a/internal/provider/migrate_test.go
+++ b/internal/provider/migrate_test.go
@@ -384,6 +384,37 @@ func TestRetiredBuiltinQuiet(t *testing.T) {
}
}
+// plugins#404 (Gruu6y): Grok moved onto its plugin, then the plugin, the
+// provider and its sign-ins removed. migrations.json says "removed", but a
+// login row of the built-in's left behind kept it a move candidate, and the
+// Providers page said for good that its accounts hadn't moved yet, with a
+// Move that would install the plugin again. Removed is the user's answer:
+// no candidate, until the plugin is installed again (HandOver).
+func TestRemovedPluginIsNoMoveCandidate(t *testing.T) {
+ claudeHome(t)
+ loginsMu.Lock()
+ _ = writeLogins([]savedLogin{{Agent: "zed", User: "[email protected]", On: true, First: true, Auth: []byte(`{"userId":"u1","accessToken":"a"}`)}})
+ loginsMu.Unlock()
+ if c := MoveCandidates(); len(c) != 1 || c[0].ID != "zed" {
+ t.Fatalf("the unmoved account isn't offered its move: %+v", c)
+ }
+ if err := setMigration("zed", func(m *Migration) {
+ *m = Migration{State: MoveRemoved, Package: MovePackage("zed"), Installed: true}
+ }); err != nil {
+ t.Fatal(err)
+ }
+ if c := MoveCandidates(); len(c) != 0 {
+ t.Fatalf("one whose plugin the user removed is still offered a move: %+v", c)
+ }
+ // one whose move failed still is, with why
+ if err := setMigration("zed", func(m *Migration) { m.State, m.Err = MoveFailed, "boom" }); err != nil {
+ t.Fatal(err)
+ }
+ if c := MoveCandidates(); len(c) != 1 || c[0].Error != "boom" {
+ t.Fatalf("a failed move isn't offered again: %+v", c)
+ }
+}
+
// A moved built-in's plugin is updated to the version its move needs, as
// the built-in came up to date with magpie; one whose plugin the user
// removed isn't installed again.