Skip to content

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

Tests: a capacity wait holds the slot in the bot's main thread, which now stays on the first conversation

milind-sonib24664edb300
diff --git a/server/chat-followups-restart.test.ts b/server/chat-followups-restart.test.ts
index a0697ae0fe..1e1cab5546 100644
--- a/server/chat-followups-restart.test.ts
+++ b/server/chat-followups-restart.test.ts
@@ -120,6 +120,9 @@ it("survives a real server crash: queued sends keep receipts, cancellation and u
writeFileSync(join(dataDir, `${bot.threadId}.gate`), "finish the first task");
expect(await runControlOmb(["wait", "--bot", bot.id, "--task", bot.threadId, "--url", url])).toMatchObject({ status: "settled" });
const holder = (await api("POST", `/api/bots/${bot.id}/tasks`, { title: "Hold the slot" }, 201)).task;
+ // The bot's main thread is never at capacity, and it stays on the first conversation: make the holder main so the
+ // first one waits for the slot.
+ await api("PATCH", `/api/bots/${bot.id}`, { mainThreadChoice: holder.threadId });
await api("POST", `/api/bots/${bot.id}/messages`, { text: "Hold the slot", threadId: holder.threadId }, 202);
await expect.poll(() => prompts(holder.threadId).length, { timeout: 15_000 }).toBe(1);
const attachments = join(dataDir, "attachments");
diff --git a/server/index.test.ts b/server/index.test.ts
index cdfd18851e..b209e055e3 100644
--- a/server/index.test.ts
+++ b/server/index.test.ts
@@ -9766,6 +9766,9 @@ describe("harness HTTP API", () => {
expect((await api("PATCH", "/api/config", { threads: { maxConcurrentPerBot: 1 } })).status).toBe(200);
expect((await api("POST", `/api/bots/${bot.id}/setup-request`, { threadId: bot.threadId })).status).toBe(200);
const holder = (await api("POST", `/api/bots/${bot.id}/tasks`, { title: "Hold the slot" })).body.task;
+ // The bot's main thread is never at capacity, and it stays on the first conversation: make the holder main so the
+ // greeting's thread waits for the slot.
+ expect((await api("PATCH", `/api/bots/${bot.id}`, { mainThreadChoice: holder.threadId })).status).toBe(200);
rmSync(fakeClaudeDump, { force: true });
expect((await api("POST", `/api/bots/${bot.id}/messages`, { text: "hold the one slot", threadId: holder.threadId })).status).toBe(202);
await readJsonFileWhenReady<Seen>(fakeClaudeDump, 15_000);