From cdddea0592a5f2793895f89111318f1e4d27ab4c Mon Sep 17 00:00:00 2001 From: Eva H <63033505+hoyyeva@users.noreply.github.com> Date: Wed, 15 Apr 2026 13:17:35 -0700 Subject: [PATCH] launch: always list cloud recommendations first (#15593) --- cmd/launch/integrations_test.go | 17 +++++++++-------- cmd/launch/models.go | 8 -------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/cmd/launch/integrations_test.go b/cmd/launch/integrations_test.go index 0f7313301..f1a9bbac0 100644 --- a/cmd/launch/integrations_test.go +++ b/cmd/launch/integrations_test.go @@ -329,7 +329,7 @@ func TestBuildModelList_NoExistingModels(t *testing.T) { } } -func TestBuildModelList_OnlyLocalModels_CloudRecsAtBottom(t *testing.T) { +func TestBuildModelList_OnlyLocalModels_CloudRecsStillFirst(t *testing.T) { existing := []modelInfo{ {Name: "llama3.2:latest", Remote: false}, {Name: "qwen2.5:latest", Remote: false}, @@ -338,10 +338,11 @@ func TestBuildModelList_OnlyLocalModels_CloudRecsAtBottom(t *testing.T) { items, _, _, _ := buildModelList(existing, nil, "") got := names(items) - // Recommended pinned at top (local recs first, then cloud recs when only-local), then installed non-recs - want := []string{"gemma4", "qwen3.5", "kimi-k2.5:cloud", "qwen3.5:cloud", "glm-5.1:cloud", "minimax-m2.7:cloud", "llama3.2", "qwen2.5"} + // Cloud recs always come first among recommended, regardless of installed inventory. + // Cloud disablement is handled upstream in loadSelectableModels via filterCloudItems. + want := []string{"kimi-k2.5:cloud", "qwen3.5:cloud", "glm-5.1:cloud", "minimax-m2.7:cloud", "gemma4", "qwen3.5", "llama3.2", "qwen2.5"} if diff := cmp.Diff(want, got); diff != "" { - t.Errorf("recs pinned at top, local recs before cloud recs (-want +got):\n%s", diff) + t.Errorf("cloud recs pinned first even when no cloud models installed (-want +got):\n%s", diff) } } @@ -588,7 +589,7 @@ func TestBuildModelList_MixedCase_CloudRecsFirst(t *testing.T) { } } -func TestBuildModelList_OnlyLocal_LocalRecsFirst(t *testing.T) { +func TestBuildModelList_OnlyLocal_CloudRecsStillFirst(t *testing.T) { existing := []modelInfo{ {Name: "llama3.2:latest", Remote: false}, } @@ -596,11 +597,11 @@ func TestBuildModelList_OnlyLocal_LocalRecsFirst(t *testing.T) { items, _, _, _ := buildModelList(existing, nil, "") got := names(items) - // Local recs should sort before cloud recs in only-local case + // Cloud recs sort before local recs regardless of installed inventory. localIdx := slices.Index(got, "gemma4") cloudIdx := slices.Index(got, "glm-5.1:cloud") - if localIdx > cloudIdx { - t.Errorf("local recs should be before cloud recs in only-local case, got %v", got) + if cloudIdx > localIdx { + t.Errorf("cloud recs should be before local recs even when only local models installed, got %v", got) } } diff --git a/cmd/launch/models.go b/cmd/launch/models.go index fb962b4a1..2682aa102 100644 --- a/cmd/launch/models.go +++ b/cmd/launch/models.go @@ -359,8 +359,6 @@ func buildModelList(existing []modelInfo, preChecked []string, current string) ( recRank[rec.Name] = i + 1 } - onlyLocal := hasLocalModel && !hasCloudModel - if hasLocalModel || hasCloudModel { slices.SortStableFunc(items, func(a, b ModelItem) int { ac, bc := checked[a.Name], checked[b.Name] @@ -382,12 +380,6 @@ func buildModelList(existing []modelInfo, preChecked []string, current string) ( } if aRec && bRec { if aCloud != bCloud { - if onlyLocal { - if aCloud { - return 1 - } - return -1 - } if aCloud { return -1 }