Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
Merge pull request #576 from ScottDeng114514/fix/macos-only-bounds-watchdog
Lan12935baae156
diff --cc apps/desktop/electron/main/bootstrap/window.tsindex 37c07298b,6c0b7981d..3552d779f--- a/apps/desktop/electron/main/bootstrap/window.ts+++ b/apps/desktop/electron/main/bootstrap/window.ts@@@ -925,17 -875,23 +925,29 @@@ export async function createWindow(})();});- const boundsWatchdog = setInterval(() => {+ // Stage Manager recovery is macOS-only. On other platforms readCgBounds is+ // always null and cgHelperAvailable is false, so the periodic tick would only+ // call setAlwaysOnTop(false). Under Mutter (GNOME/Linux) meta_window_unmake_above+ // unconditionally raises the window, which causes the window to periodically+ // steal focus (see issue #568). Skip the watchdog entirely off macOS.+ const boundsWatchdog: NodeJS.Timeout | null = process.platform === "darwin"+ ? setInterval(() => {if (!isLiveWindow()) {- clearInterval(boundsWatchdog);+ if (boundsWatchdog) clearInterval(boundsWatchdog);return;}+ // Stage Manager recovery is macOS-only: the CG bounds helper it reads+ // exists there alone (D039, D053, D083), and the minimum window size makes+ // the tiny-bounds test unreachable elsewhere. On Windows/Linux this+ // interval had nothing to recover and only cleared the window layer every+ // 1.5s — and Mutter answers that repeated `_NET_WM_STATE` removal by+ // raising the window (`meta_window_unmake_above` → `meta_window_raise`),+ // so the app kept yanking itself above whatever the user had just focused+ // (D447).+ if (process.platform !== "darwin") {+ clearInterval(boundsWatchdog);+ return;+ }const cg = readCgBounds();const electronBounds = window.getBounds();if (!cg && cgHelperAvailable) missingCgStreak += 1;