Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
test(bot-box): expect cpu-list-readable only where the host has the CPU list
milind-sonic5182ab06926
diff --git a/server/bot-box/self-check.linux.test.ts b/server/bot-box/self-check.linux.test.tsindex 8e799e052e..a56dd348f9 100644--- a/server/bot-box/self-check.linux.test.ts+++ b/server/bot-box/self-check.linux.test.ts@@ -1,7 +1,7 @@// The real box, where it can run: Linux with an unprivileged bubblewrap (a Cloud home, the Fly test machine). Elsewhere// the suite says so and skips; the Fly acceptance run (`node dist-server/bot-box/box-check.js`) is where this is proved// for the image (see _plans/team-mode-2026-10-21/T0-BUILD.md).-import { mkdtempSync, rmSync } from "node:fs";+import { existsSync, mkdtempSync, rmSync } from "node:fs";import { tmpdir } from "node:os";import { join } from "node:path";import { afterAll, describe, expect, it } from "vitest";@@ -13,6 +13,8 @@ import { runBoxSelfCheck } from "./self-check.ts";const detection = detectBox({ env: { ...process.env, OMB_BOT_BOX: "1" } });const available = detection.box === "bwrap" && detection.tools !== null;const root = mkdtempSync(join(tmpdir(), "omb-box-real-"));+/** The CPU list is checked only where the host has one to put in the box. */+const cpuList = existsSync("/sys/devices/system/cpu/possible");afterAll(() => rmSync(root, { recursive: true, force: true }));describe.skipIf(!available)(`the real box (${detection.box === "bwrap" ? "bubblewrap works here" : `skipped: ${detection.reason}`})`, () => {@@ -25,8 +27,8 @@ describe.skipIf(!available)(`the real box (${detection.box === "bwrap" ? "bubbleconst result = await runBoxSelfCheck(options());expect(result.error).toBeUndefined();expect(result.failed).toEqual([]);- expect(result.total).toBe(process.arch === "x64" ? 32 : 31);- expect(result.results.map((check) => check.id)).toEqual(expect.arrayContaining(["engine-runs", "engine-read-only", "cpu-list-readable", "no-provider-key-in-env", "broker-call-works", "broker-wrong-token-refused", "broker-other-grant-refused", "broker-key-not-on-disk", "base-url-is-broker"]));+ expect(result.total).toBe((process.arch === "x64" ? 31 : 30) + (cpuList ? 1 : 0));+ expect(result.results.map((check) => check.id)).toEqual(expect.arrayContaining([...(cpuList ? ["cpu-list-readable"] : []), "engine-runs", "engine-read-only", "no-provider-key-in-env", "broker-call-works", "broker-wrong-token-refused", "broker-other-grant-refused", "broker-key-not-on-disk", "base-url-is-broker"]));}, 120_000);it("each mutation fails the checks it guards, and only those", async () => {