Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
test: two e2e tests stop failing on a busy CI runner (#3781)
Milind Sonid3a31ef1b002
diff --git a/server/live-call.e2e.test.ts b/server/live-call.e2e.test.tsindex 0f2c349646..84c93f744e 100644--- a/server/live-call.e2e.test.ts+++ b/server/live-call.e2e.test.ts@@ -473,7 +473,8 @@ posixOnly("Live call e2e", () => {const lines = async (): Promise<Line[]> => ((await (await fetch(`${base}/api/threads/${bot.threadId}/messages`)).json()) as { messages: Line[] }).messages;const original = (await lines()).find((m) => m.card?.requestId)!;expect((await post(`/api/bots/${bot.id}/interrupt`, { threadId: bot.threadId })).status).toBe(200);- await expect.poll(() => isBusy(bot.id), { timeout: 5_000 }).toBe(false);+ // Stop ends the turn; a loaded CI runner can take longer than a few seconds to wind the fake engine down.+ await expect.poll(() => isBusy(bot.id), { timeout: 15_000 }).toBe(false);live.emit(session.id, { type: "session.input_transcript.delta", delta: "Green", start_ms: 5_000, end_ms: 5_300 });live.emit(session.id, { type: "session.delegation.created", offset_ms: 5_400, delegation: { id: "del_late", target: "client" } });await expect.poll(async () => (await lines()).find((m) => m.id === original.id)?.card, { timeout: 5_000 }).toMatchObject({ answered: "answer", answeredText: "Green", answeredBy: { kind: "loopback", via: "call" } });@@ -483,7 +484,7 @@ posixOnly("Live call e2e", () => {await post(`/api/bots/${bot.id}/interrupt`, { threadId: bot.threadId });await post("/api/live/call/end", { callId: call.callId });}- }, 40_000);+ }, 60_000);it("ends the call and tells clients when the sideband drops", async () => {const bot = await createBot();diff --git a/server/usage-attribution.e2e.test.ts b/server/usage-attribution.e2e.test.tsindex c655bb7f2d..d0e9eca342 100644--- a/server/usage-attribution.e2e.test.ts+++ b/server/usage-attribution.e2e.test.ts@@ -56,7 +56,9 @@ posixOnly("usage attribution e2e", () => {const ledger = (botId: string) => {const file = join(home, ".openmausbot", "usage", `${new Date().toISOString().slice(0, 7)}.jsonl`);if (!existsSync(file)) return [];- return readFileSync(file, "utf8").trim().split("\n").filter(Boolean).map((line) => JSON.parse(line)).filter((row) => row.botId === botId);+ // The server may be appending a line as this reads: only complete lines count, and the caller's wait reads again.+ const text = readFileSync(file, "utf8");+ return text.slice(0, text.lastIndexOf("\n") + 1).split("\n").filter(Boolean).map((line) => JSON.parse(line)).filter((row) => row.botId === botId);};const newBot = async (instanceId: string, model: string) => {const created = (await api("POST", "/api/bots")).body.bot;