Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Cloud browser: a fleet-running or unreadable-usage no from the relay holds for the back-off, not the whole day
milind-sonidc0ff09635cf
diff --git a/server/cloud-browser/cloud-browser.test.ts b/server/cloud-browser/cloud-browser.test.tsindex 203ad46bf2..915e7bd8e8 100644--- a/server/cloud-browser/cloud-browser.test.ts+++ b/server/cloud-browser/cloud-browser.test.ts@@ -182,6 +182,21 @@ describe("a personal Cloud's bot browsers in the Cloud's browser sandbox", () =>urlOf(await cloud.open(request()));});+ it("when the relay says the fleet has as many sandboxes running as it allows, tries again after the back-off, not the next day", async () => {+ fake.state = "archived";+ fake.available = false;+ fake.unavailableReason = "fleet_running";+ const cloud = browser();+ expect(await cloud.open(request())).toEqual({ home: "unavailable" });+ clock += CLOUD_BROWSER_BACKOFF_MS - 1;+ expect(await cloud.open(request())).toEqual({ home: "unavailable" });+ expect(fake.requests.filter((one) => one.path.endsWith("/browser-sandbox"))).toHaveLength(1);+ clock += 1;+ fake.available = true;+ urlOf(await cloud.open(request()));+ expect(fake.resumes()).toBe(1);+ });+it("replaces a sandbox the provider reports broken: deleted first, a fresh one made and counted", async () => {fake.state = "error";const cloud = browser();diff --git a/server/cloud-browser/rails.ts b/server/cloud-browser/rails.tsindex 5e1bd92b56..eef2cb7f2e 100644--- a/server/cloud-browser/rails.ts+++ b/server/cloud-browser/rails.ts@@ -200,11 +200,11 @@ export function createCloudBrowserRails(options: CloudBrowserRailsOptions) {today().oldRelayUntil = now() + 7 * 24 * 60 * 60_000;save();},- /** The relay's no, until its `resetsAt` (else the next UTC day): the fleet's starts, this Cloud's, or switched off. */+ /** The relay's no, until its `resetsAt` (the fleet's starts, this Cloud's, or switched off), else for the back-off. */unavailable(reason: string, resetsAt: string | null): HomeReason {const current = today();- const limit = resetsAt ? { reason: "too_many_starts" as const, resetsAt } : undefined;- current.unavailableUntil = liftsAt(limit, now());+ // A day's budget names its reset; the fleet's sandboxes at once, or usage that can't be read, pass sooner: the back-off.+ current.unavailableUntil = resetsAt ? liftsAt({ reason: "too_many_starts", resetsAt }, now()) : now() + CLOUD_BROWSER_BACKOFF_MS;save();return reason === "cloud_minutes" ? "minutes-used" : reason === "cloud_starts" ? "budget" : "unavailable";},