Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(cloud power): a lent computer's open asks poll never counts as work in progress (#4055)

Milind Soniaaedba14277c
diff --git a/server/cloud-power.test.ts b/server/cloud-power.test.ts
index 27279d1b26..e6be297268 100644
--- a/server/cloud-power.test.ts
+++ b/server/cloud-power.test.ts
@@ -88,6 +88,8 @@ describe("the home's idle verdict", () => {
h.power.begin("/api/shared-computers/abc/poll");
// A lent computer's device link stays open by design, like its poll: it never keeps the home awake.
h.power.begin("/api/shared-computers/abc/link");
+ // Its asks poll stays open the same way, for as long as the computer is lent.
+ h.power.begin("/api/shared-computers/asks");
expect(h.power.report().busy).toEqual(["maintenance"]);
done(); done();
expect(h.power.report().busy).toEqual(["recent-work"]);
diff --git a/server/cloud-power.ts b/server/cloud-power.ts
index 0ab90c0f8e..ca36af388b 100644
--- a/server/cloud-power.ts
+++ b/server/cloud-power.ts
@@ -72,7 +72,7 @@ export const CLOUD_BACKGROUND_HEADER = "x-omb-background";
export const CLOUD_POWER_HEADER = "x-omb-cloud-power";
const MARKER = "cloud-sleep.json";
/** Long-polls and streams that stay open by design: never "in flight" work. */
-const HELD = [/^\/api\/events$/, /^\/api\/sync\/changes$/, /^\/api\/shared-computers\/[\w-]+\/(?:poll|link)$/];
+const HELD = [/^\/api\/events$/, /^\/api\/sync\/changes$/, /^\/api\/shared-computers\/asks$/, /^\/api\/shared-computers\/[\w-]+\/(?:poll|link)$/];
/** The answer a held poll (Files sync, lending) gets once the home agreed to sleep: the desktop pauses until it wakes. */
export function answerAsleep(res: ServerResponse, json: (res: ServerResponse, status: number, body: unknown) => void) {