Skip to content

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

test(routines): a run ending on a long question puts the chat under To review, end to end

AdityaUmalec17b387a9e3a
diff --git a/server/automation-reports.e2e.test.ts b/server/automation-reports.e2e.test.ts
index 791dceda12..fb42715eec 100644
--- a/server/automation-reports.e2e.test.ts
+++ b/server/automation-reports.e2e.test.ts
@@ -239,6 +239,21 @@ it("asks the person in the main chat when a run needs them, and their answer the
expect((await s.messages(s.main)).findLast((message) => message.role === "bot" && message.kind === "text")?.text).toBe("Sent.");
}, 120_000);
+it("puts the main chat under To review when a run ends on a question, even one past the 2,000 characters a run stores", async () => {
+ const s = await server();
+ const long = "Read the Acme thread and the invoice. ".repeat(80).trim();
+ s.script([{ key: "long", match: [s.header("Acme replies")], reply: `${long}\nNEEDS INPUT: Should I send the reply?` }]);
+ const id = await s.runNow(await s.routine("Acme replies"));
+ await s.settled(id);
+ await s.reported(id, "posted");
+ const done = await s.run(id);
+ expect(long.length).toBeGreaterThan(2_000);
+ expect(done.output).toContain("Should I send the reply?");
+ const saved = await s.savedBot();
+ expect(saved.tasks.find((task: any) => task.threadId === s.main).unread, "a run that asks the person puts the chat under To review").toBe(true);
+ expect(saved.tasks.find((task: any) => task.threadId === done.threadId)).toMatchObject({ routineRunId: id, unread: false });
+}, 120_000);
+
it("takes a 👍 on a run's question in the chat as the answer, with that report in hand", async () => {
const s = await server();
s.script([