Skip to main content
Admin Modules

F12 Console Audit

Automated console error detection across all Arcturus-Prime pages using hidden iframes

February 28, 2026

F12 Console Audit

The F12 Console Audit at /admin/f12-audit automatically loads every page on the site inside a hidden same-origin iframe and captures JavaScript console errors, warnings, uncaught exceptions, and failed resource loads. It’s the equivalent of manually opening DevTools on each page and checking the Console tab.

How It Works

Capture Script (Layout Injection)

Both CosmicLayout.astro and BaseLayout.astro include a tiny inline script after <meta charset> that only activates when the page is loaded inside an iframe:

(function(){
  if (window === window.top) return;  // no-op on normal page loads
  window.__f12 = { errors: [], warnings: [], exceptions: [], resources: [] };

  var ce = console.error, cw = console.warn;
  console.error = function() {
    window.__f12.errors.push([].slice.call(arguments).map(String).join(' '));
    ce.apply(console, arguments);
  };
  console.warn = function() {
    window.__f12.warnings.push([].slice.call(arguments).map(String).join(' '));
    cw.apply(console, arguments);
  };

  window.addEventListener('error', function(e) {
    window.__f12.exceptions.push(
      (e.message || '') + (e.filename ? ' at ' + e.filename + ':' + e.lineno : '')
    );
  });
  window.addEventListener('unhandledrejection', function(e) {
    window.__f12.exceptions.push('Unhandled: ' + String(e.reason));
  });
  document.addEventListener('error', function(e) {
    var t = e.target;
    if (t && (t.tagName === 'IMG' || t.tagName === 'SCRIPT' || t.tagName === 'LINK'))
      window.__f12.resources.push(t.tagName + ': ' + (t.src || t.href || '?'));
  }, true);
})();

Zero performance impact on normal browsing — the window === window.top check exits immediately when not in an iframe.

Audit Engine

The /admin/f12-audit page:

  1. Creates a hidden <iframe> element
  2. Loads each URL sequentially (with 8s timeout per page)
  3. After load, reads iframe.contentWindow.__f12 for captured findings
  4. Applies noise filtering to suppress known benign warnings
  5. Displays results grouped by suite with expandable error details

Test Suites (16 total, 155 URLs)

SuiteURLsWhat It Covers
Core Pages13Homepage, about, contact, status, architecture, telemetry, etc.
Blog & Content5Blog index, journal, projects, resources, tags
Documentation1Public /docs/ index
Playground12All 12 playground variants (build-swarm, monitoring, RAG, etc.)
Command Center10All command pages (infrastructure, build, network, services, etc.)
Demo5Demo landing, sandbox, sim, tour, workbench
User & Dashboard11User settings, editor, workbench, email, dashboards, auth
Ansible2Sandbox and docs
Learn & Resources9Learn index plus tutorial, docker-compose, k8s, cheatsheets, etc.
Projects12All project pages (build-swarm, apkg, argo-os, tendril, etc.)
Admin — Core37Main admin hub, health, settings, modules, all core admin pages
Admin — OpenClaw6Dashboard, config, cron, skills, sessions, RAG browser
Admin — Argonaut6Hub, chat, profiles, tasks, writer
Admin — Pentest8Hub, assessment, console, exploit, recon, reports, targets, webapp
Admin — Servers13Server pages, proxmox, telephony (Bland, ElevenLabs, Twilio)
Admin — Sandbox5Sandbox hub, bogie dashboard, demo, workbench, probe studio

Noise Filtering

Known benign warnings are suppressed:

  • View Transitions route announcer warnings
  • Third-party script loading messages
  • Development-only warnings
  • Font loading timeouts

Prerequisites

  • X-Frame-Options: SAMEORIGIN in public/_headers (changed from DENY to support this feature)
  • Same-origin iframes share cookies, so CF Access JWT tokens pass through automatically

CSS Prefix

All classes use the f12- prefix to avoid conflicts with other test pages (st- for site-test, sy- for system-test, th- for testing hub).

View Transitions Compatibility

Uses dedup guard (window.__f12AuditBound) and route check (window.location.pathname === '/admin/f12-audit') to prevent event listener stacking during View Transitions navigation.

Bugs Found & Fixed via Console Audit

2026-03-01: Pipeline, Ansible Sandbox, CSP (commit 592c39f)

A full browser console dump revealed four bugs across three files:

BugFileRoot CauseFix
Identifier 'PS' has already been declaredpipeline.astro:589const PS at global scope in <script is:inline> — redeclaration fails on View Transitions re-navigationChanged to var PS
Duplicate var typingpipeline.astro:1278Same variable declared in both try and catch blocksRemoved var from catch block
Cannot use import.meta outside a moduleansible/sandbox.astro:329<script is:inline define:vars={...}> — Astro injects import.meta into classic scriptReplaced with JSON config element
CSP violations (fonts, GitHub API, blob)public/_headers:178Missing domains in style-src, font-src, connect-src, img-srcAdded fonts.googleapis.com, fonts.gstatic.com, api.github.com, blob:

Key patterns to watch for:

  • <script is:inline> with top-level const/let will break on View Transitions re-navigation — use var or scope inside astro:page-load
  • Never combine is:inline with define:vars — use JSON config elements or data-* attributes instead
  • The F12 audit catches errors on initial page load but NOT on View Transitions re-navigation (the const redeclaration only manifests on second visit)
admintestingconsoleerrorsauditf12