Repository navigation
feat(catalog): add modelPickerOrder for full picker ordering beyond 5 models #1666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4e2aa98
feat(catalog): add modelPickerOrder for full picker ordering beyond 5…
8f408b9
fix(catalog): keep modelPickerOrder out of the spawn_agent candidate …
4baa12c
docs(catalog): scope modelPickerOrder to routed slugs; document the b…
83b2839
fix(catalog): decouple modelPickerOrder display from spawn_agent cand…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| import { describe, expect, test } from "bun:test"; | ||
| import { buildCatalogEntriesFromObservedState } from "../src/codex/catalog/sync"; | ||
| import type { CatalogModel } from "../src/types"; | ||
|
|
||
| // #1649: config.modelPickerOrder assigns a deterministic priority band to non-featured routed | ||
| // rows so a catalog with more than 5 routed models keeps a stable picker order across rebuilds, | ||
| // independent of the 5-slot subagentModels spawn_agent cap. | ||
|
|
||
| function template(): Record<string, unknown> { | ||
| return { | ||
| slug: "gpt-5.5", | ||
| display_name: "gpt-5.5", | ||
| description: "Native GPT model", | ||
| priority: 1, | ||
| visibility: "list", | ||
| tool_mode: "code", | ||
| }; | ||
| } | ||
|
|
||
| const goModels = [ | ||
| { id: "glm-5.2", provider: "jd-chat", owned_by: "jd" }, | ||
| { id: "kimi-k3", provider: "jd-chat", owned_by: "jd" }, | ||
| { id: "deepseek-v4-pro", provider: "tyler", owned_by: "tyler" }, | ||
| { id: "sonnet-5", provider: "jd-claude", owned_by: "jd" }, | ||
| ] as unknown as CatalogModel[]; | ||
|
|
||
| function build(overrides: { featured?: string[]; modelPickerOrder?: string[] }) { | ||
| const entries = buildCatalogEntriesFromObservedState({ | ||
| template: template() as never, | ||
| gptSlugs: [], | ||
| goModels, | ||
| featured: overrides.featured, | ||
| modelPickerOrder: overrides.modelPickerOrder, | ||
| wsEnabled: false, | ||
| multiAgentMode: "default", | ||
| exactComboSlugs: new Set(), | ||
| accountSelectors: [], | ||
| suppressedBareNativeSlugs: new Set(), | ||
| disabledNativeAccountSlugs: new Set(), | ||
| multiAgentV2Enabled: false, | ||
| }); | ||
| return Object.fromEntries(entries.map(e => { | ||
| const r = e as Record<string, unknown>; | ||
| return [r.slug as string, r.priority as number]; | ||
| })) as Record<string, number>; | ||
| } | ||
|
|
||
| describe("modelPickerOrder (#1649)", () => { | ||
| test("unset leaves every non-featured routed row at the flat default priority", () => { | ||
| const p = build({}); | ||
| expect(p["jd-chat/glm-5.2"]).toBe(5); | ||
| expect(p["jd-chat/kimi-k3"]).toBe(5); | ||
| expect(p["tyler/deepseek-v4-pro"]).toBe(5); | ||
| expect(p["jd-claude/sonnet-5"]).toBe(5); | ||
| }); | ||
|
|
||
| test("listed rows sort in declared order; unlisted rows sort after them", () => { | ||
| const p = build({ | ||
| modelPickerOrder: [ | ||
| "tyler/deepseek-v4-pro", | ||
| "jd-chat/kimi-k3", | ||
| "jd-chat/glm-5.2", | ||
| ], | ||
| }); | ||
| // Declared order is honored. | ||
| expect(p["tyler/deepseek-v4-pro"]).toBeLessThan(p["jd-chat/kimi-k3"]); | ||
| expect(p["jd-chat/kimi-k3"]).toBeLessThan(p["jd-chat/glm-5.2"]); | ||
| // The unlisted row sorts after every listed one. | ||
| expect(p["jd-chat/glm-5.2"]).toBeLessThan(p["jd-claude/sonnet-5"]); | ||
| }); | ||
|
|
||
| test("featured rows keep their top priority ahead of the picker-order band", () => { | ||
| const p = build({ | ||
| featured: ["jd-claude/sonnet-5"], | ||
| modelPickerOrder: ["tyler/deepseek-v4-pro", "jd-chat/kimi-k3"], | ||
| }); | ||
| // Featured wins outright (priority 0). | ||
| expect(p["jd-claude/sonnet-5"]).toBe(0); | ||
| // Picker-order rows come after the featured band. | ||
| expect(p["tyler/deepseek-v4-pro"]).toBeGreaterThan(p["jd-claude/sonnet-5"]); | ||
| expect(p["tyler/deepseek-v4-pro"]).toBeLessThan(p["jd-chat/kimi-k3"]); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.