diff --git a/.changeset/model-picker-provider-grouping.md b/.changeset/model-picker-provider-grouping.md new file mode 100644 index 00000000000..1cc3b6a2d30 --- /dev/null +++ b/.changeset/model-picker-provider-grouping.md @@ -0,0 +1,5 @@ +--- +"@kilocode/cli": patch +--- + +Ensure custom provider category groups remain visible in the model picker when their models are in recent selections. diff --git a/packages/tui/test/cli/cmd/tui/model-options.test.ts b/packages/tui/test/cli/cmd/tui/model-options.test.ts deleted file mode 100644 index 97bae7532fe..00000000000 --- a/packages/tui/test/cli/cmd/tui/model-options.test.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { describe, expect, test } from "bun:test" -import { sortModelOptions } from "../../../../src/component/dialog-model" - -describe("sortModelOptions", () => { - test("orders provider-scoped model choices by newest release first", () => { - const sorted = sortModelOptions( - [ - { title: "GPT 5.2", releaseDate: "2025-12-11" }, - { title: "GPT 5.4", releaseDate: "2026-03-05" }, - { title: "GPT 5.1", releaseDate: "2025-11-13" }, - ], - true, - ) - - expect(sorted.map((model) => model.title)).toEqual(["GPT 5.4", "GPT 5.2", "GPT 5.1"]) - }) - - test("orders regular model choices free-first and then newest-first", () => { - const sorted = sortModelOptions( - [ - { title: "GLM 5", releaseDate: "2025-07-28" }, - { title: "GLM 5.1", releaseDate: "2025-12-09" }, - { title: "GLM 5.2", releaseDate: "2026-02-16" }, - { title: "Free old", releaseDate: "2024-01-01", footer: "Free" }, - { title: "Free new", releaseDate: "2025-01-01", footer: "Free" }, - ], - false, - ) - - expect(sorted.map((model) => model.title)).toEqual(["Free new", "Free old", "GLM 5.2", "GLM 5.1", "GLM 5"]) - }) -}) diff --git a/packages/tui/test/kilocode/model-picker.test.ts b/packages/tui/test/kilocode/model-picker.test.ts index 7f24cc54853..3a5a0250b85 100644 --- a/packages/tui/test/kilocode/model-picker.test.ts +++ b/packages/tui/test/kilocode/model-picker.test.ts @@ -122,4 +122,28 @@ describe("model picker options", () => { expect(options.map((option) => option.modelID)).toContain(sonnet45.modelID) expect(options.map((option) => option.modelID)).toContain(sonnet4.modelID) }) + + test("keeps custom provider category intact when all its models are in recent (#13123)", () => { + const PROXSIS: ModelPickerProvider = { + id: "proxsis", + name: "Proxsis", + models: { + "Proxsis-Mimo25": { id: "Proxsis-Mimo25", name: "Proxsis Mimo25" }, + "Proxsis-Mimo25Pro": { id: "Proxsis-Mimo25Pro", name: "Proxsis Mimo25 Pro" }, + }, + } + + const options = buildModelPickerOptions({ + providers: [PROXSIS], + connected: true, + showExtra: true, + recents: [ + { providerID: "proxsis", modelID: "Proxsis-Mimo25" }, + { providerID: "proxsis", modelID: "Proxsis-Mimo25Pro" }, + ], + }) + + expect(inCategory(options, "Recent")).toEqual(["Proxsis-Mimo25", "Proxsis-Mimo25Pro"]) + expect(inCategory(options, "Proxsis")).toEqual(["Proxsis-Mimo25", "Proxsis-Mimo25Pro"]) + }) })