Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Windows: a running owner that cannot be signalled keeps the data folder locked (#6264)
Milind Sonic18fe85e5599
diff --git a/electron/data-dir-lease-windows.node-test.mjs b/electron/data-dir-lease-windows.node-test.mjsnew file mode 100644index 0000000000..379a589919--- /dev/null+++ b/electron/data-dir-lease-windows.node-test.mjs@@ -0,0 +1,261 @@+// Windows liveness of a data-directory lease owner: kill(pid, 0), the process list, and when the pid's process started.+import assert from "node:assert/strict";+import { spawn } from "node:child_process";+import { randomUUID } from "node:crypto";+import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";+import { hostname, tmpdir } from "node:os";+import path from "node:path";+import test from "node:test";++import { acquireDataDirLease, tasklistListsPid, windowsCreationFitsLease } from "./data-dir-lease.mjs";++const LEASE_NAME = "openmausbot-server.lease";+const roots = [];++function temporaryDirectory(name = "data") {+ const root = mkdtempSync(path.join(tmpdir(), "omb-electron-lease-"));+ roots.push(root);+ const dataDir = path.join(root, name);+ mkdirSync(dataDir, { recursive: true });+ return { root, dataDir };+}++async function exitedPid() {+ const child = spawn(process.execPath, ["--eval", "process.exit(0)"], { stdio: "ignore" });+ const pid = child.pid;+ assert.ok(pid);+ await new Promise((resolve, reject) => {+ child.once("error", reject);+ child.once("close", resolve);+ });+ return pid;+}++test.afterEach(() => {+ for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true });+});++test("a live but unrelated Windows pid reused within the same boot is treated as stale", async (t) => {+ // With or without wmic: Windows 11 no longer installs it, and the check must still tell a reused pid apart.+ if (process.platform !== "win32") return t.skip("Windows-only: process-identity check");+ const { dataDir } = temporaryDirectory();+ const sibling = spawn(process.execPath, ["--eval", "setInterval(()=>{}, 1_000);"], { stdio: "ignore" });+ const siblingPid = sibling.pid;+ assert.ok(siblingPid);+ t.after(() => sibling.kill());+ // Long enough that the sibling's CreationDate is unambiguously later than the synthetic lease's createdAt.+ await new Promise((resolve) => setTimeout(resolve, 200));++ const leasePath = path.join(dataDir, LEASE_NAME);+ const stale = {+ version: 1,+ pid: siblingPid,+ host: hostname(),+ token: randomUUID(),+ createdAt: Date.now() - 60_000,+ boot: null,+ uptime: 0,+ };+ writeFileSync(leasePath, `${JSON.stringify(stale)}\n`, { mode: 0o600 });++ const lease = acquireDataDirLease(dataDir);+ try {+ assert.equal(lease.ownerPid, process.pid);+ } finally {+ lease.release();+ }+});++/**+ * The Windows liveness probes faked on any host: kill answers EPERM for the given pids (the OS answer+ * for a pid this account cannot signal — live processes of another user, and exited processes that a+ * handle still keeps referenced), tasklist answers from a PATH shim, and powershell.exe under a faked+ * SystemRoot. On Windows 11 wmic is absent, so the PATH shim intentionally carries no wmic. On Windows+ * itself the shims cannot execute, so only the platform and kill fakes apply and the real tasklist and+ * powershell answer for themselves.+ */+function fakeWindowsHost(t, { epermPids = [], tasklist, powershell = null, created = null } = {}) {+ const realWindows = process.platform === "win32";+ const priorPlatform = Object.getOwnPropertyDescriptor(process, "platform");+ Object.defineProperty(process, "platform", { ...priorPlatform, value: "win32" });+ const eperm = new Set(epermPids);+ const priorKill = process.kill;+ process.kill = (pid, signal) => {+ if (eperm.has(pid)) throw Object.assign(new Error(`kill EPERM: ${pid}`), { code: "EPERM" });+ return priorKill.call(process, pid, signal);+ };+ const priorEnv = {};+ for (const name of ["PATH", "SystemRoot"]) priorEnv[name] = process.env[name];+ t.after(() => {+ Object.defineProperty(process, "platform", priorPlatform);+ process.kill = priorKill;+ for (const name of Object.keys(priorEnv)) {+ if (priorEnv[name] === undefined) delete process.env[name];+ else process.env[name] = priorEnv[name];+ }+ });++ if (realWindows) return;++ const { root } = temporaryDirectory("windows-tools");+ const binDir = path.join(root, "bin");+ mkdirSync(binDir);+ const script = (name, source) => writeFileSync(name, `#!/bin/sh\n${source}\n`, { mode: 0o755 });+ if (Array.isArray(tasklist)) {+ const rows = tasklist.map((pid) => ` *"PID eq ${pid}"*) echo '"openmausbot-server.exe","${pid}","Console","1","64,000 K"' ;;`).join("\n");+ script(path.join(binDir, "tasklist"), `case "$*" in\n${rows}\n *) echo "INFO: No tasks are running which match the specified criteria." ;;\nesac`);+ } else if (tasklist === "error") {+ script(path.join(binDir, "tasklist"), "exit 1");+ }+ const systemRoot = path.join(root, "windows");+ if (Array.isArray(powershell) || created) {+ const bin = path.join(systemRoot, "System32", "WindowsPowerShell", "v1.0");+ mkdirSync(bin, { recursive: true });+ // The creation-time query (ToUnixTimeMilliseconds) answers from `created`; the process-list query from `powershell`.+ const times = Object.entries(created ?? {}).map(([pid, ms]) => ` *"ProcessId=${pid}'"*ToUnixTime*) echo ${ms} ;;`).join("\n");+ const rows = (powershell ?? []).map((pid) => ` *"ProcessId=${pid}'"*) echo 1 ;;`).join("\n");+ script(path.join(bin, "powershell.exe"), `case "$*" in\n${times}\n${rows}\n *) : ;;\nesac`);+ }+ process.env.PATH = binDir;+ process.env.SystemRoot = systemRoot;+}++/** The record a Windows build leaves on disk: no boot id, no pid namespace, no start ticks. */+function windowsLeaseRecord(pid, createdAt = Date.now() - 60_000) {+ return {+ version: 1,+ pid,+ host: hostname(),+ token: randomUUID(),+ createdAt,+ boot: null,+ uptime: 1,+ ns: null,+ start: null,+ };+}++function plantWindowsChildLease(dataDir, pid, createdAt) {+ const childPath = path.join(dataDir, ".openmausbot-server-child", LEASE_NAME);+ mkdirSync(path.dirname(childPath));+ writeFileSync(childPath, `${JSON.stringify(windowsLeaseRecord(pid, createdAt))}\n`, { mode: 0o600 });+ return childPath;+}++/** A pid the real process list shows as running, for the Windows-host runs where no shim can fake one. */+function runningPid(t) {+ const child = spawn(process.execPath, ["--eval", "setInterval(()=>{}, 1_000);"], { stdio: "ignore" });+ assert.ok(child.pid);+ t.after(() => child.kill());+ return child.pid;+}++test("an exited Windows server child that still answers EPERM no longer blocks startup", async (t) => {+ const zombiePid = await exitedPid();+ fakeWindowsHost(t, { epermPids: [zombiePid], tasklist: [] });+ const { dataDir } = temporaryDirectory();+ plantWindowsChildLease(dataDir, zombiePid);++ const lease = acquireDataDirLease(dataDir);+ assert.equal(lease.ownerPid, process.pid);+ assert.equal(lease.release(), true);+});++test("an exited Windows lease owner that still answers EPERM is retired, not served forever", async (t) => {+ const zombiePid = await exitedPid();+ fakeWindowsHost(t, { epermPids: [zombiePid], tasklist: [] });+ const { dataDir } = temporaryDirectory();+ writeFileSync(path.join(dataDir, LEASE_NAME), `${JSON.stringify(windowsLeaseRecord(zombiePid))}\n`, { mode: 0o600 });++ const lease = acquireDataDirLease(dataDir);+ assert.equal(lease.ownerPid, process.pid);+ assert.equal(lease.release(), true);+});++test("a Windows zombie is still dead when tasklist cannot answer and the process list does", async (t) => {+ if (process.platform === "win32") return t.skip("the tool-failure fixtures are POSIX shims; real Windows probes cannot be made to fail");+ const zombiePid = await exitedPid();+ fakeWindowsHost(t, { epermPids: [zombiePid], tasklist: "error", powershell: [process.pid] });+ const { dataDir } = temporaryDirectory();+ writeFileSync(path.join(dataDir, LEASE_NAME), `${JSON.stringify(windowsLeaseRecord(zombiePid))}\n`, { mode: 0o600 });++ const lease = acquireDataDirLease(dataDir);+ assert.equal(lease.ownerPid, process.pid);+ assert.equal(lease.release(), true);+});++test("a Windows owner this account cannot signal but that still runs keeps blocking startup", async (t) => {+ const realWindows = process.platform === "win32";+ const liveForeignPid = realWindows ? runningPid(t) : await exitedPid();+ fakeWindowsHost(t, { epermPids: [liveForeignPid], tasklist: [liveForeignPid] });+ const { dataDir } = temporaryDirectory();+ // On Windows the record must postdate the live pid's real creation time, or it reads as a reused pid.+ plantWindowsChildLease(dataDir, liveForeignPid, realWindows ? Date.now() : undefined);++ assert.throws(() => acquireDataDirLease(dataDir), /still shutting down/i);+});++test("a Windows owner stays alive when the fallback process list still shows it running", async (t) => {+ if (process.platform === "win32") return t.skip("the tool-failure fixtures are POSIX shims; real Windows probes cannot be made to fail");+ const liveForeignPid = await exitedPid();+ fakeWindowsHost(t, { epermPids: [liveForeignPid], tasklist: "error", powershell: [liveForeignPid] });+ const { dataDir } = temporaryDirectory();+ plantWindowsChildLease(dataDir, liveForeignPid);++ assert.throws(() => acquireDataDirLease(dataDir), /still shutting down/i);+});++test("a Windows owner that can be neither signalled nor listed still fails closed", async (t) => {+ if (process.platform === "win32") return t.skip("the tool-failure fixtures are POSIX shims; real Windows probes cannot be made to fail");+ const foreignPid = await exitedPid();+ fakeWindowsHost(t, { epermPids: [foreignPid], tasklist: "error" });+ const { dataDir } = temporaryDirectory();+ plantWindowsChildLease(dataDir, foreignPid);++ assert.throws(() => acquireDataDirLease(dataDir), /still shutting down/i);+});++test("tasklist's answer: a CSV row is a running pid, an INFO line is none, no output proves nothing", () => {+ assert.equal(tasklistListsPid('"node.exe","4120","Services","0","41,236 K"\r\n'), true);+ assert.equal(tasklistListsPid('"openmausbot-server.exe","4120","Console","1","64,000 K"\r\n'), true);+ assert.equal(tasklistListsPid("\r\nINFO: No tasks are running which match the specified criteria.\r\n"), false);+ assert.equal(tasklistListsPid("INFORMATION : aucune tâche en service ne correspond aux critères spécifiés.\r\n"), false);+ assert.equal(tasklistListsPid(""), null);+ assert.equal(tasklistListsPid("\r\n \r\n"), null);+});++test("a Windows creation time within the clocks' slack of the lease is still its owner; minutes later is a reused pid", () => {+ const leaseAt = 1_763_300_000_000;+ assert.equal(windowsCreationFitsLease(leaseAt - 60_000, leaseAt), true);+ // The kernel's creation stamp and the process' own Date.now() disagree by a timer tick or an NTP step.+ assert.equal(windowsCreationFitsLease(leaseAt, leaseAt), true);+ assert.equal(windowsCreationFitsLease(leaseAt + 16, leaseAt), true);+ assert.equal(windowsCreationFitsLease(leaseAt + 4_999, leaseAt), true);+ assert.equal(windowsCreationFitsLease(leaseAt + 5_000, leaseAt), false);+ assert.equal(windowsCreationFitsLease(leaseAt + 10 * 60_000, leaseAt), false);+ assert.equal(windowsCreationFitsLease(null, leaseAt), true);+});++test("a live Windows owner Windows says started a moment after its lease's clock still blocks startup", async (t) => {+ if (process.platform === "win32") return t.skip("the probe fixtures are POSIX shims; the real-Windows run is the test above");+ const liveForeignPid = await exitedPid();+ const createdAt = Date.now();+ fakeWindowsHost(t, { epermPids: [liveForeignPid], tasklist: [liveForeignPid], created: { [liveForeignPid]: createdAt + 12 } });+ const { dataDir } = temporaryDirectory();+ plantWindowsChildLease(dataDir, liveForeignPid, createdAt);++ assert.throws(() => acquireDataDirLease(dataDir), /still shutting down/i);+});++test("a listed Windows pid whose process started long after the lease is a reused pid, and the lease is recovered", async (t) => {+ if (process.platform === "win32") return t.skip("the probe fixtures are POSIX shims");+ const reusedPid = await exitedPid();+ const createdAt = Date.now() - 60_000;+ fakeWindowsHost(t, { epermPids: [reusedPid], tasklist: [reusedPid], created: { [reusedPid]: createdAt + 30_000 } });+ const { dataDir } = temporaryDirectory();+ plantWindowsChildLease(dataDir, reusedPid, createdAt);++ const lease = acquireDataDirLease(dataDir);+ assert.equal(lease.ownerPid, process.pid);+ assert.equal(lease.release(), true);+});diff --git a/electron/data-dir-lease.mjs b/electron/data-dir-lease.mjsindex 68f3dbc1ea..0dab9bf325 100644--- a/electron/data-dir-lease.mjs+++ b/electron/data-dir-lease.mjs@@ -415,11 +415,20 @@ function windowsProcessListed(pid) {return tasklistHasPid(pid) ?? cimHasPid(pid);}+/**+ * `tasklist /FI "PID eq <pid>" /FO CSV /NH`: a quoted CSV row when the pid runs, an INFO line (in the system's language)+ * when it does not; null for no output at all, which proves nothing, so the next probe answers.+ */+export function tasklistListsPid(output) {+ const lines = String(output).replace(/^/, "").split(/\r?\n/).map((line) => line.trim()).filter(Boolean);+ if (lines.length === 0) return null;+ return lines.some((line) => line.startsWith('"'));+}+/** tasklist ships with every Windows and lists every running process, whatever account or session owns it. */function tasklistHasPid(pid) {try {- const output = commandOutput("tasklist", ["/FI", `PID eq ${pid}`, "/FO", "CSV", "/NH"], 5_000);- return output.split(/\r?\n/).some((line) => line.startsWith('"'));+ return tasklistListsPid(commandOutput("tasklist", ["/FI", `PID eq ${pid}`, "/FO", "CSV", "/NH"], 5_000));} catch {return null;}@@ -446,9 +455,22 @@ function ownerIdentityMatches(owner) {return started === null || started === owner.start;}if (process.platform !== "win32") return true;- const created = processCreationTimeMs(owner.pid);- if (created === null) return true;- return created < owner.createdAt;+ return windowsCreationFitsLease(processCreationTimeMs(owner.pid), owner.createdAt);+}++/**+ * How far a process' creation time, as Windows reports it, may run past the createdAt its own Date.now() wrote. The two+ * clocks are read differently (the kernel's stamp at creation, JavaScript's clock in the process), so they disagree by+ * up to a timer tick or more, and NTP may step the wall clock between the two readings. Without slack a live owner that+ * wrote its lease moments after starting reads as a reused pid and its lease is taken over: two servers on one folder.+ * Erring this way only keeps a lease whose pid was reused within these seconds blocked while that process lives.+ */+const WINDOWS_CREATION_SLACK_MS = 5_000;++/** Windows: whether the process now holding the pid can be the lease's owner; unknown (null) creation time counts as yes. */+export function windowsCreationFitsLease(createdMs, leaseCreatedAt) {+ if (createdMs === null) return true;+ return createdMs < leaseCreatedAt + WINDOWS_CREATION_SLACK_MS;}function unlinkExact(path, message) {diff --git a/electron/data-dir-lease.node-test.mjs b/electron/data-dir-lease.node-test.mjsindex 002f4538a8..afa3051fb4 100644--- a/electron/data-dir-lease.node-test.mjs+++ b/electron/data-dir-lease.node-test.mjs@@ -793,184 +793,6 @@ test("boot identity does not weaken exclusion: only one of many live racers winsassert.equal(after.release(), true);});-test("a live but unrelated Windows pid reused within the same boot is treated as stale", async (t) => {- // With or without wmic: Windows 11 no longer installs it, and the check must still tell a reused pid apart.- if (process.platform !== "win32") return t.skip("Windows-only: process-identity check");- const { dataDir } = temporaryDirectory();- const sibling = spawn(process.execPath, ["--eval", "setInterval(()=>{}, 1_000);"], { stdio: "ignore" });- const siblingPid = sibling.pid;- assert.ok(siblingPid);- t.after(() => sibling.kill());- // Long enough that the sibling's CreationDate is unambiguously later than the synthetic lease's createdAt.- await new Promise((resolve) => setTimeout(resolve, 200));-- const leasePath = path.join(dataDir, LEASE_NAME);- const stale = {- version: 1,- pid: siblingPid,- host: hostname(),- token: randomUUID(),- createdAt: Date.now() - 60_000,- boot: null,- uptime: 0,- };- writeFileSync(leasePath, `${JSON.stringify(stale)}\n`, { mode: 0o600 });-- const lease = acquireDataDirLease(dataDir);- try {- assert.equal(lease.ownerPid, process.pid);- } finally {- lease.release();- }-});--/**- * The Windows liveness probes faked on any host: kill answers EPERM for the given pids (the OS answer- * for a pid this account cannot signal — live processes of another user, and exited processes that a- * handle still keeps referenced), tasklist answers from a PATH shim, and powershell.exe under a faked- * SystemRoot. On Windows 11 wmic is absent, so the PATH shim intentionally carries no wmic. On Windows- * itself the shims cannot execute, so only the platform and kill fakes apply and the real tasklist and- * powershell answer for themselves.- */-function fakeWindowsHost(t, { epermPids = [], tasklist, powershell = null } = {}) {- const realWindows = process.platform === "win32";- const priorPlatform = Object.getOwnPropertyDescriptor(process, "platform");- Object.defineProperty(process, "platform", { ...priorPlatform, value: "win32" });- const eperm = new Set(epermPids);- const priorKill = process.kill;- process.kill = (pid, signal) => {- if (eperm.has(pid)) throw Object.assign(new Error(`kill EPERM: ${pid}`), { code: "EPERM" });- return priorKill.call(process, pid, signal);- };- const priorEnv = {};- for (const name of ["PATH", "SystemRoot"]) priorEnv[name] = process.env[name];- t.after(() => {- Object.defineProperty(process, "platform", priorPlatform);- process.kill = priorKill;- for (const name of Object.keys(priorEnv)) {- if (priorEnv[name] === undefined) delete process.env[name];- else process.env[name] = priorEnv[name];- }- });-- if (realWindows) return;-- const { root } = temporaryDirectory("windows-tools");- const binDir = path.join(root, "bin");- mkdirSync(binDir);- const script = (name, source) => writeFileSync(name, `#!/bin/sh\n${source}\n`, { mode: 0o755 });- if (Array.isArray(tasklist)) {- const rows = tasklist.map((pid) => ` *"PID eq ${pid}"*) echo '"openmausbot-server.exe","${pid}","Console","1","64,000 K"' ;;`).join("\n");- script(path.join(binDir, "tasklist"), `case "$*" in\n${rows}\n *) echo "INFO: No tasks are running which match the specified criteria." ;;\nesac`);- } else if (tasklist === "error") {- script(path.join(binDir, "tasklist"), "exit 1");- }- const systemRoot = path.join(root, "windows");- if (Array.isArray(powershell)) {- const bin = path.join(systemRoot, "System32", "WindowsPowerShell", "v1.0");- mkdirSync(bin, { recursive: true });- const rows = powershell.map((pid) => ` *"ProcessId=${pid}"*) echo 1 ;;`).join("\n");- script(path.join(bin, "powershell.exe"), `case "$*" in\n${rows}\n *) : ;;\nesac`);- }- process.env.PATH = binDir;- process.env.SystemRoot = systemRoot;-}--/** The record a Windows build leaves on disk: no boot id, no pid namespace, no start ticks. */-function windowsLeaseRecord(pid, createdAt = Date.now() - 60_000) {- return {- version: 1,- pid,- host: hostname(),- token: randomUUID(),- createdAt,- boot: null,- uptime: 1,- ns: null,- start: null,- };-}--function plantWindowsChildLease(dataDir, pid, createdAt) {- const childPath = path.join(dataDir, ".openmausbot-server-child", LEASE_NAME);- mkdirSync(path.dirname(childPath));- writeFileSync(childPath, `${JSON.stringify(windowsLeaseRecord(pid, createdAt))}\n`, { mode: 0o600 });- return childPath;-}--/** A pid the real process list shows as running, for the Windows-host runs where no shim can fake one. */-function runningPid(t) {- const child = spawn(process.execPath, ["--eval", "setInterval(()=>{}, 1_000);"], { stdio: "ignore" });- assert.ok(child.pid);- t.after(() => child.kill());- return child.pid;-}--test("an exited Windows server child that still answers EPERM no longer blocks startup", async (t) => {- const zombiePid = await exitedPid();- fakeWindowsHost(t, { epermPids: [zombiePid], tasklist: [] });- const { dataDir } = temporaryDirectory();- plantWindowsChildLease(dataDir, zombiePid);-- const lease = acquireDataDirLease(dataDir);- assert.equal(lease.ownerPid, process.pid);- assert.equal(lease.release(), true);-});--test("an exited Windows lease owner that still answers EPERM is retired, not served forever", async (t) => {- const zombiePid = await exitedPid();- fakeWindowsHost(t, { epermPids: [zombiePid], tasklist: [] });- const { dataDir } = temporaryDirectory();- writeFileSync(path.join(dataDir, LEASE_NAME), `${JSON.stringify(windowsLeaseRecord(zombiePid))}\n`, { mode: 0o600 });-- const lease = acquireDataDirLease(dataDir);- assert.equal(lease.ownerPid, process.pid);- assert.equal(lease.release(), true);-});--test("a Windows zombie is still dead when tasklist cannot answer and the process list does", async (t) => {- if (process.platform === "win32") return t.skip("the tool-failure fixtures are POSIX shims; real Windows probes cannot be made to fail");- const zombiePid = await exitedPid();- fakeWindowsHost(t, { epermPids: [zombiePid], tasklist: "error", powershell: [process.pid] });- const { dataDir } = temporaryDirectory();- writeFileSync(path.join(dataDir, LEASE_NAME), `${JSON.stringify(windowsLeaseRecord(zombiePid))}\n`, { mode: 0o600 });-- const lease = acquireDataDirLease(dataDir);- assert.equal(lease.ownerPid, process.pid);- assert.equal(lease.release(), true);-});--test("a Windows owner this account cannot signal but that still runs keeps blocking startup", async (t) => {- const realWindows = process.platform === "win32";- const liveForeignPid = realWindows ? runningPid(t) : await exitedPid();- fakeWindowsHost(t, { epermPids: [liveForeignPid], tasklist: [liveForeignPid] });- const { dataDir } = temporaryDirectory();- // On Windows the record must postdate the live pid's real creation time, or it reads as a reused pid.- plantWindowsChildLease(dataDir, liveForeignPid, realWindows ? Date.now() : undefined);-- assert.throws(() => acquireDataDirLease(dataDir), /still shutting down/i);-});--test("a Windows owner stays alive when the fallback process list still shows it running", async (t) => {- if (process.platform === "win32") return t.skip("the tool-failure fixtures are POSIX shims; real Windows probes cannot be made to fail");- const liveForeignPid = await exitedPid();- fakeWindowsHost(t, { epermPids: [liveForeignPid], tasklist: "error", powershell: [liveForeignPid] });- const { dataDir } = temporaryDirectory();- plantWindowsChildLease(dataDir, liveForeignPid);-- assert.throws(() => acquireDataDirLease(dataDir), /still shutting down/i);-});--test("a Windows owner that can be neither signalled nor listed still fails closed", async (t) => {- if (process.platform === "win32") return t.skip("the tool-failure fixtures are POSIX shims; real Windows probes cannot be made to fail");- const foreignPid = await exitedPid();- fakeWindowsHost(t, { epermPids: [foreignPid], tasklist: "error" });- const { dataDir } = temporaryDirectory();- plantWindowsChildLease(dataDir, foreignPid);-- assert.throws(() => acquireDataDirLease(dataDir), /still shutting down/i);-});-// A Cloud home's volume mounts on one machine at a time, and each new home on it has a new hostname and boot.const otherMachine = (current) => ({ host: renamedHost(current), boot: randomUUID(), uptime: 1, machine: anotherMachineId(current) });diff --git a/scripts/testing/file-size-ratchet.test.ts b/scripts/testing/file-size-ratchet.test.tsindex 03c2caaa97..4628f04450 100644--- a/scripts/testing/file-size-ratchet.test.ts+++ b/scripts/testing/file-size-ratchet.test.ts@@ -46,7 +46,7 @@ const LINES: Record<string, number> = {"server/cli.ts": 1053,"src/components/AttachmentPreview.tsx": 1034,"server/meetings/meetbot.ts": 1047,- "electron/data-dir-lease.node-test.mjs": 1024, // the data-folder lease's own tests: many platform cases+ "electron/data-dir-lease.node-test.mjs": 846, // the data-folder lease's own tests: many platform cases (Windows probes in data-dir-lease-windows.node-test.mjs)};function sourceFiles(): string[] {diff --git a/server/routine-failure-spacing.test.ts b/server/routine-failure-spacing.test.tsindex 6b304a9039..42b23b9deb 100644--- a/server/routine-failure-spacing.test.ts+++ b/server/routine-failure-spacing.test.ts@@ -138,11 +138,14 @@ describe("a routine every 5 minutes whose tool server is dead", () => {});it("with the spacing set out of reach by OMB_ROUTINE_FAILURES_BEFORE_SPACING, starts one turn at every occurrence", async () => {+ // Six hours, not the day: the defaults would have spaced it out within the first. The clock is the harness's, so+ // nothing waits; the cost is real work per pass and per run, and a day of 288 runs took a Windows runner past 40 s.vi.stubEnv("OMB_ROUTINE_FAILURES_BEFORE_SPACING", "100000");const h = harness();- await h.passTo(START + 24 * HOUR, h.fail(DEAD_TOOL));- console.log(`turns started in 24 hours with a dead tool server and no spacing: ${h.started.length}`);- expect(h.started).toHaveLength(24 * 12);+ await h.passTo(START + 6 * HOUR, h.fail(DEAD_TOOL));+ console.log(`turns started in 6 hours with a dead tool server and no spacing: ${h.started.length}`);+ expect(h.started).toHaveLength(6 * 12);+ expect(h.rows().filter((run) => run.skipped)).toEqual([]);});});