From 8b6dead6282fda84e09d4a056c57a176e6fa9cef Mon Sep 17 00:00:00 2001 From: Kacper Date: Thu, 13 Aug 2026 02:46:36 +0200 Subject: [PATCH 1/2] fix: resolve the computer-use contract under the real userData dir per platform MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The local computer-use (CUA) bridge is never found off macOS. readCuaConnection() looks for cua-connection.json under a hardcoded `~/Library/Application Support//`. That is Electron's app.getPath("userData") on macOS only — on Windows it is %APPDATA% and on Linux $XDG_CONFIG_HOME (falling back to ~/.config). Everywhere else the path simply does not exist, the read throws ENOENT into the catch, and the loop falls through to `return null`: the desktop app writes the contract on startup, the server never sees it, and the computer-use tools stay unavailable with no error to point at. userDataRoot() returns the same directory Electron would, per platform. The macOS behaviour is unchanged. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01HgJeiantdRcZSBrc5sqqCp --- server/index.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/server/index.ts b/server/index.ts index 4633db4de66..670771ee1b5 100644 --- a/server/index.ts +++ b/server/index.ts @@ -263,14 +263,23 @@ function stopScreenPoller(botId: string): Frame | null { return entry.last; } +// Where Electron's app.getPath("userData") lands, per platform — the +// hardcoded macOS path found nothing anywhere else, and threw the +// non-ENOENT errors into the same silent catch. +function userDataRoot(): string { + if (process.platform === "win32") return process.env.APPDATA ?? join(homedir(), "AppData", "Roaming"); + if (process.platform === "darwin") return join(homedir(), "Library", "Application Support"); + return process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config"); +} + // Local computer-use contract written by Electron main on startup -// (~/Library/Application Support/OpenMausBot/cua-connection.json). Read -// fresh each turn — Electron may restart or permissions may change. +// (/cua-connection.json). Read fresh each turn — Electron may +// restart or permissions may change. function readCuaConnection(): { command: string; args: string[]; env: Record } | null { // new name first; pre-rename desktop builds used the old directory for (const dir of ["OpenMausBot", "openmausbot", "OpenGrokBot", "opengrokbot"]) { try { - const p = join(homedir(), "Library", "Application Support", dir, "cua-connection.json"); + const p = join(userDataRoot(), dir, "cua-connection.json"); const conn = JSON.parse(readFileSync(p, "utf8")); if (!conn || conn.mode === "unavailable" || !conn.mcpCommand) continue; return { command: conn.mcpCommand, args: conn.mcpArgs ?? ["mcp"], env: conn.mcpEnv ?? {} }; From f633668370e8f1d3e337aaf68055f82c7dbc5cde Mon Sep 17 00:00:00 2001 From: milind-soni Date: Thu, 13 Aug 2026 16:41:46 +0530 Subject: [PATCH 2/2] userDataRoot: fall back on empty APPDATA/XDG_CONFIG_HOME, not just unset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `??` keeps a set-but-empty value, so `join("", "OpenMausBot", …)` yields a relative path resolved against the server's cwd — the same silent ENOENT this function exists to eliminate. `||` falls back to the home-relative default, matching how Electron/Chromium treat empty values. Co-Authored-By: Claude Fable 5 --- server/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/index.ts b/server/index.ts index 670771ee1b5..2a428df6e0b 100644 --- a/server/index.ts +++ b/server/index.ts @@ -266,10 +266,14 @@ function stopScreenPoller(botId: string): Frame | null { // Where Electron's app.getPath("userData") lands, per platform — the // hardcoded macOS path found nothing anywhere else, and threw the // non-ENOENT errors into the same silent catch. +// `||`, not `??`: a set-but-empty APPDATA/XDG_CONFIG_HOME would otherwise +// join into a RELATIVE path resolved against the server's cwd — the same +// silent ENOENT this function exists to stop. Electron ignores empty values +// the same way. function userDataRoot(): string { - if (process.platform === "win32") return process.env.APPDATA ?? join(homedir(), "AppData", "Roaming"); + if (process.platform === "win32") return process.env.APPDATA || join(homedir(), "AppData", "Roaming"); if (process.platform === "darwin") return join(homedir(), "Library", "Application Support"); - return process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config"); + return process.env.XDG_CONFIG_HOME || join(homedir(), ".config"); } // Local computer-use contract written by Electron main on startup