Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
test: drain queued handoff turns before asserting idle
Zhehui Bi74b3f905a5d8
diff --git a/server/cloud-lending-memory.e2e.test.ts b/server/cloud-lending-memory.e2e.test.tsindex e36a04129f..216e370136 100644--- a/server/cloud-lending-memory.e2e.test.ts+++ b/server/cloud-lending-memory.e2e.test.ts@@ -121,8 +121,18 @@ async function leftBehind(of: { threadIds?: string[]; routineIds?: string[] }, sasync function stopRunningTurns() {const running = async () => ((await api("GET", "/api/bots?messages=0", { token: owner })).body.bots as Array<{ id: string; tasks?: Array<{ threadId: string; busy?: boolean }> }>).flatMap((bot) => (bot.tasks ?? []).filter((task) => task.busy).map((task) => ({ bot, threadId: task.threadId })));- for (const { bot, threadId } of await running()) await stop(bot, threadId);- await expect.poll(async () => (await running()).length, { timeout: 10_000 }).toBe(0);+ let quietSince = 0;+ await expect.poll(async () => {+ const active = await running();+ if (active.length) {+ // A queued hand-off may start after the first Stop; drain each newly busy turn too.+ quietSince = 0;+ for (const { bot, threadId } of active) await stop(bot, threadId);+ return false;+ }+ if (!quietSince) quietSince = Date.now();+ return Date.now() - quietSince >= 300;+ }, { timeout: hostTimeout(30_000), interval: 50 }).toBe(true);}/** After a restart, wait for the lent Mac's connector, so what a turn is offered is never just the Mac being offline. */async function macOnline() {