Skip to content

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

Sign-out notice: name the bots that can't run as a list, and expect it in the e2e

milind-soni63d4ae8775a9
diff --git a/server/limit-notices.test.ts b/server/limit-notices.test.ts
index c8a9362f6e..f86c0b10b6 100644
--- a/server/limit-notices.test.ts
+++ b/server/limit-notices.test.ts
@@ -67,6 +67,8 @@ describe("the notice", () => {
it("names up to three bots a signed-out AI leaves stuck, and none when a backup carries on", () => {
const base = { engine: "Claude", bot: "Kai", where: "on the Cloud" };
expect(signedOutNoticeText({ ...base, stuck: ["Kai"] })).toBe("Claude is signed out on the Cloud. Sign in again in Settings → AI to keep using it. Until then Kai can't run: it has no backup.");
+ expect(signedOutNoticeText({ ...base, stuck: ["Kai", "Rosa"] })).toContain("Until then Kai and Rosa can't run: they have no backup.");
+ expect(signedOutNoticeText({ ...base, stuck: ["Kai", "Rosa", "Lin"] })).toContain("Until then Kai, Rosa and Lin can't run: they have no backup.");
expect(signedOutNoticeText({ ...base, stuck: ["Kai", "Rosa", "Lin", "Ada", "Bo"] })).toContain("Until then Kai, Rosa, Lin and 2 more can't run: they have no backup.");
expect(signedOutNoticeText({ ...base, stuck: [] })).toBe("Claude is signed out on the Cloud. Sign in again in Settings → AI to keep using it.");
expect(signedOutNoticeText({ ...base, backup: "Codex", stuck: ["Kai"] })).not.toContain("Until then");
diff --git a/server/limit-notices.ts b/server/limit-notices.ts
index 09777fcfac..d07865ddbc 100644
--- a/server/limit-notices.ts
+++ b/server/limit-notices.ts
@@ -40,7 +40,8 @@ export function limitNoticeText(facts: LimitNoticeFacts, timeZone?: string): str
export function signedOutNoticeText(facts: { engine: string; bot: string; backup?: string; where: string; stuck?: readonly string[] }): string {
if (facts.backup) return `${facts.engine} is signed out ${facts.where}, so ${facts.bot} is using ${facts.backup} meanwhile. Sign in again in Settings → AI to keep using ${facts.engine}.`;
const stuck = facts.stuck ?? [];
- const shown = stuck.slice(0, 3).join(", ") + (stuck.length > 3 ? ` and ${stuck.length - 3} more` : "");
+ const shown = stuck.length > 3 ? `${stuck.slice(0, 3).join(", ")} and ${stuck.length - 3} more`
+ : stuck.length > 1 ? `${stuck.slice(0, -1).join(", ")} and ${stuck.at(-1)}` : stuck[0];
return `${facts.engine} is signed out ${facts.where}. Sign in again in Settings → AI to keep using it.${stuck.length ? ` Until then ${shown} can't run: ${stuck.length === 1 ? "it has" : "they have"} no backup.` : ""}`;
}
diff --git a/server/limit-reset.e2e.test.ts b/server/limit-reset.e2e.test.ts
index e9476d0a3a..69953e44cd 100644
--- a/server/limit-reset.e2e.test.ts
+++ b/server/limit-reset.e2e.test.ts
@@ -403,7 +403,8 @@ it.each([
const { bot } = await control("new-bot", "--name", "Kai");
const threadId = bot.activeTaskId;
if (recovering) await api("PUT", "/api/config", { automaticRecovery: { enabled: true, backup: bot.modelSelection } });
- const told = "Verification fixture is signed out on this computer. Sign in again in Settings → AI to keep using it.";
+ // The fixture's starter bot is on the same Claude with no backup too, so the one notice names both (#5136).
+ const told = "Verification fixture is signed out on this computer. Sign in again in Settings → AI to keep using it. Until then Kai and Fixture Starter can't run: they have no backup.";
await control("send", "--bot", bot.id, "--task", threadId, "--text", "Draft the launch plan");
expect((await control("wait", "--bot", bot.id, "--task", threadId, "--timeout", "30")).status).toBe("failed");
await control("send", "--bot", bot.id, "--task", threadId, "--text", "Are you there?");