← Commit history

Durable session identity via window.name — fixes the recovery mis-bind John's overlay audit exposed (the overlay honestly reported favicon:espncdn on docs-writer's window, and the eval confirmed the horror: docs-writer's session was attached to ship-watch's ESPN page after the upgrade restart — two sessions on one window). Root cause: recovery matches Chrome targets to sessions by the '(session: X)' tag in document.title, and SPA sites (ESPN's ticker) rewrite the title continuously; the MutationObserver that re-appends the tag dies on every navigation, so recovery during the gap guesses wrong. Fix: window.name = 'pup:<sessionId>' is now stamped at both title-injection sites — window.name SURVIVES same-tab navigations and sites never touch it — and the recovery matcher reads window.name FIRST, falling back to the title tag only when absent. The title tag remains for AD's window resolver. Found because the new overlay column told the truth about a window everyone assumed was right: the proof surface caught a deeper bug on its first day.

John Lauer ·a3327ba9c1 ·3mo ago ·parent 13a1c22
4 files changed +24−11
adom-bridge-puppeteer-manifest.json+4−4
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "1.9.150",-  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.150/adom-bridge-puppeteer-v1.9.150.zip",-  "sha256": "bca6e47f3b9d6fddc280c5252294958c11989e31d86ab979dfe341827eda9043",-  "size": 399992,+  "version": "1.9.151",+  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.151/adom-bridge-puppeteer-v1.9.151.zip",+  "sha256": "ac31d975fc2d81b06615f225d97dfcf840a58f676cfc2a2a4787bf2a28147925",+  "size": 400381,   "verbPrefixes": [     "browser_",     "desktop_recorder_",
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-1.9.150+1.9.151
src/bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "puppeteer",   "displayName": "Puppeteer (Chrome for Testing + Native)",-  "version": "1.9.150",+  "version": "1.9.151",   "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. 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, browser_alert_window posts a native toast whose click focuses the window, browser_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-desktop",   "author": "Adom Inc.",
src/server.js+18−5
@@ -1183,7 +1183,14 @@ async function rescanProfile(browser, profileName, { adoptOrphans = false } = {}     }     let title = '';     try { title = await page.title(); } catch { /* page closed during rescan */ continue; }-    let sessionId = parseSessionIdFromTitle(title);+    // v1.9.151: match by window.name FIRST — the durable carrier. Title tags die under SPA+    // title churn (the espn mis-bind); window.name survives every same-tab navigation.+    let sessionId = null;+    try {+      const wn = await page.evaluate(() => window.name);+      if (wn && typeof wn === 'string' && wn.startsWith('pup:')) sessionId = wn.slice(4).trim() || null;+    } catch (e) {}+    if (!sessionId) sessionId = parseSessionIdFromTitle(title);     if (!sessionId) {       // No tag — could be a freshly-opened tab the user navigated to via       // Chrome's New Tab Page, or a page the bridge already managed but@@ -2907,9 +2914,10 @@ async function brandSweep(reason) {       if (!tab || !tab.page) continue;       // re-assert the title suffix so AD's resolver can find the window even after title churn       try {-        await tab.page.evaluate((suffix) => {+        await tab.page.evaluate((suffix, sid2) => {           try { if (document.title.indexOf(suffix) === -1) document.title += suffix + ')'; } catch (e) {}-        }, ` (session: ${sid}`);+          try { if (window.name !== 'pup:' + sid2) window.name = 'pup:' + sid2; } catch (e) {}+        }, ` (session: ${sid}`, sid);       } catch (e) {}       const ok = await brandPupWindow(sid);       if (ok) n++;@@ -3694,7 +3702,12 @@ async function retagSessionTitle(page, sessionId, profileName) {     ? ` (session: ${sessionId} | profile: ${profileName})`     : ` (session: ${sessionId})`;   try {-    await page.evaluate((sfx) => {+    await page.evaluate((sfx, sid) => {+      // v1.9.151: window.name is the DURABLE session carrier — it survives same-tab navigations+      // and sites never rewrite it, unlike document.title (ESPN's ticker destroyed the title tag+      // and the upgrade-restart recovery mis-bound docs-writer's session onto ship-watch's espn+      // window — two sessions, one page). Title stays for AD's resolver; window.name is truth.+      try { window.name = 'pup:' + sid; } catch (e) {}       // v1.9.43: strip EVERY "(session: ...)" occurrence, not just a trailing one. The old session's       // observer had already re-appended its suffix, so a trailing-only strip missed and we stacked       // two: "BMV080 (session: thr) (session: thr-split1-mkh7)". The window then still answered to@@ -3707,7 +3720,7 @@ async function retagSessionTitle(page, sessionId, profileName) {       });       obs.observe(document.querySelector('title') || document.head, { childList: true, subtree: true, characterData: true });       window.__pupTitleObs = obs;-    }, suffix);+    }, suffix, sessionId);     return true;   } catch (e) { return false; } }