Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(moves): a lent computer keeps taking its own screen lease while frozen (#4125)
Lykinzlj976948ecc36e
diff --git a/server/move-freeze.test.ts b/server/move-freeze.test.tsindex 485c1c3453..423f30f4ff 100644--- a/server/move-freeze.test.ts+++ b/server/move-freeze.test.ts@@ -55,7 +55,8 @@ describe("this computer's copy, frozen at the move", () => {expect(freeze.refuses(method!, path!), `${method} ${path}`).toBe(MOVED_REFUSAL);}for (const [method, path] of [["GET", "/api/bots"], ["DELETE", "/api/move/freeze"], ["DELETE", "/api/cloud-send/kind"], ["POST", "/api/cloud-send/chats/verify"],- ["POST", "/api/auth/logout"], ["POST", "/api/workspace-backup/export"], ["POST", "/api/cloud/pairing"], ["POST", "/api/sync/upload"]]) {+ ["POST", "/api/auth/logout"], ["POST", "/api/workspace-backup/export"], ["POST", "/api/cloud/pairing"], ["POST", "/api/sync/upload"],+ ["POST", "/api/desktop/shared-computer-control"]]) {expect(freeze.refuses(method!, path!), `${method} ${path}`).toBeNull();}});@@ -83,6 +84,7 @@ describe("this computer's copy, frozen at the move", () => {expect(freeze.unfreeze()).toBe(false);expect(freeze.frozen()).toBe(true);expect(freeze.refuses("POST", "/api/bots/b1/messages")).toBe(ENDED_REFUSAL);+ expect(freeze.refuses("POST", "/api/desktop/shared-computer-control"), "an ended Cloud runs no bots, so no screen lease").toBe(ENDED_REFUSAL);});});diff --git a/server/move-freeze.ts b/server/move-freeze.tsindex b1950ca8d3..32fae338e0 100644--- a/server/move-freeze.ts+++ b/server/move-freeze.ts@@ -25,7 +25,8 @@ const FILE = /\.[A-Za-z0-9]+$/u;export const ENDED_REFUSAL = "My Cloud has ended. It is open only so you can take your things home.";/** What a frozen server still changes: the freeze itself, the move's reads and lets-go, signing in and out, the backup- * that takes things home, the Admin's signed routes, Files and the computers lent to it. */+ * that takes things home, the Admin's signed routes, Files and the computers lent to it. (The lent screen lease has its+ * own exact exemption in refuses().) */const STILL_CHANGES = /^\/api\/(?:move\/|cloud-send\/|auth\/|workspace-backup\/|cloud\/|sync\/|shared-computers\/)/u;const READS = new Set(["GET", "HEAD", "OPTIONS"]);/** What a frozen copy keeps once its workspace is deleted: the marker, this server's identity, Files, downloaded tools@@ -105,6 +106,10 @@ export function createMoveFreeze({ dataDir, exportOnly = false }: { dataDir: str},/** Why a frozen server refuses this request, or null when it takes it. */refuses(method: string, path: string): string | null {+ // A lent computer keeps taking its own screen lease while frozen by a move: without it, every screen+ // call from the home the bots moved to dies on this 409 while files and the terminal work. Only that one POST,+ // and never on an ended Cloud's copy — that Cloud runs no bots, so nothing should be asking for a lease.+ if (frozen && !exportOnly && method.toUpperCase() === "POST" && path === "/api/desktop/shared-computer-control") return null;return frozen && !READS.has(method.toUpperCase()) && !STILL_CHANGES.test(path) ? refusal() : null;},freeze(cloud: string | null, named: string | null = null): void {