Skip to content

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

fix(settings): count backup-AI use before offering Hide on an account row

AdityaUmale81598a86f7fd
diff --git a/src/components/EngineAccounts.tsx b/src/components/EngineAccounts.tsx
index 0af831ca95..e28b14d354 100644
--- a/src/components/EngineAccounts.tsx
+++ b/src/components/EngineAccounts.tsx
@@ -76,7 +76,7 @@ function AccountMenu({ group, instance, onRename }: { group: AccountGroup; insta
const [error, setError] = useState<string | null>(null);
const menuRef = useRef<HTMLDivElement>(null);
const { signOut: canSignOut, remove: canRemove, hide: canHide } = accountActions(group, instance);
- const usedBy = state.bots.filter((bot) => bot.modelSelection.instanceId === instance.instanceId).length;
+ const usedBy = state.bots.filter((bot) => bot.modelSelection.instanceId === instance.instanceId || bot.fallback?.some((backup) => backup.instanceId === instance.instanceId)).length;
useEffect(() => {
if (!open) return;
diff --git a/src/components/EnginesSettings.hidden-providers.dom.test.ts b/src/components/EnginesSettings.hidden-providers.dom.test.ts
index ec6631a893..d1fdb2b6c0 100644
--- a/src/components/EnginesSettings.hidden-providers.dom.test.ts
+++ b/src/components/EnginesSettings.hidden-providers.dom.test.ts
@@ -280,4 +280,12 @@ describe("Settings → AI → ChatGPT: the built-in account rows can be hidden",
expect(hide?.disabled).toBe(true);
expect(container.textContent).toContain(t("accounts.inUse", { count: "1" }));
});
+
+ it("won't hide an account a bot only keeps as a backup AI", async () => {
+ fixture.state = { ...fixture.state, bots: [{ modelSelection: { instanceId: "codex" }, fallback: [{ instanceId: "chatgpt", model: "gpt-5" }] } as Bot] };
+ await openCard();
+ const hide = (await menuItems("chatgpt")).find((item) => item.textContent === "Hide");
+ expect(hide?.disabled).toBe(true);
+ expect(container.textContent).toContain(t("accounts.inUse", { count: "1" }));
+ });
});