Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Antigravity: a DNS lookup that fails is a network failure, and the backup never takes the turn
laijsg1be7914323ded
diff --git a/server/antigravity-auth-blip.e2e.test.ts b/server/antigravity-auth-blip.e2e.test.tsindex 5904f75d43..b69287525b 100644--- a/server/antigravity-auth-blip.e2e.test.ts+++ b/server/antigravity-auth-blip.e2e.test.ts@@ -18,6 +18,7 @@ it("a sign-in Google cannot confirm for a moment is not a sign-out", async () =>const runtime = join(dataDir, "fake-antigravity");const failureFile = join(dataDir, "authenticate-failure.json");const rpcFile = join(dataDir, "antigravity-rpc.jsonl");+ const codexLog = join(dataDir, "codex-launches.jsonl");const evidence: unknown[] = [{ url, dataDir }];const api = async (method: string, path: string, body?: unknown) => {const response = await fetch(url + path, {@@ -36,6 +37,9 @@ it("a sign-in Google cannot confirm for a moment is not a sign-out", async () =>const calls = (method: string): Array<{ pid: number }> => existsSync(rpcFile)? readFileSync(rpcFile, "utf8").trim().split("\n").filter(Boolean).map((line) => JSON.parse(line)).filter((call) => call.method === method): [];+ const codexTurns = () => existsSync(codexLog)+ ? readFileSync(codexLog, "utf8").trim().split("\n").filter(Boolean).map((line) => JSON.parse(line)).filter((entry) => entry.event === "turn/start")+ : [];try {await waitForExit(fixture.child, { signal: "SIGTERM" });mkdirSync(runtime, { recursive: true });@@ -57,7 +61,10 @@ it("a sign-in Google cannot confirm for a moment is not a sign-out", async () =>FAKE_ACP_RPC_FAILURE_METHOD: "authenticate", FAKE_ACP_RPC_FAILURE_FILE: failureFile, FAKE_ACP_RPC_APPEND_FILE: rpcFile,},};- config.instances.codex = { driver: "codex", config: { cli: fileURLToPath(new URL("./testing/fake-codex-app-server.ts", import.meta.url)) } };+ config.instances.codex = {+ driver: "codex", config: { cli: fileURLToPath(new URL("./testing/fake-codex-app-server.ts", import.meta.url)) },+ environment: { FAKE_CODEX_STARTUP_LOG: codexLog },+ };writeFileSync(configPath, JSON.stringify(config));const log = openSync(logPath, "a", 0o600);server = spawn(process.execPath, ["--experimental-strip-types", fileURLToPath(new URL("./index.ts", import.meta.url))], {@@ -71,6 +78,7 @@ it("a sign-in Google cannot confirm for a moment is not a sign-out", async () =>const instance = async (id: string) => ((await api("GET", "/api/instances?fresh=1")).instances as any[]).find((entry) => entry.instanceId === id);await expect.poll(async () => (await instance("codex"))?.models.options.some((option: any) => option.id === codex.model), { timeout: 20_000 }).toBe(true);expect((await instance("antigravity"))?.snapshot.authenticated).toBe(true);+ expect(existsSync(codexLog), "the backup's launches are recorded").toBe(true);const { bots } = await api("GET", "/api/bots") as { bots: Array<{ id: string; chiefOfStaff?: boolean }> };const starter = bots.find((bot) => bot.chiefOfStaff);@@ -92,6 +100,7 @@ it("a sign-in Google cannot confirm for a moment is not a sign-out", async () =>expect((await instance("antigravity"))?.snapshot.authenticated, "still signed in").toBe(true);const notices = ((await api("GET", "/api/notifications")).notifications as any[]).filter((entry) => entry.kind === "notice");expect(notices.map((entry) => entry.body).filter((body) => /signed out/i.test(body))).toEqual([]);+ expect(codexTurns(), "the backup did not take the turn").toEqual([]);rmSync(failureFile);const refused = calls("authenticate").map((call) => call.pid);@@ -104,6 +113,7 @@ it("a sign-in Google cannot confirm for a moment is not a sign-out", async () =>const prompted = calls("session/prompt").map((call) => call.pid);expect(prompted, "the next turn ran on Antigravity").toHaveLength(1);expect(refused, "on a new process").not.toContain(prompted[0]);+ expect(codexTurns(), "nor the next one").toEqual([]);evidence.push({ second: await messages() });} finally {const evidencePath = `${logPath}.antigravity-auth-blip.json`;diff --git a/server/drivers/antigravity-sign-in.test.ts b/server/drivers/antigravity-sign-in.test.tsindex 628e356644..28ddeec666 100644--- a/server/drivers/antigravity-sign-in.test.ts+++ b/server/drivers/antigravity-sign-in.test.ts@@ -208,6 +208,8 @@ describe("a sign-in the runtime asks for in the middle of a turn", () => {[{ code: -32000, message: "Request failed", data: { details: "Authentication failed: connection refused" } }, false],[{ code: -32000, message: "Request failed", data: { reason: "Authentication failed: connection refused" } }, false],[{ code: -32000, message: "Request failed", data: { reason: "UNAUTHENTICATED" } }, true],+ [{ code: -32000, message: "Authentication failed: getaddrinfo ENOTFOUND oauth2.googleapis.com" }, false],+ [{ code: -32000, message: "Login check failed: getaddrinfo EAI_AGAIN oauth2.googleapis.com" }, false],])("reads the runtime's own words, not the method OpenMausBot called (%j)", (answer, expected) => {expect(antigravitySignInError(acpRpcError(answer, "authenticate"))).toBe(expected);});diff --git a/server/drivers/antigravity.ts b/server/drivers/antigravity.tsindex f613a60e2b..feb284f064 100644--- a/server/drivers/antigravity.ts+++ b/server/drivers/antigravity.ts@@ -88,7 +88,7 @@ export function antigravityUpdateFilter(): (update: Record<string, any>) => Recoconst SIGN_IN_WORDS = /\bauthenticat|\bunauthenticated\b|\bsign(?:ed)?[ -]?in\b|\blog(?:ged)?[ -]?in\b|\bcredentials?\b/iu;const SIGN_IN_ASKED = /\bauthentication required\b|\bunauthenticated\b|\bnot (?:logged|signed)[ -]?in\b|\b(?:sign|log)[ -]?in again\b|\bplease (?:sign|log)[ -]?in\b|\blogin expired\b|\bplease re-?authenticate\b|\bre-?authentication required\b|\binvalid_grant\b|\b(?:credentials?|token) (?:has been |have been |was |were )?revoked\b/iu;-const UNREACHABLE = /\bnetwork\b|\bunreachable\b|\boffline\b/iu;+const UNREACHABLE = /\bnetwork\b|\bunreachable\b|\boffline\b|\bgetaddrinfo\b|\benotfound\b|\beai_again\b/iu;/** -32000 is ACP's `auth_required`, but an agent may reuse it for other failures, a sign-in service it cannot reach* among them. Words that ask for a sign-in decide; words that only mention one do unless the failure is one that passes. */