← Commit history

Stop reporting ok:true for a page that plainly did not render (John's catch). The launcher-mockup thread opened a .adom.cloud app that served '404 page not found'; pup answered ok:true, said nothing, and the AI reported success. Telling the caller to screenshot was too weak, so pup now LOOKS: a new probeRender() checks the loaded document (main-frame HTTP status captured from goto, plus 404 / 'Cannot GET' / server-error / visible-stack-trace text, effectively-blank body, zero stylesheets loaded, broken images) and the open response carries a machine-readable renderCheck{ok,httpStatus,signals,excerpt}. When it detects a failure, _verifyRender no longer offers advice — it LEADS with 'THIS PAGE DID NOT RENDER CORRECTLY, pup checked it, do NOT report success', names the signals, quotes the page, and says do not tell the user it works while this warning is present. Fixed my own silent bug along the way: the HTTP status was being assigned to a 'session' variable that does not exist in launchSession, so it was throwing into a catch and capturing nothing; it is now stashed on the page object.

John Lauer ·ad940b916b ·3mo ago ·parent 3a7d97f
4 files changed +64−8
adom-bridge-puppeteer-manifest.json+4−4
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "1.9.104",-  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.104/adom-bridge-puppeteer-v1.9.104.zip",-  "sha256": "78648acde846b20ae2a7aaad47b23b9ada3da93b65df2caab1ce2464db1715f2",-  "size": 375586,+  "version": "1.9.105",+  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.105/adom-bridge-puppeteer-v1.9.105.zip",+  "sha256": "46bb86b43a8953c9da1426c48dd909901e809e0eccff42545b55d126e30ecd3c",+  "size": 377109,   "verbPrefixes": [     "browser_",     "desktop_recorder_",
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-1.9.104+1.9.105
src/bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "puppeteer",   "displayName": "Puppeteer (Chrome for Testing + Native)",-  "version": "1.9.104",+  "version": "1.9.105",   "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+58−2
@@ -5181,7 +5181,9 @@ async function launchSession(sessionId, url, { freshProfile = false, profile, st     } catch (e) {       console.log(`[creds] applyCredentialsToPage on launchSession failed: ${e.message}`);     }-    await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 });+    // v1.9.105: keep the main-frame HTTP status — the strongest broken-render signal there is.+    const _resp = await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 });+    try { page.__pupHttpStatus = _resp && typeof _resp.status === 'function' ? _resp.status() : null; } catch (e) {}     // v1.8.68: wait for the page to SETTLE (load event, capped at 2.5s) while the window is     // still OFF-SCREEN, so the first paint's window-raise is invisible. Skip the wait if the     // page is already complete.@@ -5743,6 +5745,47 @@ const PUP_ISSUES_REF = 'adom/adom-desktop-puppeteer-bridge'; // says nothing about whether the page painted, whether the CSS loaded, or whether a stack trace is // filling the viewport. pup is the one component that knows a window was just pointed at content, // so it is the right place to insist on verification — in the response the AI actually reads.+// v1.9.105 (John: "you didn't even attempt to test their content and as you can see its 404") —+// PROGRAMMATIC RENDER CHECK. Telling the AI "go screenshot it" proved too weak: the launcher-mockup+// thread opened a .adom.cloud app that served "404 page not found", pup answered ok:true and said+// NOTHING, and the AI reported success. pup HAS the page, so it can just LOOK. This probes the loaded+// document and returns a verdict, making a broken render a FACT in the response instead of a suggestion+// the caller may skip. One evaluate, no screenshot, and it never throws into the caller's path.+async function probeRender(page, httpStatus) {+  const out = { httpStatus: (httpStatus === undefined ? null : httpStatus), ok: true, signals: [] };+  try {+    const probe = await Promise.race([+      page.evaluate(() => {+        const t = (document.body ? (document.body.innerText || '') : '').trim();+        return {+          title: document.title || '',+          bodyChars: t.length,+          head: t.slice(0, 400),+          elements: document.body ? document.body.querySelectorAll('*').length : 0,+          styleSheets: document.styleSheets ? document.styleSheets.length : 0,+          brokenImgs: document.images+            ? Array.from(document.images).filter(i => i.complete && i.naturalWidth === 0).length : 0,+        };+      }),+      new Promise(r => setTimeout(() => r(null), 4000)),+    ]);+    if (!probe) { out.signals.push('probe_timed_out'); return out; }+    out.title = probe.title; out.bodyChars = probe.bodyChars; out.elements = probe.elements;+    const head = String(probe.head || '');+    const low = head.toLowerCase();+    if (typeof out.httpStatus === 'number' && out.httpStatus >= 400) out.signals.push('http_' + out.httpStatus);+    if (/\b404\b|page not found|not found\b/.test(low)) out.signals.push('page_says_not_found');+    if (/cannot (get|post) \//i.test(head)) out.signals.push('dev_server_cannot_get');+    if (/internal server error|bad gateway|service unavailable/.test(low)) out.signals.push('server_error_text');+    if (/traceback \(most recent call last\)|unhandled (exception|rejection)|referenceerror|typeerror:|syntaxerror:/.test(low)) out.signals.push('stack_trace_visible');+    if (probe.bodyChars < 12 && probe.elements < 8) out.signals.push('effectively_blank');+    if (probe.bodyChars > 40 && probe.styleSheets === 0) out.signals.push('no_stylesheets_loaded');+    if (probe.brokenImgs > 0) out.signals.push('broken_images_' + probe.brokenImgs);+    out.ok = out.signals.length === 0;+    if (!out.ok) out.excerpt = head.slice(0, 180);+  } catch (e) { out.signals.push('probe_failed'); }+  return out;+} const RENDER_VERBS = new Set(['browser_open_window', 'browser_open_tab', 'browser_navigate', 'browser_reload']); // A URL that is almost certainly the caller's OWN work-in-progress (a dev server, a local file, an // Adom-hosted app) earns the strongest wording — that is exactly the case John described.@@ -5757,9 +5800,22 @@ function looksLikeOwnContent(u) {         || /^(\d{1,3}\.){3}\d{1,3}$/.test(h);   } catch (e) { return false; } }-function renderVerifyHint(sessionId, url) {+function renderVerifyHint(sessionId, url, rc) {   const sid = sessionId || '<sessionId>';   const own = looksLikeOwnContent(url);+  // A DETECTED failure outranks advice: say what is wrong in the first words the caller reads.+  if (rc && rc.ok === false && (rc.signals || []).length) {+    const sig = rc.signals.join(', ');+    const st = (typeof rc.httpStatus === 'number') ? ' (HTTP ' + rc.httpStatus + ')' : '';+    const ex = rc.excerpt ? ' The page says: "' + String(rc.excerpt).replace(/\s+/g, ' ').slice(0, 140) + '".' : '';+    return 'THIS PAGE DID NOT RENDER CORRECTLY — pup checked it, so do NOT report success. Detected: '+      + sig + st + '.' + ex+      + ' See it yourself: `adom-desktop browser_screenshot {"sessionId":"' + sid + '"}`.'+      + ' Then FIX THE CAUSE: a 404 or "Cannot GET" usually means the dev server is not running, is on a'+      + ' different port, or the path is wrong; unstyled HTML means the CSS 404d; a stack trace means the'+      + ' app threw. After fixing, `browser_reload` and re-check until this response comes back clean.'+      + ' Do not tell the user it works while this warning is present.';+  }   const lead = own     ? 'THIS LOOKS LIKE CONTENT YOU JUST BUILT OR EDITED — SCREENSHOT IT AND LOOK BEFORE YOU CLAIM IT WORKS.'     : 'VERIFY WHAT YOU JUST PUT ON SCREEN — do not assume it rendered.';