← Commit history

v2.0.258: Never rest a pup window off-screen. John could not open a freshly opened 'ab ralph' window: it sat at -21845,-21845 with a live taskbar button. Four separate paths in the launch park treated OFF-SCREEN as the safe fallback whenever z-bottom could not be PROVEN, logging 'self-heal will retry'. That trades a possible transient harm (a window briefly above the user's work) for a certain permanent one (the user can never open their own window), and the confirmation it waits for feeds the failure: zConfirmedBelow looks the hwnd up in ab's window enumeration and returns false when absent, and an off-screen window may not be enumerated at all, so once there it can never confirm its way out. All four paths now place the window ON-SCREEN at best-effort bottom, the moveOffScreen helper is deleted so it cannot be reintroduced, and the population sweep now repairs OFF-SCREEN windows as well as hidden ones (judging position from the restore rect so a minimized window is never disturbed) and runs every 30s instead of 120s.

John Lauer ·0021d33b01 ·2mo ago ·parent 53c5575
4 files changed +92−28
adom-bridge-puppeteer-manifest.json+5−5
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "2.0.257",-  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.257/adom-bridge-puppeteer-v2.0.257.zip",-  "sha256": "05234391cf6b97d117770632dbb085adc04594f63a33e7f041a40cdd90d38d38",-  "size": 953955,+  "version": "2.0.258",+  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.258/adom-bridge-puppeteer-v2.0.258.zip",+  "sha256": "ea109e762817922ada304d106e5a609a9ff972d0a249d648b4c0aba3729a25e9",+  "size": 955822,   "verbPrefixes": [     "browser_",     "desktop_recorder_",@@ -12,5 +12,5 @@   ],   "healthEndpoint": "/status",   "statusVerb": "browser_readiness",-  "released_at": "2026-08-20T11:08:49.401929Z"+  "released_at": "2026-08-20T11:46:50.888952Z" }
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-2.0.257\ No newline at end of file+2.0.258\ 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": "2.0.257",+  "version": "2.0.258",   "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. pup_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. pup_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. macOS (v1.9.74+): full parity with mac-native mechanics \u2014 background-by-default is the app-level hide (windows stay drivable/screenshottable while hidden), raise/lower map to unhide+activate/hide, pup_alert_window posts a native toast whose click focuses the window, pup_use {browser:'chrome',install:true} installs Chrome from the official dmg, and taskbar identity/badging remains Windows-only.",   "homepage": "https://wiki.adom.inc/adom/adom-bridge",   "author": "Adom Inc.",
src/server.js+85−21
@@ -9054,12 +9054,10 @@ async function parkSessionWindowDirect(page, sessionId) {       } catch (e) {}       return true;     };-    const moveOffScreen = async () => {-      try {-        await cdp.send('Browser.setWindowBounds', { windowId, bounds: { windowState: 'normal' } });-        await cdp.send('Browser.setWindowBounds', { windowId, bounds: { left: 0, top: 0, width: 1920, height: 1040 } }); // v1.9.134: near-fullscreen fallback; the SetWindowPos park right after corrects to the TRUE screen size ($scrW/$scrH). v1.9.133 (John): park ON-SCREEN at bottom z-order, never off-screen — a taskbar click must always reveal a correctly-placed window-      } catch (e) {}-    };+    // v2.0.258: the moveOffScreen() helper is GONE. Every caller has been converted to place the+    // window on-screen instead, because "park it off-screen until we are sure" is what left John+    // unable to open his own windows twice in one day. Do not reintroduce it: a helper whose whole+    // job is to move the user's window where they cannot click it is a loaded gun in this file.     // Z-order truth: our window's z must be strictly below at least one non-pup window, and it     // must not be topmost. Returns true only on CONFIRMED not-on-top.     const zConfirmedBelow = async (targetHwnd) => {@@ -9153,8 +9151,17 @@ async function parkSessionWindowDirect(page, sessionId) {       await new Promise(r2 => setTimeout(r2, 300));     }     if (!bottomed) {-      console.log(`[park] "${sessionId}": z-bottom NOT confirmed (${lastErr}) — leaving off-screen (no pop), self-heal will retry`);-      return 'park-failed';+      // v2.0.258 (John, twice in one day: "i can't fucking click it to open the pup window"). This+      // used to LEAVE THE WINDOW OFF-SCREEN and call that the safe outcome. It is not safe: it is the+      // one state that makes a taskbar button LIE, and "self-heal will retry" meant minutes of an+      // unclickable window, or forever when the heal could not resolve a handle. The risk being+      // avoided (we could not PROVE we are below the user's windows) is possible and transient; the+      // harm being caused (the user cannot open their own window, ever) is certain and permanent.+      // Never rest off-screen. Place it on-screen, bottom it best-effort, and say so honestly.+      console.log(`[park] "${sessionId}": z-bottom NOT confirmed (${lastErr}) — placing ON-SCREEN anyway at best-effort bottom. An unconfirmed z-order may briefly sit above your work; a window you cannot click NEVER becomes clickable, so on-screen always wins.`);+      await placeOnScreen();+      await adBottom();+      return 'park-unconfirmed';     }     // On-screen full-size WITHOUT activation — AD MoveWindow preserves z-order (we're at bottom).     if (!parkHwnd) {@@ -9164,7 +9171,13 @@ async function parkSessionWindowDirect(page, sessionId) {         parkHwnd = (o && ((o.best && o.best.hwnd) || o.hwnd)) || null;       } catch (e) {}     }-    if (!parkHwnd) { console.log(`[park] "${sessionId}": no hwnd for placement — leaving off-screen, self-heal will retry`); return 'park-failed'; }+    if (!parkHwnd) {+      // v2.0.258: same rule — no handle is no excuse to leave a window where a click cannot find it.+      // CDP placement needs no hwnd, so put it on-screen and let the sweeps re-bottom it later.+      console.log(`[park] "${sessionId}": no hwnd for placement — placing ON-SCREEN via CDP anyway rather than leaving it where a taskbar click reveals nothing`);+      await placeOnScreen();+      return 'park-unconfirmed';+    }     // v1.9.212 — STORE THE HWND ON THE SESSION. This is the fix John has been waiting for me to     // actually make instead of describing. Everything downstream (taskbar paint, park, resolution)     // has been finding windows by their "(session: <id>)" TITLE TAG, and Chrome's PDF viewer cannot@@ -9177,8 +9190,15 @@ async function parkSessionWindowDirect(page, sessionId) {     // RE-BOTTOM (trust nothing) and CONFIRM the z-order. Unconfirmable → back off-screen.     const placed = await placeOnScreen();     if (!placed) {-      console.log(`[park] "${sessionId}": screen-size probe failed — leaving off-screen, self-heal will retry`);-      return 'park-failed';+      // v2.0.258: the screen probe failing means we do not know the WORK AREA — it does not mean the+      // window should stay somewhere the user can never click. Fall back to a conservative on-screen+      // box; a later sweep re-places it to the real work area once the page answers.+      console.log(`[park] "${sessionId}": screen-size probe failed — falling back to a conservative ON-SCREEN box (never rest off-screen; a taskbar click must always reveal something)`);+      try {+        await cdp.send('Browser.setWindowBounds', { windowId, bounds: { windowState: 'normal' } });+        await cdp.send('Browser.setWindowBounds', { windowId, bounds: { left: 10, top: 10, width: 1280, height: 800 } });+      } catch (e) {}+      return 'park-unconfirmed';     }     let zOk = false;     for (let i = 0; i < 2 && !zOk; i++) {@@ -9186,9 +9206,14 @@ async function parkSessionWindowDirect(page, sessionId) {       zOk = await zConfirmedBelow(parkHwnd);     }     if (!zOk) {-      console.log(`[park] "${sessionId}": Z-ORDER UNCONFIRMED after placement — moving back OFF-SCREEN (never leave a window that might cover the user)`);-      await moveOffScreen();-      return 'park-failed';+      // v2.0.258: was `moveOffScreen()`. THIS is the line that stranded John's "ab ralph" window at+      // -21845,-21845 with a live taskbar button he could not open. Worse, the confirmation it waits+      // for is unreliable in a way that FEEDS this branch: zConfirmedBelow looks our hwnd up in ab's+      // window enumeration and returns false when it is absent — and a window parked off-screen may+      // not be enumerated at all, so once here, it can never confirm its way out.+      console.log(`[park] "${sessionId}": z-order unconfirmed after placement — LEAVING IT ON-SCREEN at best-effort bottom (was: moved back off-screen, which is exactly how a taskbar button ends up revealing nothing).`);+      await adBottom();+      return 'park-unconfirmed';     }     // Verify POSITION too (a stuck-off-screen window must not read as parked).     let verified = false;@@ -18623,17 +18648,47 @@ public static class VS {   [DllImport("user32.dll")] public static extern int GetWindowText(IntPtr h, StringBuilder s, int n);   [DllImport("user32.dll")] public static extern int GetWindowLong(IntPtr h, int i);   [DllImport("user32.dll")] public static extern int GetWindowThreadProcessId(IntPtr h, out int pid);+  [DllImport("user32.dll")] public static extern bool IsIconic(IntPtr h);+  [DllImport("user32.dll")] public static extern int GetSystemMetrics(int i);+  [DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr h, IntPtr a, int x, int y, int cx, int cy, uint f);+  [DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr h, out RECT r);+  [DllImport("user32.dll")] public static extern bool GetWindowPlacement(IntPtr h, ref WINDOWPLACEMENT p);+  [StructLayout(LayoutKind.Sequential)] public struct POINT { public int X, Y; }+  [StructLayout(LayoutKind.Sequential)] public struct RECT { public int L, T, R, B; }+  [StructLayout(LayoutKind.Sequential)] public struct WINDOWPLACEMENT {+    public int length; public int flags; public int showCmd;+    public POINT ptMinPosition; public POINT ptMaxPosition; public RECT rcNormalPosition; }   public static List<string> Fix(int[] pids) {     var outp = new List<string>();     EnumWindows((h, l) => {-      if (IsWindowVisible(h)) return true;       int pid; GetWindowThreadProcessId(h, out pid);       if (Array.IndexOf(pids, pid) < 0) return true;       if ((GetWindowLong(h, -16) & 0x00C00000) == 0) return true;   // WS_CAPTION — real windows only       var sb = new StringBuilder(300); GetWindowText(h, sb, 300);       if (sb.Length == 0) return true;-      ShowWindow(h, 4);                                              // SW_SHOWNOACTIVATE-      outp.Add((IsWindowVisible(h) ? "RESHOWN|" : "RESHOW-FAILED|") + h + "|" + sb.ToString());+      if (!IsWindowVisible(h)) {+        ShowWindow(h, 4);                                            // SW_SHOWNOACTIVATE+        outp.Add((IsWindowVisible(h) ? "RESHOWN|" : "RESHOW-FAILED|") + h + "|" + sb.ToString());+        return true;+      }+      // v2.0.258: HIDDEN was only half of "the user cannot open this window". OFF-SCREEN is the+      // other half, and it is the one that stranded John's "ab ralph" window at -21845,-21845 behind+      // a live taskbar button. Same invariant, same repair: a minimized window reports the -32000+      // placeholder rect legitimately, so judge position from the RESTORE rect, never GetWindowRect.+      if (IsIconic(h)) return true;                                  // minimized is the user's choice+      WINDOWPLACEMENT wp = new WINDOWPLACEMENT();+      wp.length = Marshal.SizeOf(wp);+      if (!GetWindowPlacement(h, ref wp)) return true;+      int L = wp.rcNormalPosition.L, T = wp.rcNormalPosition.T;+      int W = wp.rcNormalPosition.R - L, H = wp.rcNormalPosition.B - T;+      int vx = GetSystemMetrics(76), vy = GetSystemMetrics(77), vw = GetSystemMetrics(78), vh = GetSystemMetrics(79);+      // Off-screen = the window does not overlap the virtual desktop at all.+      if (L < vx + vw && L + W > vx && T < vy + vh && T + H > vy) return true;+      int nw = W > 200 && W <= vw ? W : (vw - 20), nh = H > 200 && H <= vh ? H : (vh - 20);+      SetWindowPos(h, IntPtr.Zero, vx + 10, vy + 10, nw, nh, 0x14);  // NOACTIVATE|NOZORDER+      RECT chk; GetWindowRect(h, out chk);+      bool fixedNow = chk.L < vx + vw && chk.R > vx && chk.T < vy + vh && chk.B > vy;+      outp.Add((fixedNow ? "MOVED-ONSCREEN|" : "MOVE-FAILED|") + h + "|" + sb.ToString());       return true;     }, IntPtr.Zero);     return outp;@@ -18644,9 +18699,14 @@ public static class VS {       try {         execFile('powershell', ['-NoProfile', '-Command', ps], { windowsHide: true, timeout: 25000 }, (err, stdout) => {           for (const line of String(stdout || '').trim().split(/\r?\n/)) {-            const m = /^(RESHOWN|RESHOW-FAILED)\|(\d+)\|(.*)$/.exec(line.trim());+            const m = /^(RESHOWN|RESHOW-FAILED|MOVED-ONSCREEN|MOVE-FAILED)\|(\d+)\|(.*)$/.exec(line.trim());             if (!m) continue;-            if (m[1] === 'RESHOWN') {+            if (m[1] === 'MOVED-ONSCREEN') {+              console.log(`[visibility] moved an OFF-SCREEN pup window back on screen (hwnd ${m[2]}, "${m[3].slice(0, 60)}") during the ${cause} sweep — its taskbar button was live while the window sat where no click could reach it`);+              try { recordCleanup(`moved a pup window back ON-SCREEN ("${m[3].slice(0, 60)}") — it was parked off-screen, so its taskbar button revealed nothing when clicked`); } catch (e) {}+            } else if (m[1] === 'MOVE-FAILED') {+              console.log(`[visibility] hwnd ${m[2]} ("${m[3].slice(0, 60)}") is off-screen and would NOT move back — reporting rather than pretending it is fine`);+            } else if (m[1] === 'RESHOWN') {               console.log(`[visibility] re-showed a HIDDEN pup window (hwnd ${m[2]}, "${m[3].slice(0, 60)}") during the ${cause} visibility sweep — a hidden window's taskbar button reveals nothing to a human click`);               try { recordCleanup(`re-showed a pup window that had been left HIDDEN ("${m[3].slice(0, 60)}") — its taskbar button would have revealed nothing when clicked`); } catch (e) {}             } else {@@ -18658,8 +18718,12 @@ public static class VS {       } catch (e) { resolve(); }     });   };-  setTimeout(() => { sweepVisibility('startup').catch(() => {}); }, 20000);-  setInterval(() => { sweepVisibility('periodic').catch(() => {}); }, 120000);+  // v2.0.258: every 30s, not 120s. This sweep is the last line of defence for "the user clicked the+  // taskbar button and nothing came up", and John hit that twice in one day — two minutes of an+  // unopenable window is not a safety net, it is the bug with a longer fuse. One PowerShell per+  // 30s across the whole population is cheap next to that.+  setTimeout(() => { sweepVisibility('startup').catch(() => {}); }, 8000);+  setInterval(() => { sweepVisibility('periodic').catch(() => {}); }, 30000);    // v1.9.89: reap ORPHANED pup chrome/renderers — any process under a pup-profiles dir whose profile   // has no live session (a previous bridge crash left them, or renderers that outlived a close and are