Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(drivers): reject a non-string group_id in coordinate_bots
Saim Shafique620dfa5f7f06
diff --git a/server/drivers/agents-call.test.ts b/server/drivers/agents-call.test.tsindex 6a75ecd649..9a0425137c 100644--- a/server/drivers/agents-call.test.ts+++ b/server/drivers/agents-call.test.ts@@ -412,4 +412,22 @@ describe("coordinate_bots", () => {const { calls } = await coordinate({ ...BASE, groupId: "" });expect(calls[0].body).not.toHaveProperty("groupId");});++it("rejects a non-string group_id instead of delegating to the current room", async () => {+ const { result, calls } = await coordinate({ ...BASE, group_id: 42 });+ expect(result.isError).toBe(true);+ expect(calls).toEqual([]);+ });++ it("rejects a non-string camelCase groupId", async () => {+ const { result, calls } = await coordinate({ ...BASE, groupId: 7 });+ expect(result.isError).toBe(true);+ expect(calls).toEqual([]);+ });++ it("still drops a null group_id", async () => {+ const { result, calls } = await coordinate({ ...BASE, group_id: null });+ expect(result.isError).toBeFalsy();+ expect(calls[0].body).not.toHaveProperty("groupId");+ });});diff --git a/server/drivers/agents-call.ts b/server/drivers/agents-call.tsindex b6170112ed..07389cc775 100644--- a/server/drivers/agents-call.ts+++ b/server/drivers/agents-call.ts@@ -273,7 +273,8 @@ export async function callTool(called: string, input: Json, context: ToolCallCon&& (canonical.thread === undefined || (typeof canonical.thread === "string" && /^[\w-]{1,128}$/.test(canonical.thread)))&& (canonical.reply === undefined || canonical.reply === "resume" || canonical.reply === "none")&& optional("consult", "boolean") && optional("in_my_folder", "boolean")- && optional("done_when", "string") && optional("reason", "string") && optional("title", "string") && optional("answers", "string");+ && optional("done_when", "string") && optional("reason", "string") && optional("title", "string") && optional("answers", "string")+ && (canonical.group_id === undefined || canonical.group_id === null || typeof canonical.group_id === "string");if (!usable) {return {text: `coordinate_bots takes snake_case arguments: bot_ids (an array of 1-4 teammate ids) and message are required; group_id, reason, rework, title, thread ("standing", "new" or the id of a thread you opened on that teammate), reply ("resume" or "none"), consult (true or false), in_my_folder (true or false), done_when and answers are optional. Received: ${Object.keys(args).join(", ") || "none"}.`,