← Commit history

v1.9.34: deploy drag diagnostics, reuse the global window-opened watch instead of leaking one per restart

John Lauer ·12982313ef · ·parent 4910a81
5 files changed +47−11
CHANGELOG.md+16
@@ -1,5 +1,21 @@ # Changelog — Adom Desktop Puppeteer Bridge +## 1.9.34 — 2026-07-20 — Drag-out diagnostics actually deployed, plus a UIA watch leak fix++Two things, one of them a process failure worth naming. The 1.9.33 diagnostic build never reached+the desktop: the manifest was updated LOCALLY but never pushed, so the manifest URL still served+1.9.32 and bridge_install correctly reinstalled 1.9.32 while reporting "Installed". Every conclusion+drawn from that build's logs was worthless. Lesson: after `release upload`, ALWAYS `repo push` the+manifest and verify the SERVED version before installing (a bare "Installed" proves nothing).++Also fixed a real leak this hunt exposed: pup subscribed to the global window-opened UIA watch on+every bridge start and never unsubscribed, accumulating watches (w1..w4 observed live). It now+reuses an existing global window-opened watch when one is present, since all events land in one+shared ring drained by sequence number.++Carries the drag-out diagnostics: every step of detection now logs (drain counts, per-tab window+ids, adoption or the reason none happened) so a silent failure cannot hide again.+ ## 1.9.32 — 2026-07-20 — Fix: the drag-out event was filtered away by its own (empty) name  1.9.31 subscribed to window-opened correctly but filtered the events by window NAME
adom-bridge-puppeteer-manifest.json+5−5
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "1.9.32",-  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.32/adom-bridge-puppeteer-v1.9.32.zip",-  "sha256": "af1606959bc4f0e3f3437049ac84f7ef74c79e264f209524cdc35b9ed49b5966",-  "size": 285115,+  "version": "1.9.34",+  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.34/adom-bridge-puppeteer-v1.9.34.zip",+  "sha256": "7b2e6573c970acd2a39b562ca93f218301fb2e064b86ce32783002df09ec4a05",+  "size": 285611,   "verbPrefixes": [     "browser_",     "desktop_recorder_",@@ -12,5 +12,5 @@   ],   "healthEndpoint": "/status",   "statusVerb": "browser_readiness",-  "released_at": "2026-07-20T15:00:00Z"+  "released_at": "2026-07-20T15:30:00Z" }
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-1.9.32\ No newline at end of file+1.9.34\ 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.9.32",+  "version": "1.9.34",   "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+24−4
@@ -2355,6 +2355,22 @@ let _uiWatchSupported = null;   // null = unprobed, false = AD too old async function ensureWindowOpenedWatch() {   if (process.platform !== 'win32' || _uiWatchSupported === false || _uiWatchId) return;   try {+    // v1.9.34: REUSE an existing global window-opened watch instead of adding another. Every bridge+    // restart used to subscribe again and never unsubscribe, leaking watches (seen live: w1..w4).+    // Events land in ONE shared ring drained by seq, so any existing watch serves us fine.+    try {+      const er = await chrome.adCommand('desktop_ui_events', { sinceSeq: 0, max: 1 }, { timeoutMs: 5000 });+      const eraw = er && (typeof er.output === 'string' ? er.output : JSON.stringify(er.output || ''));+      if (eraw) {+        const eo = JSON.parse(eraw);+        const existing = ((eo.data || eo).activeWatches || []).find(w => w.event === 'window-opened' && w.scope === 'global');+        if (existing && existing.watchId) {+          _uiWatchId = existing.watchId; _uiWatchSupported = true;+          console.log(`[drag] reusing existing window-opened watch (${_uiWatchId}) — no new subscription`);+          return;+        }+      }+    } catch (e) {}     const r = await chrome.adCommand('desktop_ui_watch', { event: 'window-opened' }, { timeoutMs: 6000 });     const raw = r && (typeof r.output === 'string' ? r.output : JSON.stringify(r.output || ''));     if (_isUnknownVerb(r, raw)) { _uiWatchSupported = false; return; }@@ -2371,7 +2387,7 @@ async function pageWindowId(page) {     cdp = await page.target().createCDPSession();     const { windowId } = await cdp.send('Browser.getWindowForTarget');     return windowId;-  } catch (e) { return null; }+  } catch (e) { console.log(`[drag] pageWindowId FAILED: ${e.message}`); return null; }   finally { try { if (cdp) await cdp.detach(); } catch (e) {} } } // Split any tab that no longer shares its session's window into its own session.@@ -2380,12 +2396,15 @@ async function adoptDraggedOutTabs(sessionId) {   if (!session || (session.tabs || []).length < 2) return 0;   let adopted = 0;   try {+    console.log(`[drag] checking "${sessionId}" (${session.tabs.length} tabs)`);     const active = (session.tabs || []).find(t => t.tabId === session.activeTabId) || session.tabs[0];     const homeWin = await pageWindowId(active.page);+    console.log(`[drag] "${sessionId}" home window (active ${active.tabId}) = ${homeWin}`);     if (homeWin == null) return 0;     for (const t of [...session.tabs]) {       if (t === active) continue;       const wid = await pageWindowId(t.page);+      console.log(`[drag] "${sessionId}" ${t.tabId} window = ${wid}${wid === homeWin ? ' (same)' : ' (DIFFERENT -> adopt)'}`);       if (wid == null || wid === homeWin) continue;       // This tab lives in a DIFFERENT OS window now → it was dragged out. Give it its own session.       const newId = `${sessionId}-split${adopted + 1}-${Date.now().toString(36).slice(-4)}`;@@ -2412,7 +2431,7 @@ async function adoptDraggedOutTabs(sessionId) {       try { saveSessionFile(newId, ns.profileName, u); } catch (e) {}     }     if (adopted) { try { await updateTabCountBadge(session, sessionId); } catch (e) {} }-  } catch (e) {}+  } catch (e) { console.log(`[drag] adopt threw: ${e.message}`); }   return adopted; } // Drain the window-opened ring; a new window means SOME session may have lost a tab. Cheap: one@@ -2420,11 +2439,11 @@ async function adoptDraggedOutTabs(sessionId) { async function drainWindowOpenedEvents() {   if (process.platform !== 'win32' || _uiWatchSupported === false) return;   await ensureWindowOpenedWatch();-  if (!_uiWatchId) return;+  if (!_uiWatchId) { console.log('[drag] drain skipped: no watchId'); return; }   try {     const r = await chrome.adCommand('desktop_ui_events', { sinceSeq: _uiWatchSeq, max: 200 }, { timeoutMs: 6000 });     const raw = r && (typeof r.output === 'string' ? r.output : JSON.stringify(r.output || ''));-    if (!raw) return;+    if (!raw) { console.log('[drag] drain got NO response from desktop_ui_events'); return; }     const o = JSON.parse(raw);     const data = o.data || o;     const evs = data.events || [];@@ -2435,6 +2454,7 @@ async function drainWindowOpenedEvents() {     // needed event was seq 32 with name ""). Any window-opened is enough of a hint; the follow-up     // check is cheap (one getWindowForTarget per tab, multi-tab sessions only) and idempotent.     if (!evs.length) return;+    console.log(`[drag] drained ${evs.length} window-opened event(s) (seq -> ${_uiWatchSeq}); checking ${sessions.size} session(s)`);     for (const [sid] of [...sessions]) { await adoptDraggedOutTabs(sid); }   } catch (e) {} }