Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(models): list discovered catalogs for custom ACP engines in both pickers

zhangqianfengfa4f7299fc1f
diff --git a/src/components/ModelPicker.tsx b/src/components/ModelPicker.tsx
index 98fa5b24d8..cef0db57bd 100644
--- a/src/components/ModelPicker.tsx
+++ b/src/components/ModelPicker.tsx
@@ -313,7 +313,7 @@ export function ModelPicker({
// never local models.
const hasOfficialModels = Boolean(railInstance?.snapshot.chatgptPlan || railInstance?.models.options.some((option) => !option.custom));
const customOnly = isCustomOnly(railInstance);
- const { pane, setPane, loading: loadingList } = usePickerPane({ instanceId: displayedInstanceId, railId, hasOfficialModels, customOnly,
+ const { pane, setPane, loading: loadingList } = usePickerPane({ instanceId: displayedInstanceId, railId, hasOfficialModels, customOnly: customOnly && !hasOfficialModels,
reading: open && (loadingInstances || refreshingId !== null),
selectedIsCustom: Boolean(railInstance?.models.options.some((option) => option.id === selection.model && option.custom)) }, () => resetList());
@@ -368,7 +368,7 @@ export function ModelPicker({
const selectedIsCustom = instance?.models.options.some(
(option) => option.id === selection.model && option.custom,
);
- setPane(selectedIsCustom || isCustomOnly(instance) || (official.length === 0 && !instance?.snapshot.chatgptPlan) ? "custom" : "main");
+ setPane(selectedIsCustom || (official.length === 0 && !instance?.snapshot.chatgptPlan) ? "custom" : "main");
resetList();
};
@@ -405,7 +405,7 @@ export function ModelPicker({
if (signInFamily(instance) === "openai") lastOpenaiIdRef.current = instance.instanceId;
setRailId(instance.instanceId);
const official = instance.models.options.filter((option) => !option.custom);
- setPane(isCustomOnly(instance) || (official.length === 0 && !instance.snapshot.chatgptPlan) ? "custom" : "main");
+ setPane(official.length === 0 && !instance.snapshot.chatgptPlan ? "custom" : "main");
resetList();
};
@@ -513,7 +513,7 @@ export function ModelPicker({
: needsCli(railInstance) || needsSignIn(railInstance)
: false;
const canOpenCustom = Boolean(railInstance && !needsCli(railInstance));
- const canReturnToOfficial = official.length > 0 && !isCustomOnly(railInstance);
+ const canReturnToOfficial = official.length > 0;
const lookingForLocal = Boolean(railInstance && probing.has(railInstance.instanceId));
const lookingForLocalStatus = (
<div role="status" className={cn(MENU_LINE, "justify-center text-ink-tertiary")}>
diff --git a/src/lib/simple-model-menu.test.ts b/src/lib/simple-model-menu.test.ts
index ea446dc353..ad9aa3839d 100644
--- a/src/lib/simple-model-menu.test.ts
+++ b/src/lib/simple-model-menu.test.ts
@@ -262,6 +262,25 @@ describe("a model the organization turned off", () => {
});
});
+describe("custom ACP engine with a discovered catalog", () => {
+ // A customAcp engine (e.g. Devin) ships a discovered catalog whose options are NOT marked
+ // `custom`; the menu must list them instead of collapsing to hand-added models only.
+ const devin = engine("devin", "customAcp", "Devin", "custom", [
+ { id: "agent-default", label: "Agent default", custom: true },
+ { id: "swe-2-high", label: "SWE-2", variants: [{ id: "medium", label: "Medium" }, { id: "high", label: "High" }, { id: "max", label: "Max" }] },
+ { id: "deepseek-v4-1-flash-high", label: "DeepSeek V4.1 Flash" },
+ ]);
+ const devinSelection: ModelSelection = { instanceId: "devin", model: "swe-2-high", variant: "high" };
+
+ it("lists discovered catalog models alongside hand-added ones", () => {
+ const built = menu([devin], { selection: devinSelection, bot: { name: "Pepper", selection: devinSelection } });
+ const labels = rows(built);
+ expect(labels).toContain("SWE-2");
+ expect(labels).toContain("DeepSeek V4.1 Flash");
+ expect(labels).toContain("Agent default");
+ });
+});
+
describe("custom Claude endpoint", () => {
// The driver marks every endpoint catalog option `custom`; the picker keeps exactly those.
const endpoint = claude({ access: "custom" }, [
diff --git a/src/lib/simple-model-menu.ts b/src/lib/simple-model-menu.ts
index fa3433b0d7..999a086b6c 100644
--- a/src/lib/simple-model-menu.ts
+++ b/src/lib/simple-model-menu.ts
@@ -114,7 +114,7 @@ export function repeatedModelLabels(options: readonly ModelOption[]): Set<string
function listedModels(instance: InstanceInfo) {
const signedOut = !isCustomOnly(instance) && needsSignIn(instance);
- const own = isCustomOnly(instance) || signedOut ? [] : modelChoices(instance, instance.models.options.filter((option) => !option.custom));
+ const own = signedOut ? [] : modelChoices(instance, instance.models.options.filter((option) => !option.custom));
const local = partitionCustomModels(instance.models.options.filter((option) => option.custom));
return { signedOut, own, all: [...own, ...local.pinned, ...local.rest] };
}