Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 5 min read

How I Built a Zero-Backend Chrome MV3 AI Extension That Turns Screenshots, Console & 404/500 Logs into Jira Tickets

Most bug reports fail before an engineer even opens DevTools. Someone spots a broken checkout button, takes a cropped screenshot, pastes it into Jira with "Payment fails sometimes", and moves on. The developer then spen

Most bug reports fail before an engineer even opens DevTools.

Someone spots a broken checkout button, takes a cropped screenshot, pastes it into Jira with "Payment fails sometimes", and moves on. The developer then spends 20 minutes guessing which endpoint returned HTTP 500, what was in console.error, what viewport size was active, and what exact payload broke the page.

Existing bug-reporting SaaS tools solve part of this β€” until your company security team asks why production screenshots, stack traces, and API responses are being uploaded to a third-party cloud server.

So I built BugAgent AI β€” a zero-backend Chrome Manifest V3 extension that captures screenshots (with built-in annotation & GDPR blur), dev console errors, and failing HTTP 4xx/5xx responses, analyzes them directly via Claude, Gemini, OpenAI, or local Ollama, and submits a formatted Jira Wiki Markup ticket in one click.

Here are the three hardest Chrome MV3 engineering problems I ran into while building it β€” and how the architecture works under the hood.

1. Why chrome.webRequest Alone Isn't Enough for Network Debugging

If you try to build a bug sniffer in Manifest V3 using only chrome.webRequest.onCompleted, you hit a wall immediately:

  • chrome.webRequest reliably catches every HTTP >= 400 status code (including failed CSS/image assets, cross-origin requests, and redirects) and low-level failures via onErrorOccurred.
  • However, chrome.webRequest does not give you the response body. Knowing that POST /api/checkout returned 500 is helpful, but knowing the JSON body was {"error":"INVALID_COUPON_DECIMAL","code":500} is what actually lets an AI (or developer) pinpoint the root cause.

To solve this without requiring the user to keep Chrome DevTools open (chrome.debugger triggers an intrusive yellow "started debugging this browser" banner on every tab), I combined two complementary layers:

  1. Service Worker (chrome.webRequest): Buffers the last 25 failed requests per tabId (clears automatically on reload or tab close) so asset errors and network timeouts are never missed.
  2. MAIN World Sniffer (page-sniffer.js): Wraps window.fetch, XMLHttpRequest, console.error, window.onerror, and unhandledrejection inside a lightweight 20-entry ring buffer right inside the page context β€” capturing truncated response snippets (<= 800 chars) for failing fetch/XHR calls:
// Simplified excerpt from content/page-sniffer.js (MAIN world ring buffer)
const originalFetch = window.fetch;
window.fetch = async function (...args) {
  const startTime = Date.now();
  const response = await originalFetch.apply(this, args);

  if (!response.ok && response.status >= 400) {
    // Clone so the host app can still read the response stream normally
    const clone = response.clone();
    const responseBody = await clone.text().catch(() => '');

    addLog({
      category: 'network',
      type: 'fetch',
      status: response.status,
      method,
      url,
      durationMs: Date.now() - startTime,
      responseSnippet: responseBody.slice(0, 800)
    });
  }

  return response;
};

When you trigger a capture, the Side Panel merges the visual screenshot, the page-sniffer.js logs (with error payloads), and the background webRequest buffer, deduplicates them, and feeds the unified context to the Vision model.

2. Talking to Local Ollama from MV3 Without CORS 403 Pain

Supporting 100% local Vision AI (llama3.2-vision, llava, moondream via Ollama on localhost:11434) was essential for teams working on NDA/staging apps where screenshots cannot leave the machine.

The catch? By default, fetch('http://localhost:11434/api/chat') from a Chrome extension sends:

Origin: chrome-extension://<extension-id>

And Ollama rejects extension origins with 403 Forbidden unless the user manually sets OLLAMA_ORIGINS="*" in their OS environment variables and restarts the daemon β€” which kills onboarding for most non-CLI testers.

Instead of asking users to edit launchctl/systemd configs, the background Service Worker registers dynamic chrome.declarativeNetRequest header-modification rules for the configured Ollama port:

// Excerpt from background/service-worker.js
await chrome.declarativeNetRequest.updateDynamicRules({
  removeRuleIds: [11434, 11435],
  addRules: [
    {
      id: 11434,
      priority: 1,
      action: {
        type: 'modifyHeaders',
        requestHeaders: [
          { header: 'Origin', operation: 'set', value: originValue }
        ]
      },
      condition: {
        urlFilter: filter, // e.g. ':11434'
        resourceTypes: ['xmlhttprequest']
      }
    }
  ]
});

Whenever the user updates their Ollama host in Settings, chrome.storage.onChanged updates the dynamic rule automatically. Local Vision AI works out of the box with zero terminal setup.

3. Keeping MV3 Side Panel Shortcuts Alive (chrome.commands)

One subtle Manifest V3 pitfall: chrome.sidePanel.open({ windowId }) requires an active user gesture token.

If you use async/await (for example, fetching chrome.tabs.query or reading storage) before calling chrome.sidePanel.open() inside chrome.commands.onCommand, Chrome drops the gesture token and throws:

Error: sidePanel.open() may only be called in response to a user gesture.

The fix is calling chrome.sidePanel.open({ windowId: tab.windowId }) synchronously as the very first line in the command listener, and running screenshot capture + log collection concurrently afterward.

4. Zero-Backend Multi-Engine Vision Router + Jira Direct

The extension delegates analysis through a thin provider router (services/ai.js), keeping all API keys locally in chrome.storage.local:

  • Anthropic Claude (anthropic-dangerous-direct-browser-access: true header + automatic HTTP 404 model fallback cascade + JSON recovery parser)
  • Google Gemini (gemini-3.8-flash)
  • OpenAI (gpt-4o-mini / gpt-4o)
  • Local Ollama (llama3.2-vision, llava, moondream)

Before sending a screenshot to any cloud provider, you can draw bounding boxes, arrows, or apply one-click pixelation blur (GDPR blur) right inside the Side Panel canvas to hide PII, customer emails, or API tokens.

The generated report outputs clean Jira Wiki Markup (h3., {code:json}, environment table) and posts directly to either:

  • Jira Cloud (*.atlassian.net with Email + API Token)
  • Jira Server / Data Center (self-hosted instances with Personal Access Token)

And because QA teams often work internationally, the UI, Jira section headers, and Chrome Web Store metadata are localized natively across 6 languages (en, de, pl, es, fr, ja).

Watch the GDPR Visual Blur & Annotator Demo & Try the Bug Sandbox

Want to see what kind of Jira ticket it generates without breaking your own staging environment? I built an interactive checkout crash sandbox on the site where you can trigger simulated HTTP 404/500 & NaN UI bugs in one click:

Question for Dev/QA Teams

Right now BugAgent AI targets Jira Cloud & Data Center, and I'm deciding what to prioritize next for v2.1.0:

  1. GitHub Issues direct export
  2. Linear integration
  3. Standalone Markdown / PDF report export (for agencies or clients without Jira access)

Which one would save your team the most time? Drop a comment below β€” I'd love your feedback!

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.