Python
Machines page: the OpenWorker Cloud list exists only on internal builds
Rohit C Prasad76b31f703b26
diff --git a/surfaces/gui/src/components/MachinesSection.cloud.test.tsx b/surfaces/gui/src/components/MachinesSection.cloud.test.tsxnew file mode 100644index 00000000..c2f2c156--- /dev/null+++ b/surfaces/gui/src/components/MachinesSection.cloud.test.tsx@@ -0,0 +1,44 @@+// The OpenWorker Cloud machines list is not announced yet (2026-09-30): only internal+// builds show it, or even ask the cloud for it. Sign-in itself is untouched.+import { afterEach, describe, expect, it, vi } from "vitest";+import { cleanup, render, screen, waitFor } from "@testing-library/react";+import { MachinesSection } from "./MachinesSection";++function stub(internal: boolean) {+ const urls: string[] = [];+ vi.stubGlobal(+ "fetch",+ vi.fn(async (input: RequestInfo | URL) => {+ const url = String(input);+ urls.push(url);+ if (url.endsWith("/v1/personas")) return { ok: true, json: async () => ({ personas: [], internal }) } as Response;+ if (url.includes("/v1/cloud/machines"))+ return { ok: true, json: async () => ({ session: "expired", machines: [], org: { name: "Acme" } }) } as Response;+ return { ok: true, json: async () => ({ machines: [], armed: false }) } as Response;+ }),+ );+ return urls;+}++afterEach(() => {+ cleanup();+ vi.unstubAllGlobals();+});++describe("cloud machines section", () => {+ it("does not exist on a release build, and the cloud is not asked", async () => {+ const urls = stub(false);+ render(<MachinesSection />);+ await waitFor(() => expect(urls.some((u) => u.endsWith("/v1/personas"))).toBe(true));+ await new Promise((r) => setTimeout(r, 50));+ expect(screen.queryByTestId("cloud-machines-section")).toBeNull();+ expect(urls.some((u) => u.includes("/v1/cloud/machines"))).toBe(false);+ });++ it("shows on an internal build", async () => {+ stub(true);+ render(<MachinesSection />);+ await waitFor(() => expect(screen.getByTestId("cloud-machines-section")).toBeTruthy());+ expect(screen.getByTestId("cloud-machines-section").textContent).toContain("OpenWorker Cloud");+ });+});diff --git a/surfaces/gui/src/components/MachinesSection.tsx b/surfaces/gui/src/components/MachinesSection.tsxindex 06629583..7b57dd9e 100644--- a/surfaces/gui/src/components/MachinesSection.tsx+++ b/surfaces/gui/src/components/MachinesSection.tsx@@ -25,6 +25,7 @@ import {} from "../api";import {getCloudMachines,+ getPersonasIndex,hasWallet,isCloudMode,type Sandbox,@@ -89,6 +90,14 @@ export function MachinesSection() {// signed-in desktop. A cloud-session problem only ever degrades that// section — the local list above it is never blocked.const [cloud, setCloud] = useState<CloudMachinesInfo | null>(null);+ // The cloud machines list is not announced yet (owner, 2026-09-30): it exists only on+ // internal builds (the OPENWORKER_UNSHIPPED switch, as for unshipped coworkers). The+ // release neither shows it nor asks the cloud for it. Sign-in itself stays: the+ // one-click connections need it.+ const [internal, setInternal] = useState(false);+ useEffect(() => {+ getPersonasIndex().then((i) => setInternal(i.internal)).catch(() => {});+ }, []);// Managed sandboxes (hosted only): the listing carries the caller's cap,// so nothing here depends on the sign-in gate having run.const [sandboxes, setSandboxes] = useState<SandboxesInfo>({ sandboxes: [], cap: 0, used: 0 });@@ -111,15 +120,17 @@ export function MachinesSection() {/* sidecar unreachable — keep the last list */}if (!isCloudMode()) {- try {- setCloud(await getCloudMachines());- } catch {- /* keep the last cloud view */+ if (internal) {+ try {+ setCloud(await getCloudMachines());+ } catch {+ /* keep the last cloud view */+ }}} else {setSandboxes(await getSandboxes());}- }, []);+ }, [internal]);useEffect(() => {void refresh();@@ -418,7 +429,7 @@ export function MachinesSection() {registry's rows, one pane down. Signed out ⇒ the section does notexist; an expired session degrades to a sign-in-again row; thelocal list above is never touched by any of it. */}- {!isCloudMode() && cloud && cloud.session !== "signed_out" && (+ {!isCloudMode() && internal && cloud && cloud.session !== "signed_out" && (<div className="mt-7" data-testid="cloud-machines-section"><div className="mb-2.5 text-label text-faint font-medium">OpenWorker Cloud{cloud.org?.name ? ` · ${cloud.org.name}` : ""}