Skip to content

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

Comms tests: a tagged teammate's consultation answer shows as its own reply

milind-sonie14d6b6f0c2f
diff --git a/server/comms.test.ts b/server/comms.test.ts
index e7a3ffcdbf..8e09f030e3 100644
--- a/server/comms.test.ts
+++ b/server/comms.test.ts
@@ -188,6 +188,8 @@ describe("routine comms e2e on the job runtime (fake ACP fleet)", () => {
const DELEGATOR = { instanceId: "askerDelegate", model: "fake-model" };
const lastText = (messages: any[]): any => messages.findLast((m: any) => m.kind === "text" && m.role === "bot");
const chip = (messages: any[], name: string): any => messages.find((m: any) => m.kind === "activity" && m.tool?.name === name);
+ // A teammate the prompt tags answers a consultation in the asker's chat as its own reply (server/tagged-answer.ts), not a chip.
+ const taggedAnswer = (messages: any[], requestId: string): any => messages.find((m: any) => m.kind === "text" && m.roomRequest?.id === requestId && m.roomRequest.phase === "result");
const startRoutine = async (botId: string, text: string) => {
const created = await api("POST", "/api/routines", {
@@ -474,11 +476,9 @@ describe("routine comms e2e on the job runtime (fake ACP fleet)", () => {
const sent = chip(askerBot.messages, "Sent to Helper");
expect(sent).toBeTruthy();
expect(sent.threadRef).toMatchObject({ botId: helper.id, threadId: consult.threadId });
- const replied = chip(askerBot.messages, "Helper replied");
- expect(replied).toBeTruthy();
- expect(replied.from?.botId).toBe(helper.id);
- expect(replied.tool.output).toBe("hello from fake acp");
- expect(replied.roomRequest).toEqual({ id: consult.id, phase: "result" });
+ expect(chip(askerBot.messages, "Helper replied")).toBeUndefined();
+ const replied = taggedAnswer(askerBot.messages, consult.id);
+ expect(replied).toMatchObject({ role: "bot", text: "hello from fake acp", from: { botId: helper.id } });
expect(chip(askerBot.messages, "Resumed with Helper results, reviewing")).toBeTruthy();
expect((await api("GET", "/api/bots")).body.groups.filter((g: any) => g.dm)).toEqual([]);
@@ -946,12 +946,12 @@ describe("routine comms e2e on the job runtime (fake ACP fleet)", () => {
const [consult] = assignments(helper.id, asker.id);
expect(consult).toMatchObject({ mode: "consult" });
expect(["queued", "running"]).toContain(consult.status);
- expect(chip(askerBot.messages, "GateHelper replied")).toBeUndefined();
+ expect(taggedAnswer(askerBot.messages, consult.id)).toBeUndefined();
writeFileSync(gateFile, "go");
await waitUntil(async () => {
askerBot = await bot(asker.id);
- return chip(askerBot.messages, "GateHelper replied")?.tool.ok === true && lastText(askerBot.messages)?.text === WOKE_WITH_RESULT && !askerBot.busy;
+ return taggedAnswer(askerBot.messages, consult.id)?.from?.botId === helper.id && lastText(askerBot.messages)?.text === WOKE_WITH_RESULT && !askerBot.busy;
}, 30_000, "the peer's answer never resumed the asker");
expect(assignments(helper.id, asker.id)[0]).toMatchObject({ status: "completed", text: "ping from fake" });
expect(assignments(helper.id, asker.id)[0].result.startsWith("echo: ")).toBe(true);