Skip to content

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

fix(computer): don't offer This computer on a remote server's page (#4137)

wlals08743e4075138689
diff --git a/src/components/ComputerPanel.simple.test.ts b/src/components/ComputerPanel.simple.test.ts
index f57c4a9a5a..83ec1bdaad 100644
--- a/src/components/ComputerPanel.simple.test.ts
+++ b/src/components/ComputerPanel.simple.test.ts
@@ -18,6 +18,7 @@ const fixture = vi.hoisted(() => {
view,
ogb,
platform: "darwin" as "darwin" | "win32" | "linux",
+ localComputer: {} as Record<string, unknown>,
values: [] as unknown[],
index: 0,
own: 0,
@@ -68,7 +69,7 @@ vi.mock("./DesktopCapabilities", () => ({
windowChrome: "native",
screenPreview: { available: false, interaction: "none" },
dictation: { available: false, engine: "none", onDevice: false },
- localComputer: { available: true, support: "supported", enabled: true, status: "ready" },
+ localComputer: fixture.localComputer,
},
}),
}));
@@ -171,6 +172,7 @@ beforeEach(() => {
fixture.advanced = false;
fixture.view.current = "computer";
fixture.platform = "darwin";
+ fixture.localComputer = { available: true, support: "supported", enabled: true, status: "ready" };
fixture.values = [];
fixture.index = 0;
fixture.own = 0;
@@ -373,6 +375,11 @@ describe("Where the bot works", () => {
expect(placeLine(rendered)).not.toMatch(/Local VM|Boat|cloud box/i);
});
+ it("leaves This Mac out on another server's page, where this computer can never be a bot's place", () => {
+ fixture.localComputer = { available: false, support: "unsupported", enabled: false, status: "unavailable", reasonCode: "remote-server" };
+ expect(grid(render(makeBot())).map((node) => text(node.props.children))).toEqual(["Auto", "Cloud desktop", "Private desktop", "Browser", "Off"]);
+ });
+
it("says what Auto does on My Cloud, where it starts a cloud computer by itself", () => {
fixture.config = { ...fixture.config, cloudHome: true };
expect(placeLine(render(makeBot()))).toBe("Uses the built-in browser. In a chat, it starts its cloud desktop by itself when a task needs desktop apps.");
diff --git a/src/components/ComputerPanel.tsx b/src/components/ComputerPanel.tsx
index 5e9bcaad4f..49c9c34b29 100644
--- a/src/components/ComputerPanel.tsx
+++ b/src/components/ComputerPanel.tsx
@@ -1118,7 +1118,7 @@ export function ComputerPanel({
["local", "vm.dest.local", "computer.dest.localDesc", Monitor],
["browser", "vm.dest.browser", "computer.dest.browserDesc", Globe],
["off", "vm.dest.off", "computer.dest.offDesc", Power],
- ] as const).filter(([mode]) => mode === null || mode === "off" || placeOffered(mode, state.config)).map(([mode, labelKey, descriptionKey, Icon]) => {
+ ] as const).filter(([mode]) => mode === null || mode === "off" || (placeOffered(mode, state.config) && !(mode === "local" && capabilities.localComputer.reasonCode === "remote-server"))).map(([mode, labelKey, descriptionKey, Icon]) => {
const selected = mode === null ? !profileBot.computer : profileBot.computer === mode;
const managedKind = mode === "local" ? "thisComputer" : mode === "vm" ? "localVm" : mode === "cloud" ? (profileBot.cloudBackend === "vps" ? "vps" : "box") : null;
const managedBy = managedPolicy && managedKind && !managedPolicy.computers[managedKind] ? t("policy.managedBy", { organization: managedPolicy.organizationName }) : undefined;
diff --git a/src/lib/local-computer.test.ts b/src/lib/local-computer.test.ts
index 7db0222792..2a02f6160f 100644
--- a/src/lib/local-computer.test.ts
+++ b/src/lib/local-computer.test.ts
@@ -56,6 +56,17 @@ describe("local computer UI eligibility", () => {
).toBe(false);
});
+ it("never offers This computer on another server's page, whatever the platform", () => {
+ for (const platform of ["darwin", "win32", "linux"] as const) {
+ const capabilities = {
+ host: { platform },
+ localComputer: { available: false, reasonCode: "remote-server" },
+ } as DesktopCapabilities;
+ expect(localComputerSelectable({ capabilities, providerSupportsLocal: true })).toBe(false);
+ expect(localComputerDisabledReason({ capabilities, providerSupportsLocal: true })).toBe(en["computer.problem.localRemoteServer"]);
+ }
+ });
+
it("keeps This computer selectable on Windows before the driver is live", () => {
const capabilities = {
host: { platform: "win32" as const, label: "Windows" },
diff --git a/src/lib/local-computer.ts b/src/lib/local-computer.ts
index 1497929870..b85d0a65da 100644
--- a/src/lib/local-computer.ts
+++ b/src/lib/local-computer.ts
@@ -20,6 +20,8 @@ export function localComputerSelectable({
}): boolean {
if (!providerSupportsLocal) return false;
if (capabilities.localComputer.available) return true;
+ // The desktop app's own computer can't serve bots running on another server; no permission fixes that.
+ if (capabilities.localComputer.reasonCode === "remote-server") return false;
return capabilities.host.platform === "darwin" || capabilities.host.platform === "win32";
}
@@ -33,6 +35,7 @@ export function localComputerDisabledReason({
}): string | null {
if (!providerSupportsLocal) return t("computer.problem.localAiCannot");
if (capabilities.localComputer.available) return null;
+ if (capabilities.localComputer.reasonCode === "remote-server") return t("computer.problem.localRemoteServer");
if (capabilities.host.platform === "linux") {
if (capabilities.localComputer.reasonCode === "linux-wayland-seat-safety-blocked") return t("computer.problem.localWaylandBlocked");
if (capabilities.localComputer.reasonCode === "wayland-compositor-unsupported") return t("computer.problem.localWaylandDesktop");
diff --git a/src/locales/en.json b/src/locales/en.json
index a142805598..98ad12ea6d 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -4623,6 +4623,7 @@
"computer.problem.localNeedsApp": "Only the {app} app on this computer can let a bot use it. Open the app here to use it.",
"computer.problem.localWindows": "Bots can't use this PC right now. Restart {app}, and if that doesn't help, open Settings → Diagnostics.",
"computer.problem.localMac": "Bots can't use this Mac yet. Check that {app} is allowed under Screen Recording and Accessibility in System Settings → Privacy & Security, then restart it.",
+ "computer.problem.localRemoteServer": "Bots on your own server can't use this computer. Switch back to This computer to use it.",
"computer.problem.oldImage": "The private desktop is out of date; replace it",
"computer.problem.unmanaged": "The existing container was not created by {app}; recreate it",
"computer.problem.publicViewer": "The private desktop's viewer is open to the network; replace it",
diff --git a/src/locales/ko.json b/src/locales/ko.json
index 702b6c705d..39ccab8658 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -4479,6 +4479,7 @@
"computer.problem.localNeedsApp": "이 컴퓨터의 {app} 앱만 봇이 이 컴퓨터를 쓰게 할 수 있어요. 쓰려면 여기서 앱을 여세요.",
"computer.problem.localWindows": "지금은 봇이 이 PC를 쓸 수 없어요. {app}을 다시 시작하고, 그래도 안 되면 설정 → 진단을 여세요.",
"computer.problem.localMac": "아직 봇이 이 Mac을 쓸 수 없어요. 시스템 설정 → 개인정보 보호 및 보안의 화면 기록과 손쉬운 사용에서 {app}이 허용되어 있는지 확인한 뒤 다시 시작하세요.",
+ "computer.problem.localRemoteServer": "내 서버에 있는 봇은 이 컴퓨터를 쓸 수 없어요. 쓰려면 이 컴퓨터로 돌아오세요.",
"computer.problem.oldImage": "비공개 데스크톱이 오래됐어요. 교체하세요",
"computer.problem.unmanaged": "기존 컨테이너는 {app}이 만든 것이 아니에요. 다시 만드세요",
"computer.problem.publicViewer": "비공개 데스크톱의 뷰어가 네트워크에 열려 있어요. 교체하세요",