← Commit history

v2.0.231: A bind failure on the assigned port now explains itself instead of crash-looping invisibly: pup reads the Windows excluded port ranges, names the range that swallowed its port, prints the elevated WinNAT restart that releases it, and binds a fallback port so its dashboard and health surface stay reachable while recording the real port in its discovery file.

John Lauer ·c7a122ed0a ·2mo ago ·parent 5b33ac5
4 files changed +46−9
adom-bridge-puppeteer-manifest.json+5−5
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "2.0.230",-  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.230/adom-bridge-puppeteer-v2.0.230.zip",-  "sha256": "32bc9171c0918256fb48105e3b46dfa9d33175dea8f8dc1da36a84996f69f8c4",-  "size": 943680,+  "version": "2.0.231",+  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.231/adom-bridge-puppeteer-v2.0.231.zip",+  "sha256": "027cbf46a90d626ae7f3c3c21953252eed02a0a4e6ae86786871acb7fb69ff29",+  "size": 944590,   "verbPrefixes": [     "browser_",     "desktop_recorder_",@@ -12,5 +12,5 @@   ],   "healthEndpoint": "/status",   "statusVerb": "browser_readiness",-  "released_at": "2026-08-18T11:16:35.547046Z"+  "released_at": "2026-08-18T11:50:10.168750Z" }
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-2.0.230\ No newline at end of file+2.0.231\ 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.230",+  "version": "2.0.231",   "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+39−2
@@ -3771,12 +3771,14 @@ function pupPortFile() {   const la = process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local');   return path.join(la, 'Adom Bridge', 'pup-bridge-port.json'); }-function writePupPortFile() {+function writePupPortFile(overridePort) {   if (process.platform !== 'win32') return;   try {     const f = pupPortFile();     fs.mkdirSync(path.dirname(f), { recursive: true });-    fs.writeFileSync(f, JSON.stringify({ port: PORT, pid: process.pid, version: BRIDGE_VERSION, host: '127.0.0.1' }));+    // v2.0.231: overridePort lets the EACCES fallback record the port pup ACTUALLY bound, so the+    // file never advertises a port nothing is listening on.+    fs.writeFileSync(f, JSON.stringify({ port: Number(overridePort) || PORT, pid: process.pid, version: BRIDGE_VERSION, host: '127.0.0.1', assignedPort: PORT, fallback: !!overridePort }));   } catch (e) { console.error('[jumplist] port-discovery write failed:', e.message); } } const PUP_JL_LAUNCHER_VERSION = 3;   // bump to force-rewrite the .ps1 on upgrade@@ -18537,8 +18539,43 @@ 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; 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+  // problem — on Windows it means the port sits inside a RESERVED range (Hyper-V/WinNAT grabs+  // blocks like 64160-64259 at boot). ab assigns the port, so pup cannot fix routing by itself, and+  // exiting produced an invisible crash-loop: the bridge died on every spawn until the machine was+  // 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 = (() => {+      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}`;+      }+      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);+  }   if (code !== 'EADDRINUSE' || process.platform !== 'win32' || _bindRetries >= 3) {     console.error(`[bind] fatal listen error (${code || (err && err.message)}) — exiting so the supervisor respawns cleanly`);     process.exit(1);