Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

launch: skip unchanged integration rewrite configration (#15491)

Eva H58180016107d
diff --git a/cmd/launch/integrations_test.go b/cmd/launch/integrations_test.go
index 8be31592a..68f1148f2 100644
--- a/cmd/launch/integrations_test.go
+++ b/cmd/launch/integrations_test.go
@@ -14,6 +14,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/ollama/ollama/api"
+ "github.com/ollama/ollama/cmd/config"
)
type stubEditorRunner struct {
@@ -722,6 +723,59 @@ func TestLauncherClientFilterDisabledCloudModels_ChecksStatusOncePerInvocation(t
}
}
+func TestSavedMatchesModels(t *testing.T) {
+ tests := []struct {
+ name string
+ saved *config.IntegrationConfig
+ models []string
+ want bool
+ }{
+ {
+ name: "nil saved",
+ saved: nil,
+ models: []string{"llama3.2"},
+ want: false,
+ },
+ {
+ name: "identical order",
+ saved: &config.IntegrationConfig{Models: []string{"llama3.2", "qwen3:8b"}},
+ models: []string{"llama3.2", "qwen3:8b"},
+ want: true,
+ },
+ {
+ name: "different order",
+ saved: &config.IntegrationConfig{Models: []string{"llama3.2", "qwen3:8b"}},
+ models: []string{"qwen3:8b", "llama3.2"},
+ want: false,
+ },
+ {
+ name: "subset",
+ saved: &config.IntegrationConfig{Models: []string{"llama3.2", "qwen3:8b"}},
+ models: []string{"llama3.2"},
+ want: false,
+ },
+ {
+ name: "nil models in saved with non-nil models",
+ saved: &config.IntegrationConfig{Models: nil},
+ models: []string{"llama3.2"},
+ want: false,
+ },
+ {
+ name: "empty both",
+ saved: &config.IntegrationConfig{Models: nil},
+ models: nil,
+ want: true,
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := savedMatchesModels(tt.saved, tt.models); got != tt.want {
+ t.Fatalf("savedMatchesModels = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
func TestPrepareEditorIntegration_SavesOnlyAfterSuccessfulEdit(t *testing.T) {
tmpDir := t.TempDir()
setTestHome(t, tmpDir)
diff --git a/cmd/launch/launch.go b/cmd/launch/launch.go
index dd65466f8..7786c09c7 100644
--- a/cmd/launch/launch.go
+++ b/cmd/launch/launch.go
@@ -6,6 +6,7 @@ import (
"fmt"
"net/http"
"os"
+ "slices"
"strings"
"github.com/ollama/ollama/api"
@@ -500,7 +501,7 @@ func (c *launcherClient) launchEditorIntegration(ctx context.Context, name strin
return nil
}
- if needsConfigure || req.ModelOverride != "" {
+ if (needsConfigure || req.ModelOverride != "") && !savedMatchesModels(saved, models) {
if err := prepareEditorIntegration(name, runner, editor, models); err != nil {
return err
}
@@ -846,6 +847,13 @@ func firstModel(models []string) string {
return models[0]
}
+func savedMatchesModels(saved *config.IntegrationConfig, models []string) bool {
+ if saved == nil {
+ return false
+ }
+ return slices.Equal(saved.Models, models)
+}
+
func editorPreCheckedModels(saved *config.IntegrationConfig, override string) []string {
if override == "" {
if saved == nil {