Skip to content

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

test(team): word expectations, the MausBot's reach, and a Chief crowned earlier keeps working

milind-sonid65b0d43cc62
diff --git a/server/claude-turn-failures.e2e.test.ts b/server/claude-turn-failures.e2e.test.ts
index 44531075fc..c6725a7456 100644
--- a/server/claude-turn-failures.e2e.test.ts
+++ b/server/claude-turn-failures.e2e.test.ts
@@ -125,7 +125,7 @@ it("reports an account's weekly limit with its reset to the person and the Chief
await expect.poll(async () => (await api("GET", "/api/bots")).bots.find((b: any) => b.id === chief.id)?.tasks?.some((t: any) => t.title === "Problems to look at"), { timeout: 20_000 }).toBe(true);
const incidents = (await api("GET", "/api/bots")).bots.find((b: any) => b.id === chief.id).tasks.find((t: any) => t.title === "Problems to look at");
- await expect.poll(async () => (await messages(incidents.threadId)).find((m) => m.kind === "activity" && (m.tool?.name ?? "").startsWith("Incident: "))?.tool.name, { timeout: 20_000 })
+ await expect.poll(async () => (await messages(incidents.threadId)).find((m) => m.kind === "activity" && (m.tool?.name ?? "").includes(" hit a problem: "))?.tool.name, { timeout: 20_000 })
.toMatch(/^Pesto hit a problem: its run .+ failed: "This Claude account has reached its weekly limit, which resets /);
await expect.poll(() => told(incidents.threadId, chief.id), { timeout: 20_000 }).toMatch(LIMIT_WITH_RESET);
expect(told(incidents.threadId, chief.id)).not.toMatch(/stop_sequence|update_required|"quota"/);
diff --git a/server/default-bot.test.ts b/server/default-bot.test.ts
index 92fc38fd1a..0a998cb729 100644
--- a/server/default-bot.test.ts
+++ b/server/default-bot.test.ts
@@ -1,5 +1,6 @@
import { wearsCrown } from "../shared/default-bot.ts";
import { chiefForBot } from "./incidents.ts";
+import { canManage, canReach, hasAuthority } from "./peer-roster.ts";
import { mainChief } from "./host/proactive-owner.ts";
import { readFileSync, rmSync, writeFileSync } from "node:fs";
import { join } from "node:path";
@@ -94,6 +95,15 @@ describe("MausBot, every person's helper", () => {
expect(wearsCrown(own)).toBe(false);
expect(wearsCrown({ chiefOfStaff: true })).toBe(true);
});
+
+ it("reaches no bot everyone sees, even one its person owns: the audience rule, which a crown does not change", () => {
+ const store = place();
+ const own = member(store, ada);
+ const fox = store.createBot({ name: "Fox", reportsTo: ada } as never);
+ expect(hasAuthority(own, fox), "it answers to their Chief").toBe(true);
+ expect(canReach(own, fox)).toBe(false);
+ expect(canManage(own, fox)).toBe(false);
+ });
});
it("gives an existing install without one a MausBot once on update, beside its Chief, which stays exactly as it was", () => {
diff --git a/server/host/chief-notices-retry.test.ts b/server/host/chief-notices-retry.test.ts
index 7edfea48c8..d338cd0423 100644
--- a/server/host/chief-notices-retry.test.ts
+++ b/server/host/chief-notices-retry.test.ts
@@ -222,7 +222,7 @@ describe("the person's line about an incident", () => {
const f = fixture({ threadLanguage: (threadId) => (threadId === "ada-job" ? "de" : undefined) });
f.notices.reportIncident({ kind: "stalled", bot: f.ada as never, threadId: "ada-job", detail: "" });
const row = f.store.messagesFor("notices-1").find((line) => line.kind === "activity") as { tool: { name: string } } | undefined;
- expect(row?.tool.name).toBe("Vorfall: Die Ausführung von Ada im Thread #Invoices wurde gestoppt, weil sie keine Aktivität mehr zeigte");
+ expect(row?.tool.name).toBe("Ada hatte ein Problem: Die Ausführung im Thread #Invoices wurde gestoppt, weil sie keine Aktivität mehr zeigte");
expect(f.turnsOf("chief")[0]!.text).toContain("Ada's run in its thread #Invoices stopped after showing no activity");
});
});
diff --git a/server/question-cards.e2e.test.ts b/server/question-cards.e2e.test.ts
index 9bf4028ba1..d843aa0bf5 100644
--- a/server/question-cards.e2e.test.ts
+++ b/server/question-cards.e2e.test.ts
@@ -9,6 +9,7 @@ import { existsSync, readFileSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { afterAll, beforeAll, expect, it } from "vitest";
import { launchCloudSendFixture, type CloudSendFixture, type CloudTeamFixture } from "../scripts/testing/cloud-send-fixture.ts";
+import { chiefCrownedEarlier } from "./testing/team-earlier-chief.ts";
import { hostTimeout } from "./testing/host-timeout.ts";
const CLEO = { email: "[email protected]", role: "owner" as const };
@@ -112,8 +113,7 @@ beforeAll(async () => {
expect(created.status, JSON.stringify(created.body)).toBe(201);
return created.body.bot as Bot;
};
- scout = await create({ name: "Scout", reportsTo: CLEO.email });
- expect((await team.as(cleo, "PATCH", `/api/bots/${scout.id}`, { chiefOfStaff: true })).status).toBe(200);
+ scout = await chiefCrownedEarlier<Bot>(team, cleo, "Scout", CLEO.email);
ledger = await create({ name: "Ledger", reportsTo: CLEO.email });
// Questions reach the person on "Ask me first"; at Full access, the default, the requesting bot decides them instead.
for (const bot of [scout, ledger]) expect((await team.as(cleo, "PATCH", `/api/bots/${bot.id}`, { approvalMode: "ask", applyToAllThreads: true })).status).toBe(200);
diff --git a/server/question-routing.e2e.test.ts b/server/question-routing.e2e.test.ts
index ff116c806e..e8448b4c49 100644
--- a/server/question-routing.e2e.test.ts
+++ b/server/question-routing.e2e.test.ts
@@ -12,6 +12,7 @@ import { join } from "node:path";
import { afterAll, beforeAll, describe, expect, it } from "vitest";
import { launchCloudSendFixture, type CloudSendFixture, type CloudTeamFixture } from "../scripts/testing/cloud-send-fixture.ts";
import { removeTempDir } from "./testing/cleanup.ts";
+import { chiefCrownedEarlier } from "./testing/team-earlier-chief.ts";
import { hostTimeout } from "./testing/host-timeout.ts";
const MARCO = { email: "[email protected]", role: "owner" as const };
@@ -86,8 +87,7 @@ beforeAll(async () => {
expect(created.status, JSON.stringify(created.body)).toBe(201);
return created.body.bot as Bot;
};
- fuchs = await create({ name: "Fuchs", reportsTo: MARCO.email });
- expect((await team.as(marco, "PATCH", `/api/bots/${fuchs.id}`, { chiefOfStaff: true })).status).toBe(200);
+ fuchs = await chiefCrownedEarlier<Bot>(team, marco, "Fuchs", MARCO.email);
dachs = await create({ name: "Dachs", reportsTo: MARCO.email });
otter = await create({ name: "Otter", reportsTo: MARCO.email });
expect((await team.as(marco, "PATCH", `/api/bots/${dachs.id}`, { computer: "browser" })).status).toBe(200);
diff --git a/server/runtime-paths.e2e.test.ts b/server/runtime-paths.e2e.test.ts
index 16982b1637..5d2c92a37e 100644
--- a/server/runtime-paths.e2e.test.ts
+++ b/server/runtime-paths.e2e.test.ts
@@ -142,7 +142,7 @@ it("R1 a routine run coordinates a teammate, waits, and completes through a rout
await f.awaitReady("r1-peer");
await expect.poll(async () => (await f.runState(run.id))?.status, { timeout: 30_000 }).toBe("waiting");
- expect((await f.runState(run.id)).attention).toContain("delegated");
+ expect((await f.runState(run.id)).attention).toContain("handed on");
expect((await f.runState(run.id)).finishedAt).toBeUndefined();
const root = f.roots()[0];
expect(root).toMatchObject({ threadId: run.threadId, botId: f.owner.id });
diff --git a/server/testing/team-earlier-chief.ts b/server/testing/team-earlier-chief.ts
new file mode 100644
index 0000000000..ac62dd04f9
--- /dev/null
+++ b/server/testing/team-earlier-chief.ts
@@ -0,0 +1,16 @@
+import { readFileSync } from "node:fs";
+import { join } from "node:path";
+
+import type { CloudTeamFixture } from "../../scripts/testing/cloud-send-fixture.ts";
+
+/** A person's own Chief from before their MausBot became it: a crown no route gives a bot someone owns any more, reached
+ * by handing them the team's own Chief before their first look at the bots makes their MausBot. */
+export async function chiefCrownedEarlier<T>(team: CloudTeamFixture, token: string, name: string, email: string): Promise<T> {
+ const bots = JSON.parse(readFileSync(join(team.home, ".openmausbot", "bots.json"), "utf8")) as Array<{ id: string; chiefOfStaff?: boolean }>;
+ const chief = bots.find((bot) => bot.chiefOfStaff)!;
+ const renamed = await team.as(token, "PATCH", `/api/bots/${chief.id}`, { name });
+ if (renamed.status !== 200) throw new Error(`rename: ${JSON.stringify(renamed.body)}`);
+ const handed = await team.as(token, "PUT", `/api/bots/${chief.id}/reports-to`, { email });
+ if (handed.status !== 200) throw new Error(`hand over: ${JSON.stringify(handed.body)}`);
+ return handed.body.bot as T;
+}
diff --git a/server/thread-capacity-api.test.ts b/server/thread-capacity-api.test.ts
index 11da36b03f..7aea5c6949 100644
--- a/server/thread-capacity-api.test.ts
+++ b/server/thread-capacity-api.test.ts
@@ -518,7 +518,7 @@ describe("per-bot thread capacity through an isolated HTTP fixture", () => {
expect(held.workThread).not.toBe(queued.workThread);
finish(second.threadId);
await expect.poll(async () => (await runState(second.runId))?.status, { timeout: 15_000 }).toBe("waiting");
- expect((await runState(second.runId)).attention).toContain("delegated");
+ expect((await runState(second.runId)).attention).toContain("handed on");
expect((await busyThreads(target.botId)).sort()).toEqual([target.threads[0], queued.workThread].sort());
expect(existsSync(threadFile(held.workThread, "json"))).toBe(false);
diff --git a/src/components/BrowserProfilesManager.test.ts b/src/components/BrowserProfilesManager.test.ts
index 3c466db928..7caf33df86 100644
--- a/src/components/BrowserProfilesManager.test.ts
+++ b/src/components/BrowserProfilesManager.test.ts
@@ -102,7 +102,7 @@ describe("browser profile manager", () => {
fixture.engine = { myChrome: false, myChromeLendable: true };
fixture.profiles = [{ id: "work", name: "Work", browser: "chrome" }];
const html = renderToStaticMarkup(createElement(BrowserProfilesManager));
- expect(html).toContain("it lends its Chrome by itself");
+ expect(html).toContain("it shares its Chrome by itself");
expect(html).toContain("bots on a My Chrome profile can&#x27;t browse");
expect(html).toContain("switching a profile to Built-in works too");
expect(html).not.toContain("there is no Chrome of yours to use");
@@ -112,7 +112,7 @@ describe("browser profile manager", () => {
fixture.engine = { myChrome: false, myChromeLendable: true };
fixture.profiles = [{ id: "work", name: "Work" }];
const html = renderToStaticMarkup(createElement(BrowserProfilesManager));
- expect(html).toContain("it lends its Chrome by itself");
+ expect(html).toContain("it shares its Chrome by itself");
expect(html).not.toContain("this profile&#x27;s bots");
});
@@ -124,7 +124,7 @@ describe("browser profile manager", () => {
expect(html).not.toContain("Signed-in sites");
const botPanel = renderToStaticMarkup(createElement(BrowserProfilesManager, { bot })).split("<details")[0]!;
expect(botPanel).toContain("act inside your real Chrome");
- expect(botPanel).toContain("it lends its Chrome by itself");
+ expect(botPanel).toContain("it shares its Chrome by itself");
expect(botPanel).not.toContain("Signed-in sites");
});
diff --git a/src/components/whats-new/TeamPicture.test.ts b/src/components/whats-new/TeamPicture.test.ts
index b83f80b936..84f0db76e1 100644
--- a/src/components/whats-new/TeamPicture.test.ts
+++ b/src/components/whats-new/TeamPicture.test.ts
@@ -22,7 +22,7 @@ afterEach(async () => { await act(async () => root.unmount()); host.remove(); de
it("is one labelled picture: four teammates, each with a Chief of Staff of their own, around the team's shared bots in two departments", async () => {
await render();
const picture = host.querySelector('svg[role="img"]')!;
- expect(picture.getAttribute("aria-label")).toBe("Ada, Ben, Cleo and Dara, each with their own Chief of Staff, share the team's Support and Sales bots on one Team Cloud.");
+ expect(picture.getAttribute("aria-label")).toBe("Ada, Ben, Cleo and Dara, each with their own MausBot, share the team's Support and Sales bots on one Team Cloud.");
expect(texts()).toEqual(["Support", "Sales", "A", "Ada", "B", "Ben", "C", "Cleo", "D", "Dara"]);
expect(mascots().map(node => node.dataset.maus), "the departments' bots, then each person's Chief").toEqual(["cyan", "blue", "pink", "orange", "pink", "green", "yellow", "cyan"]);
expect(host.querySelectorAll('path[d^="M0 5.5"]'), "a crown on each Chief").toHaveLength(4);
diff --git a/src/components/whats-new/WhatsNewPopup.test.ts b/src/components/whats-new/WhatsNewPopup.test.ts
index 6ef392969e..70c3a9b27b 100644
--- a/src/components/whats-new/WhatsNewPopup.test.ts
+++ b/src/components/whats-new/WhatsNewPopup.test.ts
@@ -97,15 +97,15 @@ describe("the What's new popup", () => {
expect(props.onDone).not.toHaveBeenCalled();
});
- it("the Team slide: shared bots first, each person's own Chief of Staff and inbox, what the team shares, its picture and Start a Team", async () => {
+ it("the Team slide: shared bots first, each person's own MausBot as their inbox, what the team shares, its picture and Start a Team", async () => {
await show(TEAM_ONLY);
const slide = live();
expect(title()).toBe(TEAM);
- expect(slide.textContent).toContain("Everyone chats with the same bots, like one Support bot and one Sales bot, and hands them work. Each person still has their own Chief of Staff and inbox.");
+ expect(slide.textContent).toContain("Everyone chats with the same bots, like one Support bot and one Sales bot, and hands them work. Each person's own MausBot is their inbox: anything for them lands there.");
for (const point of ["Connected apps, set up once for everyone", "Group chats with teammates and bots together", "Team memory the bots share",
- "Bots hand work to each other across the team", "Choose who can see, chat with or edit each bot"]) expect(slide.textContent).toContain(point);
+ "Bots hand work to each other across the team", "Choose who can use each bot"]) expect(slide.textContent).toContain(point);
expect(slide.textContent).toContain("Free for 3 days, then $169/month + tax");
- expect(slide.querySelector('svg[role="img"]')!.getAttribute("aria-label")).toBe("Ada, Ben, Cleo and Dara, each with their own Chief of Staff, share the team's Support and Sales bots on one Team Cloud.");
+ expect(slide.querySelector('svg[role="img"]')!.getAttribute("aria-label")).toBe("Ada, Ben, Cleo and Dara, each with their own MausBot, share the team's Support and Sales bots on one Team Cloud.");
expect([...slide.querySelectorAll("button")].map(item => item.textContent)).toEqual(["Start a Team"]);
expect(button("Next")).toBeUndefined(); expect(button("Back")).toBeUndefined(); expect(button("Slide 1 of 1"), "one slide has no dots").toBeUndefined();
expect(steps).toEqual([["seen", "team"]]);