Skip to content

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

Model rejected title requests without fabricated usage in the spend fixture

vincentb57f40e4d459
diff --git a/server/spend-cap-api.test.ts b/server/spend-cap-api.test.ts
index c59c61f0e2..d7e16f1865 100644
--- a/server/spend-cap-api.test.ts
+++ b/server/spend-cap-api.test.ts
@@ -239,13 +239,14 @@ describe("spend cap and prices through real turns", () => {
const logged = () => { try { return readFileSync(log, "utf8"); } catch { return ""; } };
const titleCalls = (text: string) => logged().split("\n").filter((line) => line.includes("short title") && line.includes(text));
const json = (body: unknown): RequestInit => ({ method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(body) });
- expect((await put({ budgets: { monthlyUsd: 0.01 } })).status).toBe(200);
+ expect((await put({ budgets: { monthlyUsd: 0.10 } })).status).toBe(200);
const { bot } = await control(["new-bot", "--name", "Cap title probe"]);
expect((await send(bot.id, "Plan the spring offsite")).status).toBeLessThan(300);
await control(["wait", "--bot", bot.id, "--timeout", "30"]);
- // Under the cap, the first message is named by the engine; the turn's $0.01 then reaches the cap.
await expect.poll(() => titleCalls("Plan the spring offsite").length, { timeout: 15_000 }).toBe(1);
+ expect((await put({ budgets: { monthlyUsd: 0.01 } })).status).toBe(200);
+ expect((await (await api("/api/usage")).json()).budget.exceeded).toBe(true);
const task = await api(`/api/bots/${bot.id}/tasks`, json({}));
const { threadId } = (await task.json() as any).task;
expect((await api(`/api/bots/${bot.id}/messages`, json({ text: "Draft the venue shortlist", threadId }))).status).toBe(409);
diff --git a/server/testing/fake-claude-cli.ts b/server/testing/fake-claude-cli.ts
index 411ec88515..e111cdedd3 100755
--- a/server/testing/fake-claude-cli.ts
+++ b/server/testing/fake-claude-cli.ts
@@ -557,7 +557,7 @@ if (["text", "json"].includes(argAfter("--output-format") ?? "")) {
};
if (titleCall && !process.env.FAKE_CLAUDE_TEXT_FILE && !(routes && routed())) {
process.stderr.write("fake title failed\n");
- replyText("fake title failed", 1, null);
+ process.exit(1);
}
// Background one-shots never overwrite the shared turn dump; FAKE_CLAUDE_TEXT_DUMP records them.
const upkeepCall = titleCall || /You are the (?:CAPTURE|TIDY|ORGANIZE) step of a memory system|You are the SKILL REVIEW step/.test(prompt);