← Commit history

v2.0.285: REVERT the focus-emulation blank-window fix (v2.0.280-284): Emulation.setFocusEmulationEnabled activated the OS window and foregrounded a background pup window (the exact focus-steal off-screen birth prevents), and did not reliably fix the blank thumbnail. Removed the birth call, the render lease, and its watchdog. Blank-occluded-window remains an open problem to solve WITHOUT touching OS focus.

John Lauer ·302889e095 ·2mo ago ·parent 8f9086d
4 files changed +21−73
adom-bridge-puppeteer-manifest.json+5−5
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "2.0.284",-  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.284/adom-bridge-puppeteer-v2.0.284.zip",-  "sha256": "04f185ef2608e4ecd1b9dfd77703ed29576115047a7d4a544957909bed9f1e37",-  "size": 969592,+  "version": "2.0.285",+  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.285/adom-bridge-puppeteer-v2.0.285.zip",+  "sha256": "ff250f121995c7a3d06705a702ba70eaf9450311b5bc375d72a39169995a51ba",+  "size": 968245,   "verbPrefixes": [     "browser_",     "desktop_recorder_",@@ -12,5 +12,5 @@   ],   "healthEndpoint": "/status",   "statusVerb": "browser_readiness",-  "released_at": "2026-08-22T20:51:05.413767Z"+  "released_at": "2026-08-22T21:00:08.805307Z" }
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-2.0.284\ No newline at end of file+2.0.285\ 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.284",+  "version": "2.0.285",   "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+14−66
@@ -9258,41 +9258,15 @@ setInterval(() => {   } }, 30000); -// v2.0.283 RENDER LEASE (John's pick over always-on / never). Chrome drops a background window's-// page-render surface when it is occluded, so its taskbar thumbnail and an instant reveal go BLANK-// (MEASURED via the DWM thumbnail: toolbar persists, page area blank; foregrounding renders it-// fully). Keeping Emulation.setFocusEmulationEnabled ON retains that surface so the thumbnail/reveal-// shows content — but an ACTIVE page then renders continuously in the background (battery, the-// issue-#14 risk). The lease is the balance, mirroring the highFps lease: a window that was just-// opened or interacted with keeps its render surface for RENDER_LEASE_MS; once it has been idle that-// long it downgrades to throttled/blank (zero cost). Re-touched by every interactive verb; a watchdog-// reconciles the emulation state to the lease declaratively, so timing races cannot leak it on.-const _renderLease = new Map();               // sessionId -> expiresAt (ms since epoch)-const RENDER_LEASE_MS = 5 * 60 * 1000;        // render for 5 min after the last interaction, then throttle-function renderLeaseTouch(sessionId) { if (sessionId) _renderLease.set(sessionId, Date.now() + RENDER_LEASE_MS); }-async function applyRenderEmu(session, on) {-  if (!session || session._renderEmuOn === on) return;-  session._renderEmuOn = on;-  for (const t of (session.tabs || [])) {-    const pg = t && t.page; if (!pg) continue;-    try { const cl = typeof pg._client === 'function' ? pg._client() : pg._client; if (cl) await cl.send('Emulation.setFocusEmulationEnabled', { enabled: on }); }-    catch (e) { session._renderEmuOn = !on; }   // failed — let the next reconcile retry-  }-}-setInterval(() => {-  if (process.platform !== 'win32') return;-  const now = Date.now();-  for (const [sid, s] of sessions) {-    const shouldRender = (_renderLease.get(sid) || 0) > now;-    if (s && s._renderEmuOn !== shouldRender) {-      const wasOn = s._renderEmuOn;-      applyRenderEmu(s, shouldRender).then(() => {-        if (!shouldRender && wasOn) console.log(`[render] "${sid}" render lease lapsed (idle ${RENDER_LEASE_MS / 60000} min) — focus-emulation OFF, window throttles to save battery (re-renders on next interaction)`);-      }).catch(() => {});-    }-  }-  for (const sid of [..._renderLease.keys()]) if (!sessions.has(sid)) _renderLease.delete(sid);-}, 15000);+// v2.0.285 RENDER LEASE / focus-emulation blank-window fix: REVERTED. Emulation.setFocusEmulationEnabled+// (the lever it used to keep an occluded window's page painted) ACTIVATES the OS window — it+// foregrounded a background pup window (John, 2026-08-22), reintroducing the exact focus-steal the+// whole off-screen-birth doctrine exists to prevent. And it did not reliably fix the blank thumbnail+// anyway. So it is gone. The blank-occluded-window problem is REAL and still open (dev-skills/+// pup-render-test), but the fix must NOT touch OS focus: candidates to investigate next are the+// browser-level launch flag --disable-backgrounding-occluded-windows (retains the compositor surface+// without emulating focus) and rendering ONLY on genuine reveal. Do NOT reintroduce focus-emulation.+function renderLeaseTouch() { /* no-op: render lease reverted (foregrounded windows) */ }  async function parkSessionWindowDirect(page, sessionId) {   // ── macOS park ── the whole background contract is one primitive: (re-)hide the@@ -10554,33 +10528,11 @@ async function createPageInNewWindow(browser, profileName) {         console.log(`[focus] UNEXPECTED: a new window took the foreground (${prevFg} -> ${nowFg}) despite off-screen birth — off-screen birth is supposed to make this impossible; investigate, do NOT add a handback.`);       }     } catch (e) {}-    // v2.0.280 (John's theory, MEASURED: a window born off-screen then parked occluded reports-    // visibilityState:'hidden' with requestAnimationFrame NOT firing, so it never paints its first-    // frame and looks BLANK until something forces one). John's ask, verbatim: "one rAF or one trigger-    // to get a rendering to occur" — NOT continuous rendering (that would chew CPU/battery like the-    // highFps launch flags on any page with a timer/animation). So this is a ONE-SHOT PULSE: turn on-    // focus-emulation just long enough to composite a single frame, then turn it back OFF so the window-    // returns to throttled/idle. Chrome retains the LAST composited frame for an occluded window, so-    // the content stays painted (not blank when revealed) at ZERO ongoing render cost. After the pulse-    // the page is back to visibilityState:'hidden' and rAF is paused — verified.-    if (fresh) {-      try {-        const _cl = typeof fresh._client === 'function' ? fresh._client() : fresh._client;-        if (_cl) {-          // MEASURED (2026-08-22, DWM-thumbnail test): the one-shot pulse FAILED — Chrome RELEASES an-          // occluded window's page-render surface, so a single painted frame is discarded and the-          // window goes blank again (toolbar persists, page area blank). Foregrounding renders it-          // fully, proving only the occluded state drops the surface. So keep focus-emulation ON: the-          // renderer treats the page as the active tab and RETAINS its composited surface while-          // occluded, so the taskbar thumbnail and an instant reveal show the page, not blank. A STATIC-          // page schedules no rAF and composites once then idles, so this is not a continuous render-          // (verified separately) — unlike the highFps anti-throttle LAUNCH flags that also unthrottle-          // every timer fleet-wide (the issue-#14 drain).-          await _cl.send('Emulation.setFocusEmulationEnabled', { enabled: true });-          console.log(`[render] focus-emulation ON for the new window (initial paint) — its render surface is kept while occluded so the thumbnail/reveal shows content; the RENDER LEASE (v2.0.283) downgrades it to throttled after ${RENDER_LEASE_MS / 60000} min idle to save battery`);-        }-      } catch (e) { console.log(`[render] could not enable focus-emulation on the new window: ${e && e.message}`); }-    }+    // v2.0.285: the blank-occluded-window fix that lived here (Emulation.setFocusEmulationEnabled at+    // birth) is REVERTED — it ACTIVATED the OS window and foregrounded a background pup window (John,+    // 2026-08-22), the exact focus-steal off-screen birth exists to prevent. The blank problem is still+    // real (dev-skills/pup-render-test) but must be solved WITHOUT touching OS focus. Do NOT reintroduce+    // focus-emulation on the new window here.     return fresh;   } catch (e) {     console.log(`[window] createPageInNewWindow failed: ${e.message}`);@@ -13769,10 +13721,6 @@ const server = http.createServer(async (req, res) => {       // (see PASSIVE_VERBS) or every window would read as permanently busy.       if (command && command.startsWith('pup_') && !PASSIVE_VERBS.has(command)) {         try { markSessionBusy(args.sessionId || activeSessionId); } catch (e) {}-        // v2.0.283: an interactive verb renews the RENDER LEASE, so a window the user is actively-        // using keeps its render surface (thumbnail/reveal show content); an idle one lapses and-        // throttles to save battery. Same "the agent is working this window" signal as markSessionBusy.-        try { renderLeaseTouch(args.sessionId || activeSessionId); } catch (e) {}       }        switch (command) {