Skip to content

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

Teammates sharing a name: the refusal names them, with the id of each

milind-sonidb33479cb83a
diff --git a/server/peer-roster.test.ts b/server/peer-roster.test.ts
index 9190ce571b..61efbc5bd1 100644
--- a/server/peer-roster.test.ts
+++ b/server/peer-roster.test.ts
@@ -230,9 +230,11 @@ describe("resolveTeammate", () => {
});
it("refuses a name two reachable teammates share instead of picking one", () => {
- const twins = [...fleet, { id: "writer2", name: "quill", section: "Work" }];
+ const twins = [...fleet, { id: "writer2", name: "quill", title: "Analyst", section: "Work" }, { id: "writer3", name: "QUILL", chiefOfStaff: true, section: "Work" }];
expect(resolveTeammate(twins, self, "Quill")).toEqual({
- error: '2 reachable teammates are named "Quill" — call list_bots and use the id of the one you mean',
+ error: '3 teammates you can reach are named "Quill", so nothing was sent: '
+ + `${fleet.filter((bot) => bot.name === "Quill").map((bot) => `Quill${bot.title ? `, ${bot.title}` : ""} (id ${bot.id})`).join("; ")}; quill, Analyst (id writer2); QUILL, Chief of Staff (id writer3). `
+ + "Send it again with the id of the one you mean.",
});
expect(resolveTeammate(twins, self, "writer2")).toEqual({ id: "writer2", byName: false });
});
diff --git a/server/peer-roster.ts b/server/peer-roster.ts
index c6578b6b0a..d72979a9fc 100644
--- a/server/peer-roster.ts
+++ b/server/peer-roster.ts
@@ -159,7 +159,7 @@ export function resolveTeammate<T extends RosterMember>(
const matches = reachable.filter(bot => fold(bot.name) === name);
if (matches.length === 1) return { id: matches[0]!.id, byName: true };
if (matches.length > 1) {
- return { error: `${matches.length} reachable teammates are named "${shown}" — call list_bots and use the id of the one you mean` };
+ return { error: `${matches.length} teammates you can reach are named "${shown}", so nothing was sent: ${sharedNameChoices(matches)}. Send it again with the id of the one you mean.` };
}
const near = reachable.filter(bot => loose(bot.name) === loose(wanted));
if (near.length === 1) return { id: near[0]!.id, byName: true };
@@ -175,6 +175,14 @@ export function resolveTeammate<T extends RosterMember>(
const CHOICES_MAX = 12;
+function sharedNameChoices(matches: readonly RosterMember[]): string {
+ const listed = matches.slice(0, CHOICES_MAX).map((bot) => {
+ const role = bot.chiefOfStaff ? "Chief of Staff" : peerName(bot.title ?? "");
+ return `${peerName(bot.name)}${role ? `, ${role}` : ""} (id ${bot.id})`;
+ });
+ return listed.join("; ") + (matches.length > CHOICES_MAX ? `; and ${matches.length - CHOICES_MAX} more` : "");
+}
+
function teammateChoices(reachable: readonly RosterMember[]): string {
if (!reachable.length) return "";
const listed = reachable.slice(0, CHOICES_MAX).map(bot => `${peerName(bot.name)} (id ${bot.id})`).join(", ");
diff --git a/server/room-coordination.e2e.test.ts b/server/room-coordination.e2e.test.ts
index b6ef0e2b00..88f05e445c 100644
--- a/server/room-coordination.e2e.test.ts
+++ b/server/room-coordination.e2e.test.ts
@@ -432,7 +432,10 @@ it("resolves a unique teammate name in a bot_ids slot, and refuses an ambiguous
expect((await f.wait()).status).toBe("settled");
const refused = f.provider().filter((turn: any) => turn.botId === f.sender.id).at(-1)
.evidence.find((entry: any) => entry.step).response.result.content[0].text;
- expect(refused).toBe(`2 reachable teammates are named "${f.target.name}" — call list_bots and use the id of the one you mean`);
+ expect(refused).toContain(`2 teammates you can reach are named "${f.target.name}", so nothing was sent:`);
+ expect(refused).toContain(`(id ${f.target.id})`);
+ expect(refused).toContain(`(id ${twin.id})`);
+ expect(refused).toContain("Send it again with the id of the one you mean.");
}), 60_000);
it("does not repeat a shared brief or rerun recipients on an identical tool retry", () => withRooms(async f => {