Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
test(cloud): keep Files e2e off the machine's real free disk
milind-sonibfcdd7c49d7f
diff --git a/server/cloud-sync.e2e.test.ts b/server/cloud-sync.e2e.test.tsindex 377ea10a4b..85a385a0b9 100644--- a/server/cloud-sync.e2e.test.ts+++ b/server/cloud-sync.e2e.test.ts@@ -76,7 +76,8 @@ await import(${JSON.stringify(pathToFileURL(join(SERVER_DIR, "testing", "fake-clconst port = await freePortBlock([0, 1]);base = `http://127.0.0.1:${port}`;const offlinePrelude = `data:text/javascript,${encodeURIComponent('globalThis.fetch = async () => new Response("offline fixture", { status: 503 });')}`;- child = spawn(process.execPath, ["--import", offlinePrelude, join(SERVER_DIR, "index.ts")], {+ const roomyDisk = pathToFileURL(join(SERVER_DIR, "testing", "roomy-disk.mjs")).href;+ child = spawn(process.execPath, ["--import", roomyDisk, "--import", offlinePrelude, join(SERVER_DIR, "index.ts")], {cwd: join(SERVER_DIR, ".."),env: {PATH: process.env.PATH,diff --git a/server/lent-folders.e2e.test.ts b/server/lent-folders.e2e.test.tsindex 1e904be839..a960085632 100644--- a/server/lent-folders.e2e.test.ts+++ b/server/lent-folders.e2e.test.ts@@ -81,14 +81,9 @@ await import(${JSON.stringify(pathToFileURL(join(SERVER_DIR, "testing", "fake-clwriteFileSync(join(home, "web", "index.html"), "<!doctype html><title>OpenMausBot</title>");const port = await freePortBlock([0, 1]);base = `http://127.0.0.1:${port}`;- // Offline, and a Cloud with room on its disk: what fits there is its 15% reserve against this machine's free space otherwise,- // so a nearly full runner or laptop would keep every copy off it.- const offlinePrelude = `data:text/javascript,${encodeURIComponent(`import fs from "node:fs";-import { syncBuiltinESMExports } from "node:module";-fs.statfsSync = () => ({ bsize: 4096, frsize: 4096, blocks: 2 ** 26, bfree: 2 ** 25, bavail: 2 ** 25, files: 2 ** 20, ffree: 2 ** 19, type: 0 });-syncBuiltinESMExports();-globalThis.fetch = async () => new Response("offline fixture", { status: 503 });`)}`;- child = spawn(process.execPath, ["--import", offlinePrelude, join(SERVER_DIR, "index.ts")], {+ const offlinePrelude = `data:text/javascript,${encodeURIComponent('globalThis.fetch = async () => new Response("offline fixture", { status: 503 });')}`;+ const roomyDisk = pathToFileURL(join(SERVER_DIR, "testing", "roomy-disk.mjs")).href;+ child = spawn(process.execPath, ["--import", roomyDisk, "--import", offlinePrelude, join(SERVER_DIR, "index.ts")], {cwd: join(SERVER_DIR, ".."),env: {PATH: process.env.PATH,diff --git a/server/testing/roomy-disk.mjs b/server/testing/roomy-disk.mjsnew file mode 100644index 0000000000..86187b1c0f--- /dev/null+++ b/server/testing/roomy-disk.mjs@@ -0,0 +1,7 @@+// Loaded with --import by a test's real server: the disk has plenty of room, whatever this machine has left. A Cloud keeps+// 15% of its disk in reserve, so on a nearly full runner or laptop it would otherwise refuse the test's files.+import fs from "node:fs";+import { syncBuiltinESMExports } from "node:module";++fs.statfsSync = () => ({ bsize: 4096, frsize: 4096, blocks: 2 ** 26, bfree: 2 ** 25, bavail: 2 ** 25, files: 2 ** 20, ffree: 2 ** 19, type: 0 });+syncBuiltinESMExports();