Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
MCP cards test: wait for the resumed turn before repeating the answer
milind-sonic86e21f6e479
diff --git a/server/mcp-cards.e2e.test.ts b/server/mcp-cards.e2e.test.tsindex 27b28b86dc..739698f0c2 100644--- a/server/mcp-cards.e2e.test.ts+++ b/server/mcp-cards.e2e.test.ts@@ -10,7 +10,7 @@ const FAKE_MCP = fileURLToPath(new URL("./testing/fake-mcp-server.ts", import.measync function onAsk(run: (f: {api: (method: string, path: string, body?: unknown, expected?: number, token?: string) => Promise<any>;- dump: () => any; config: () => any; iris: { id: string; threadId: string }; card: () => Promise<any>; parkOnCard: () => Promise<any>;+ dump: () => any; config: () => any; iris: { id: string; threadId: string }; card: () => Promise<any>; parkOnCard: () => Promise<any>; idle: () => Promise<void>;}) => Promise<void>) {const scratch = mkdtempSync(join(tmpdir(), "omb-mcp-card-"));const gate = join(scratch, "finish");@@ -30,6 +30,7 @@ async function onAsk(run: (f: {const iris = (await api("POST", "/api/bots", { name: "Iris" }, 201)).bot;await api("PATCH", `/api/bots/${iris.id}`, { approvalMode: "ask" });const card = async () => (await api("GET", `/api/threads/${iris.threadId}/messages`)).messages.find((message: any) => message.card?.mcpRequest);+ const idle = () => expect.poll(async () => (await api("GET", "/api/bots")).bots.every((bot: any) => !bot.busy), { timeout: 20_000 }).toBe(true);const parkOnCard = async () => {await api("POST", `/api/bots/${iris.id}/messages`, { threadId: iris.threadId, text: "Add the notes server", sendId: "mcp-card-e2e-send-0001" }, 202);let first: any;@@ -41,17 +42,17 @@ async function onAsk(run: (f: {writeFileSync(gate, "");let shown: any;await expect.poll(async () => { shown = await card(); return shown?.card.title; }, { timeout: 20_000 }).toBe("Turn on notes?");- await expect.poll(async () => (await api("GET", "/api/bots")).bots.find((bot: any) => bot.id === iris.id)?.busy, { timeout: 20_000 }).toBe(false);+ await idle();return shown;};- await run({ api, dump, config, iris, card, parkOnCard });+ await run({ api, dump, config, iris, card, parkOnCard, idle });} finally {await fixture.close();rmSync(scratch, { recursive: true, force: true });}}-it("a bot on Ask adds a server switched off, the person taps Turn on, and the bot resumes with the test result and the server's tools", () => onAsk(async ({ api, dump, config, iris, card, parkOnCard }) => {+it("a bot on Ask adds a server switched off, the person taps Turn on, and the bot resumes with the test result and the server's tools", () => onAsk(async ({ api, dump, config, iris, card, parkOnCard, idle }) => {const shown = await parkOnCard();expect(shown.card).toMatchObject({ options: ["Turn on", "Cancel"], tool: "mcp_server", mcpRequest: { action: "enable", name: "notes" } });expect(shown.card.subtitle).toMatch(/fake-mcp-server\.ts\nRuns on this computer\.$/u);@@ -66,6 +67,8 @@ it("a bot on Ask adds a server switched off, the person taps Turn on, and the boexpect(resumed.mcpConfig.mcpServers.notes, "the resumed turn already has the server").toBeDefined();await expect.poll(async () => (await card()).card.mcpRequest.resumed, { timeout: 20_000 }).toBe(true);expect((await card()).card.answered).toBe("allow");+ // A local browser's approval is refused while any bot works, and the resumed turn may still be working.+ await idle();expect((await api("POST", `/api/threads/${iris.threadId}/respond`, { requestId: shown.card.requestId, behavior: "allow" })).alreadySettled).toBe(true);}), 90_000);