← Commit history

1.8.59: never place a window on-screen without confirmed z-bottom; park-failed stays invisible and self-heals on status queries

John Lauer ·98e1e891e1 · ·parent 8c3af8f
5 files changed +54−17
CHANGELOG.md+13
@@ -1,5 +1,18 @@ # Changelog — Adom Desktop Puppeteer Bridge +## 1.8.59 — 2026-07-14 — HARD RULE: never move a window on-screen until z-bottom is CONFIRMED++Under a 3-parallel-open load, one window's hwnd lookup lagged, the z-bottom step failed, and the+park moved the window on-screen anyway — an un-bottomed window lands on TOP of the user's work+(the nxp.com pop; no focus stolen, but visually covering, which is just as forbidden).++- The park now retries hwnd-resolve + z-bottom up to 8× (~2.5s); if 'bottomed' is never confirmed,+  the window STAYS off-screen and the verdict is an honest `park-failed` — invisible beats popping.+- `park-failed` windows self-heal opportunistically: any browser_status / list query retries the+  heal, on top of the existing reattach / open_tab / switch_tab touchpoints.+- 1.8.58: badge calls check AD's real result + log `[badge] applied/FAILED`; the tab-path debounce+  arms only on success (one silent failure no longer means a bare icon for 10 minutes).+ ## 1.8.54 → 1.8.57 — 2026-07-14 — Honest click signal; OS maximize; focus-latch fix; self-heal stranded windows  - **1.8.54:** `GetForegroundWindow` replaces `document.hasFocus()` for user-click detection —
adom-bridge-puppeteer-manifest.json+4−4
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "1.8.58",-  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.8.58/adom-bridge-puppeteer-v1.8.58.zip",-  "sha256": "11edd92b64e7e8f7569f0717550dee6f646a0e60c2d6acbb0a32ebeed07b8599",-  "size": 170451,+  "version": "1.8.59",+  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.8.59/adom-bridge-puppeteer-v1.8.59.zip",+  "sha256": "3553a6acad7ecdc5558ecc678e998a6d3076dda19dff7b4338b7b64965af3718",+  "size": 170911,   "verbPrefixes": [     "browser_",     "desktop_recorder_",
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-1.8.58\ No newline at end of file+1.8.59\ No newline at end of file
src/bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "puppeteer",   "displayName": "Puppeteer (Chrome for Testing + Native)",-  "version": "1.8.58",+  "version": "1.8.59",   "description": "Drives a browser ALREADY on the machine \u2014 installed Chrome, else Microsoft Edge (every Windows PC ships with Edge) \u2014 launched with a FRESH isolated profile, so the common case has NO ~150 MB Chrome-for-Testing download and it never touches the user's real tabs/logins. Binds its local server to LOOPBACK (127.0.0.1) only, so no Windows Firewall 'allow Node through the firewall' prompt ever pops. Chrome for Testing is fetched only as a LAST RESORT if the machine has no Chromium browser at all. SPAWN-VERIFIED fallback: pup tries each detected browser (Chrome \u2192 Edge \u2192 CfT) and actually launches it, falling through to the next if one won't start (and handling browsers like Edge that relaunch onto another PID), so a corrupt/partial install never hard-fails an open. The browser that launches is cached as the default (persisted across restarts) so it isn't re-probed each time. On spawn the bridge SELF-WARMS: detects browsers + disk, and only if the box has no Chrome/Edge and no cached CfT does it background-fetch CfT so the first open is instant. browser_use pins a specific browser (chrome | edge | cft | auto); {browser:'chrome',install:true} downloads & installs REAL Google Chrome (user-scoped, no admin) on an Edge-only box. browser_readiness (READ-ONLY) reports which browser will be used + the full candidate list + the default + free disk. Every failure returns a specific errorCode + _hint (chrome_install_no_disk, chrome_download_network, chrome_install_permission, chrome_stable_not_detected, \u2026). Launches with FULL browser permissions by default for full debug (strictPermissions:true opts out). Headful automation: open/close windows+tabs, navigate, screenshot, eval JS, record. pup is a GENERIC, non-profile browser only \u2014 every session is a fresh isolated Chrome/Edge process, never the user's real signed-in browser; profile defaults to sessionId. To drive the user's REAL Chrome/Edge (their profile, cookies, SSO), use the Adom browser EXTENSION's nbrowser_* verbs \u2014 a separate bridge, not pup's job.",   "homepage": "https://wiki.adom.inc/adom/adom-desktop",   "author": "Adom Inc.",
src/server.js+35−11
@@ -2006,24 +2006,39 @@ async function parkSessionWindowDirect(page, sessionId) {       await cdp.send('Browser.setWindowBounds', { windowId, bounds: { windowState: 'maximized' } });     };     // hwnd via AD (native) — the title suffix "(session: <id>" is set by the welcome page.-    let hwnd = null;-    for (let i = 0; i < 4 && !hwnd; i++) {-      try {-        const r = await chrome.adCommand('desktop_find_window', { titleContains: `(session: ${sessionId}` }, { timeoutMs: 4000 });-        const o = r && (typeof r.output === 'string' ? JSON.parse(r.output) : r.output || r);-        hwnd = (o && ((o.best && o.best.hwnd) || o.hwnd)) || null;-      } catch (e) {}-      if (!hwnd) await new Promise(r2 => setTimeout(r2, 250));-    }     // Z-bottom while still off-screen — UNLESS the OS says the user has it foreground     // (GetForegroundWindow, the only honest signal; document.hasFocus() lies for CDP windows).-    const z = osBottomUnlessForeground(hwnd);+    // v1.8.59 HARD RULE: the window is NEVER moved on-screen until z-bottom is CONFIRMED+    // ('bottomed'). Under parallel-open load the hwnd lookup can lag; the old code fell+    // through and placed an UN-BOTTOMED window on-screen — which lands on TOP of the user's+    // work (the nxp.com pop). Better to stay invisible off-screen ('park-failed', self-heal+    // retries on the next touchpoint) than to cover the user's screen.+    let hwnd = null, z = 'error';+    for (let attempt = 0; attempt < 8; attempt++) {+      if (!hwnd) {+        try {+          const r = await chrome.adCommand('desktop_find_window', { titleContains: `(session: ${sessionId}` }, { timeoutMs: 4000 });+          const o = r && (typeof r.output === 'string' ? JSON.parse(r.output) : r.output || r);+          hwnd = (o && ((o.best && o.best.hwnd) || o.hwnd)) || null;+        } catch (e) {}+      }+      if (hwnd) {+        z = osBottomUnlessForeground(hwnd);+        if (z === 'bottomed' || z === 'foreground') break;+        hwnd = null; // stale hwnd (window recreated?) — re-resolve+      }+      await new Promise(r2 => setTimeout(r2, 300));+    }     if (z === 'foreground') {       // User clicked during the launch gap — give them the window on-screen, foregrounded.       await placeOnScreen();       if (hwnd) { try { await chrome.adCommand('desktop_bring_to_front', { hwnd }, { timeoutMs: 3000 }); } catch (e) {} }       return 'user-foreground';     }+    if (z !== 'bottomed') {+      console.log(`[park] "${sessionId}": z-bottom NOT confirmed (${z}) — leaving off-screen (no pop), self-heal will retry`);+      return 'park-failed';+    }     // On-screen full-size WITHOUT activation — CDP move preserves z-order (we're at bottom).     await placeOnScreen();     // Verify POSITION, not just focus.@@ -3366,7 +3381,16 @@ async function getSessionInfo(sessionId, session) {     // v1.8.26: did background-by-default actually take? 'backgrounded' (good),     // 'still-foreground' (focus steal — a bug), 'no-window', or null (foreground open     // or non-Windows). Self-verified by re-reading the OS foreground window post-open.-    background: (() => { try { return browsers.get(session.profileName)?.browser?._bgResult || null; } catch (e) { return null; } })(),+    background: (() => {+      try {+        const bg = browsers.get(session.profileName)?.browser?._bgResult || null;+        // v1.8.59: a park-failed window is sitting invisible off-screen (deliberately — better+        // than popping over the user's work). Any status/list query opportunistically retries+        // the heal, so it converges to 'backgrounded' without waiting for a tab touchpoint.+        if (bg === 'park-failed') healOffscreenWindow(session, sessionId).then(r => { try { if (r) browsers.get(session.profileName).browser._bgResult = r; } catch (e) {} }).catch(() => {});+        return bg;+      } catch (e) { return null; }+    })(),     // v1.8.45: PROGRAMMATIC flash state. 'none' = not flashed; 'pending' = flashed and the     // user has NOT activated it since (taskbar still lit); 'cleared' = the user activated it     // (clicked its taskbar button) after the flash, so the tint is gone. Computed from the