Skip to content

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

MausBot's notification tools refuse on any shared workspace, not only a Team Cloud (#3961)

Caleb Arumugama52829ea97f2
diff --git a/server/default-bot.e2e.test.ts b/server/default-bot.e2e.test.ts
index 4bc20a50a0..db90b199bc 100644
--- a/server/default-bot.e2e.test.ts
+++ b/server/default-bot.e2e.test.ts
@@ -80,7 +80,7 @@ it("makes MausBot a new install's first bot, never deleted, hidden by its switch
}
}, 120_000);
-it("lets MausBot read the unread notifications and mark finished work read, and gives no other bot the tools", async () => {
+it("lets MausBot read the unread notifications and mark finished work read, not once sign-in members share the workspace, and gives no other bot the tools", async () => {
const fixture = await launchVerificationServer({ ...process.env, FAKE_CLAUDE_MODE: "hang" });
const api = async (path: string) => (await (await fetch(`${fixture.info.url}${path}`, { signal: AbortSignal.timeout(10_000) })).json()) as any;
const control = (args: string[]) => runControlOmb([...args, "--url", fixture.info.url]) as Promise<any>;
@@ -106,6 +106,15 @@ it("lets MausBot read the unread notifications and mark finished work read, and
expect(text(marked)).toContain("no-such-notification: not an unread notification");
expect((await callTool(agents, "mark_notifications_read", { ids: "all" })).result?.isError).toBe(true);
+ // Sign-in members make the workspace shared: the app filters the feed per viewer, which the bot cannot be.
+ const shared = await fetch(`${fixture.info.url}/api/config`, { method: "PUT", headers: { "content-type": "application/json" },
+ body: JSON.stringify({ signIn: { admins: ["[email protected]"], members: ["[email protected]"] } }), signal: AbortSignal.timeout(10_000) });
+ expect(shared.status, await shared.text()).toBe(200);
+ const refused = await callTool(agents, "list_unread_notifications", {});
+ expect(refused.result?.isError, text(refused)).toBe(true);
+ expect(text(refused)).toContain("read in the app");
+ expect((await callTool(agents, "mark_notifications_read", { ids: ["no-such-notification"] })).result?.isError).toBe(true);
+
const { bot: clive } = await control(["new-bot", "--name", "Clive"]);
const other = await launch(clive.id);
expect(other.env.OMB_MAUSBOT).toBe("0");
diff --git a/server/index.ts b/server/index.ts
index fcf42a80f1..6c126741bc 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -12594,7 +12594,7 @@ ROUTES.push(createBrowserViewerRoutes({
restartRefusal: (session) => browserRestartRefusal(browserRuntime.interrupted(session), store.bots.filter((candidate) => candidate.busy
&& browserSessionsOf(candidate.id, candidate.browserProfile).includes(session)).map((candidate) => ({ waitingOnBrowser: computerControl.snapshot(candidate.id).help?.place === "browser" }))),
}));
-const internalToolRoutes = createInternalToolRoutes({ helpers: { decider, extractor }, notifications: { bot: (id) => store.bot(id), team: () => CLOUD_TEAM !== null, broadcast }, xResearch: { credential: () => researchCredential(cfg.treg?.key), botEnabled: (botId) => store.bot(botId)?.xResearch !== false, cloudHome: CLOUD_HOME !== null, researchOff: () => researchAvailability.refused() } }); const waitRoutes = createWaitRoutes({ waits: botWaits, cloudHome: Boolean(CLOUD_HOME), sleeps: Boolean(CLOUD_HOME) && CLOUD_TEAM === null }); ROUTES.push(createXConnectorRoutes({ credential: () => researchCredential(cfg.treg?.key), included: () => xCredential(), unavailable: () => xResearchStatus().unavailable === true }));
+const internalToolRoutes = createInternalToolRoutes({ helpers: { decider, extractor }, notifications: { bot: (id) => store.bot(id), team: sharedMembership, broadcast }, xResearch: { credential: () => researchCredential(cfg.treg?.key), botEnabled: (botId) => store.bot(botId)?.xResearch !== false, cloudHome: CLOUD_HOME !== null, researchOff: () => researchAvailability.refused() } }); const waitRoutes = createWaitRoutes({ waits: botWaits, cloudHome: Boolean(CLOUD_HOME), sleeps: Boolean(CLOUD_HOME) && CLOUD_TEAM === null }); ROUTES.push(createXConnectorRoutes({ credential: () => researchCredential(cfg.treg?.key), included: () => xCredential(), unavailable: () => xResearchStatus().unavailable === true }));
// Live calls: the client holds the WebRTC audio; the key never leaves the harness, which creates the session.
function liveBotFor(botId: string): LiveBot {
diff --git a/server/mausbot-notifications.test.ts b/server/mausbot-notifications.test.ts
index 3c77c07370..8621ca0b2a 100644
--- a/server/mausbot-notifications.test.ts
+++ b/server/mausbot-notifications.test.ts
@@ -98,14 +98,14 @@ describe("who may", () => {
expect(listUnread(host, id)).toEqual({ ok: false, error: "Only MausBot reads notifications in chat." });
expect(markRead(host, id, ["a"])).toMatchObject({ ok: false });
}
- expect(listUnread(host, "ada")).toMatchObject({ ok: false, error: expect.stringContaining("On a team") });
+ expect(listUnread(host, "ada")).toMatchObject({ ok: false, error: expect.stringContaining("read in the app") });
expect(markRead(host, "ada", ["a"])).toMatchObject({ ok: false });
expect(rows[0]!.read).toBe(false);
});
- it("refuses on any team server, even for a MausBot with no person", () => {
+ it("refuses on any shared workspace, even for a MausBot with no person", () => {
const { host, rows } = setup([entry("a", "done")], [MAUS], true);
- expect(listUnread(host, "maus")).toMatchObject({ ok: false, error: expect.stringContaining("On a team") });
+ expect(listUnread(host, "maus")).toMatchObject({ ok: false, error: expect.stringContaining("read in the app") });
expect(markRead(host, "maus", ["a"])).toMatchObject({ ok: false });
expect(rows[0]!.read).toBe(false);
});
diff --git a/server/mausbot-notifications.ts b/server/mausbot-notifications.ts
index fc3b50b5a4..9842399e72 100644
--- a/server/mausbot-notifications.ts
+++ b/server/mausbot-notifications.ts
@@ -8,7 +8,7 @@ export interface NotificationsHost {
markRead(ids: readonly string[]): void;
announceRead(threadId: string, ids: string[]): void;
now(): number;
- /** A Team Cloud: the feed is filtered per viewer by the app, which a bot cannot be. */
+ /** A shared workspace (a Team Cloud, or sign-in members): the feed is filtered per viewer by the app, which a bot cannot be. */
team(): boolean;
}
@@ -56,7 +56,7 @@ export type NotificationsResult = { ok: true; text: string } | { ok: false; erro
function refusal(host: NotificationsHost, botId: string): string | null {
const bot = host.bot(botId);
if (!holdsMausBotTools(bot)) return "Only MausBot reads notifications in chat.";
- return bot.defaultBot?.person || host.team() ? "On a team, notifications are read in the app; I cannot go through them for you." : null;
+ return bot.defaultBot?.person || host.team() ? "Where several people share this workspace, notifications are read in the app; I cannot go through them for you." : null;
}
export function listUnread(host: NotificationsHost, botId: string): NotificationsResult {