← Commit history

v2.0.234: A port blocked by a Windows reservation no longer kills the bridge: instead of exiting into a respawn loop that ends in backoff, pup stays alive, explains which reserved range swallowed its assigned port and how to release it, and retries that same port every fifteen seconds so it comes back by itself the moment the range frees, with no respawn and no human in the loop.

John Lauer ·a880da9ecd ·2mo ago ·parent 74ffa02
4 files changed +43−41
adom-bridge-puppeteer-manifest.json+5−5
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "2.0.232",-  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.232/adom-bridge-puppeteer-v2.0.232.zip",-  "sha256": "c77af5d327485fa551bea3d83f7daf6822b2f1df3acdbe9aeb166e4e842111e7",-  "size": 944841,+  "version": "2.0.234",+  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.234/adom-bridge-puppeteer-v2.0.234.zip",+  "sha256": "bb77b1d8d43564c7f49490054cdf146faf9840e01b400ffb9ab3d667c2d7b45d",+  "size": 945203,   "verbPrefixes": [     "browser_",     "desktop_recorder_",@@ -12,5 +12,5 @@   ],   "healthEndpoint": "/status",   "statusVerb": "browser_readiness",-  "released_at": "2026-08-18T11:52:01.905110Z"+  "released_at": "2026-08-18T12:11:33.323177Z" }
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-2.0.232\ No newline at end of file+2.0.234\ 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.232",+  "version": "2.0.234",   "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+36−34
@@ -10584,16 +10584,10 @@ function resolveSessionOrError(args) { // sendTabResolveError — used by every dispatch site that calls // resolveSessionOrError, so the structured payload (errorCode + // currentSessions + _hint) reaches the caller intact.-function sendSessionResolveError(res, e) {-  if (e && e._isStructured) {-    try {-      const parsed = JSON.parse(e.message);-      sendJSON(res, { success: false, ...parsed });-      return;-    } catch {}-  }-  sendJSON(res, { success: false, error: e.message });-}+// v2.0.233: this was a byte-for-byte copy of sendTabResolveError (verified by AST compare) — the+// same structured-error unwrap written twice under two names. One implementation, two names kept so+// each call site still reads as "session" or "tab" at its site.+const sendSessionResolveError = sendTabResolveError;  // v1.6.1+: the AUTO-RECOVER path. Tries every layer of recovery before // surfacing a session-not-found error to the caller. Used by every@@ -18539,7 +18533,7 @@ setInterval(async () => { // heal, routing resumes; if ab already gave up on us, the NEXT spawn heals against us and gets // tracked — one extra cycle, never a loop (3-retry cap either way). let _bindRetries = 0;-let _eaccesHandled = false;+let _eaccesTries = 0; server.on('error', (err) => {   const code = err && err.code;   // v2.0.231 (John's machine, 2026-08-18): EACCES on a loopback port is almost never a permission@@ -18549,32 +18543,40 @@ server.on('error', (err) => {   // rebooted, with nothing but "fatal listen error (EACCES)" to go on. Now pup NAMES the cause,   // prints the exact remedy, and binds a fallback port anyway so its own HTTP surface (dashboard,   // /health) is reachable and the port file tells the truth about where it landed.-  if (code === 'EACCES' && process.platform === 'win32' && !_eaccesHandled) {-    _eaccesHandled = true;-    let ranges = '';-    try {-      ranges = execFileSync('netsh', ['int', 'ipv4', 'show', 'excludedportrange', 'protocol=tcp'], { timeout: 8000, windowsHide: true }).toString();-    } catch (e) {}-    const inRange = (() => {+  // v2.0.234 (John's AdomLapper, 2026-08-18): EACCES on a loopback port means the port sits inside a+  // Windows RESERVED range — Hyper-V/WinNAT grabs blocks (here 64160-64259, which swallowed ab's+  // assigned 64230) at every boot. Exiting made this a silent permanent outage: ab respawned on the+  // same port, hit the same wall, and after 3 tries went into backoff, so pup stayed dead until+  // someone ran an elevated `net stop winnat`. Now pup STAYS ALIVE and re-attempts the SAME port on+  // a backoff, so the instant the range is released (winnat restart, Docker/WSL shutdown, reboot)+  // it binds and is healthy on the port ab is already routing to — no respawn, no human, no gap.+  if (code === 'EACCES' && process.platform === 'win32') {+    _eaccesTries++;+    if (_eaccesTries === 1) {+      let ranges = '';+      try { ranges = execFileSync('netsh', ['int', 'ipv4', 'show', 'excludedportrange', 'protocol=tcp'], { timeout: 8000, windowsHide: true }).toString(); } catch (e) {}+      let inRange = null;       for (const m of ranges.matchAll(/^\s*(\d+)\s+(\d+)/gm)) {         const a = Number(m[1]), b = Number(m[2]);-        if (PORT >= a && PORT <= b) return `${a}-${b}`;+        if (PORT >= a && PORT <= b) { inRange = `${a}-${b}`; break; }       }-      return null;-    })();-    console.error(`[bind] EACCES on port ${PORT}${inRange ? ` — that port is inside the Windows RESERVED range ${inRange}` : ''}.`);-    console.error(`[bind] This is a Windows port-exclusion (Hyper-V/WinNAT reserves blocks at boot), NOT a pup bug and NOT a permissions issue.`);-    console.error(`[bind] FIX (elevated): net stop winnat && net start winnat   — or reboot. Then ab can spawn pup on ${PORT} again.`);-    console.error(`[bind] Meanwhile pup is binding a FALLBACK port so its dashboard/health stay reachable; ab routes verbs to ${PORT}, so verb routing stays down until the range is released.`);-    try {-      server.listen(0, '127.0.0.1', () => {-        const alt = server.address() && server.address().port;-        console.error(`[bind] fallback listening on 127.0.0.1:${alt} (ab's assigned port ${PORT} is unusable)`);-        try { writePupPortFile(alt); } catch (e) {}-      });-      return;-    } catch (e) {}-    process.exit(1);+      console.error(`[bind] EACCES on 127.0.0.1:${PORT}${inRange ? ` — that port is inside the Windows RESERVED range ${inRange}` : ''}.`);+      console.error('[bind] Cause: Windows (Hyper-V/WinNAT) reserves port blocks at boot. Not a pup bug, not a permissions problem, and NOT fixable from this process.');+      console.error('[bind] Release it (elevated): net stop winnat && net start winnat   — or reboot. Filed as adom/adom-bridge#83 so ab stops assigning ports inside these ranges.');+      console.error(`[bind] pup will STAY UP and retry ${PORT} every 15s; it binds automatically the moment the range is released.`);+    } else if (_eaccesTries % 20 === 0) {+      console.error(`[bind] still cannot bind ${PORT} (Windows reserved range) — ${_eaccesTries} attempts; retrying every 15s.`);+    }+    setTimeout(() => {+      try {+        server.listen(PORT, BIND_HOST, () => {+          console.error(`[bind] RECOVERED — the Windows reservation on ${PORT} was released after ${_eaccesTries} attempt(s); pup is live on its assigned port with no respawn needed.`);+          _eaccesTries = 0;+          try { _onPupBound(); } catch (e) {}+        });+      } catch (e) {}+    }, 15000);+    return;   }   if (code !== 'EADDRINUSE' || process.platform !== 'win32' || _bindRetries >= 3) {     console.error(`[bind] fatal listen error (${code || (err && err.message)}) — exiting so the supervisor respawns cleanly`);