Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(runtime): quote a teammate's stored answer without a second cap
AdityaUmale10a5decc9502
diff --git a/server/runtime/envelope.test.ts b/server/runtime/envelope.test.tsindex 2db02284a8..7b0f90bada 100644--- a/server/runtime/envelope.test.ts+++ b/server/runtime/envelope.test.ts@@ -485,6 +485,13 @@ describe("composeEnvelope at Full access: nothing a bot can settle waits on theexpect(composeResume(long, chief, [])).toContain(line);});+ it("keeps the end of an answer that redaction made more than twice as long", () => {+ const answer = `${"--token=x ".repeat(1000)}END`;+ const envelope = composeEnvelope(assignment({ question: "Done?", answer, answeredBy: { kind: "bot", botId: "chief" } }), { ...names, answerer: "Chief" });+ expect(envelope.length).toBeGreaterThan(answer.length * 2);+ expect(envelope).toContain(`END".`);+ });+it("keeps the end of a 12 000-character answer that redaction made longer", () => {const removeScrubber = addHeldSecretScrubber((text) => text.replaceAll("code 42", `code ${HELD_SECRET_MASK}`));try {@@ -493,6 +500,8 @@ describe("composeEnvelope at Full access: nothing a bot can settle waits on theexpect(answer.length).toBe(12_000);const envelope = composeEnvelope(assignment({ question: "Done?", answer, answeredBy: { kind: "bot", botId: "chief" } }), { ...names, answerer: "Chief" });expect(envelope).toContain(`End.".`);+ expect(envelope).toContain(`code ${HELD_SECRET_MASK}`);+ expect(envelope).not.toContain("code 42");} finally {removeScrubber();}diff --git a/server/runtime/envelope.ts b/server/runtime/envelope.tsindex b53dc0b318..1a1f88d49d 100644--- a/server/runtime/envelope.ts+++ b/server/runtime/envelope.ts@@ -9,8 +9,6 @@ import type { Assignment, EnvelopeNames, Level, OriginSource, TurnEvidence } froexport const ENVELOPE_MARK = "[From";const QUOTE_MAX = 400;-// Headroom over the runtime's 12 000-character answer: redaction markers can lengthen it, and the next turn works from all of it.-const ANSWER_QUOTE_MAX = 16_000;const NAME_MAX = 80;const DETAIL_MAX = 200;const FILES_SHOWN = 8;@@ -113,7 +111,7 @@ function replyLine(a: Assignment, requester: string, parent?: Assignment): strinfunction answerLine(a: Assignment, names: EnvelopeNames): string {const question = quote(a.question, QUOTE_MAX);const asked = question ? `Your question was: "${question}". ` : "";- const answer = quote(a.answer, ANSWER_QUOTE_MAX);+ const answer = quote(a.answer, Number.POSITIVE_INFINITY);if (a.answeredBy?.kind === "default") {return `${asked}Nobody was asked, at this level: ${answer ? `go on with your default, "${answer}"` : "pick the sensible default yourself"}, and say in one plain line what you chose.`;}