Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Length refusals: a call with other problems too gets the general words
Milind Soni61e22658d03f
diff --git a/server/too-long.test.ts b/server/too-long.test.tsindex 75512d79e2..f13124ce9d 100644--- a/server/too-long.test.ts+++ b/server/too-long.test.ts@@ -32,5 +32,6 @@ describe("calls refused for length", () => {it("leaves any other refusal to the general words", () => {expect(refusal({ botIds: ["a", "b", "c", "d", "e"], message: "ok" }), "too many teammates is no length").toBeUndefined();expect(refusal({ botIds: [], message: "" })).toBeUndefined();+ expect(refusal({ botIds: ["a", "b", "c", "d", "e"], message: "x".repeat(4001) }), "the general words cover both").toBeUndefined();});});diff --git a/server/too-long.ts b/server/too-long.tsindex b10d6bf9e2..1d27e7cf0d 100644--- a/server/too-long.ts+++ b/server/too-long.ts@@ -13,12 +13,13 @@ const COORDINATE_FIELDS: Readonly<Record<string, string>> = {reason: "Say why in one short line, then call coordinate_bots again.",};-/** The first over-long field a coordinate_bots call was refused for; undefined when something else was wrong with it. */+/** What to say when length is the only thing wrong with a coordinate_bots call; undefined when anything else is too, so the+ * general words cover it all and the bot isn't sent back to fix one field of two. */export function coordinateTooLong(issues: readonly Issue[]): string | undefined {- for (const issue of issues) {+ const refusals = issues.map((issue) => {const field = String(issue.path[0]);const how = COORDINATE_FIELDS[field];- if (issue.code === "too_big" && how && issue.maximum !== undefined) return tooLongRefusal(field, issue.maximum, how);- }- return undefined;+ return issue.code === "too_big" && how && issue.maximum !== undefined ? tooLongRefusal(field, issue.maximum, how) : undefined;+ });+ return refusals.length && refusals.every(Boolean) ? refusals.join(" ") : undefined;}