Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Lending e2e: give its Cloud home a machine with room, not the test runner's free memory (#5242)
Milind Soni315361d8aaa4
diff --git a/server/cloud-lending.e2e.test.ts b/server/cloud-lending.e2e.test.tsindex d61fd82c60..69feffc0ac 100644--- a/server/cloud-lending.e2e.test.ts+++ b/server/cloud-lending.e2e.test.ts@@ -134,6 +134,10 @@ await import(${JSON.stringify(pathToFileURL(join(SERVER_DIR, "testing", "fake-clgrok: { driver: "grokAgent", environment: { FAKE_ACP_MODE: "lend-question" }, config: { cli: join(SERVER_DIR, "testing", "fake-acp-cli.ts"), fullAuto: false } },} }));chmodSync(join(SERVER_DIR, "testing", "fake-acp-cli.ts"), 0o755);+ // A Cloud home starts a new engine only while the machine has room for it, holding each new turn's share for 90 s, and+ // most turns here keep running: by the asking bot's turn they hold about 11 GB. Read from the test machine, room is+ // whatever the test files running beside this one leave, so that turn could wait for memory past every wait below.+ writeFileSync(join(dataDir, "host-memory.json"), JSON.stringify({ totalBytes: 64 * 1024 ** 3, availableBytes: 60 * 1024 ** 3, swapFreeBytes: 0, oomKills: 0, fullStall10: 0 }));port = await freePortBlock([0, 1]);base = `http://127.0.0.1:${port}`;await boot();@@ -144,11 +148,14 @@ let port = 0;async function boot() {const dataDir = join(home, ".openmausbot");const offlinePrelude = `data:text/javascript,${encodeURIComponent('const real = globalThis.fetch; globalThis.fetch = async (url, init) => String(url).startsWith("http://127.0.0.1:") ? real(url, init) : new Response("offline fixture", { status: 503 });')}`;- child = spawn(process.execPath, ["--import", offlinePrelude, join(SERVER_DIR, "index.ts")], {+ // The memory gate's seam (testing/memory-gate-hooks.mjs): this machine's memory is host-memory.json's, on every OS.+ const memoryGate = pathToFileURL(join(SERVER_DIR, "testing", "memory-gate-hooks.mjs")).href;+ child = spawn(process.execPath, ["--import", offlinePrelude, "--import", memoryGate, join(SERVER_DIR, "index.ts")], {cwd: join(SERVER_DIR, ".."),env: {PATH: process.env.PATH, ...(process.env.SystemRoot ? { SystemRoot: process.env.SystemRoot } : {}),- HOME: home, USERPROFILE: home, OMB_DATA_DIR: dataDir, OMB_PORT: String(port), OMB_WEBHOOK_PORT: String(port + 1),+ // The seam takes only a fixture whose home is its data folder.+ HOME: dataDir, USERPROFILE: dataDir, OMB_DATA_DIR: dataDir, OMB_TEST_MEMORY_GATE: "1", OMB_PORT: String(port), OMB_WEBHOOK_PORT: String(port + 1),OMB_CLOUD_ROLE: "home", OMB_CLOUD_MACHINE_ID: "3f9c2a4e-8b1d-4c6e-9a7f-2d5e8c1b0a93", OMB_CLOUD_ADMIN_URL: "https://cloud.example.test",OMB_CLOUD_BOOTSTRAP_SECRET: secret, OMB_PUBLIC_URL: `https://${HOST}`,},