Skip to content

Docs + E2E: document OLLAMA_ORIGINS for localhost extension testing (planner-verify, dev harness) #179

Description

@Ayush7614

Problem

When running WebBrain as a browser extension against Ollama on localhost, LLM calls fail with 403 unless Ollama is started with extension origins allowed:

OLLAMA_ORIGINS="*" ollama serve
# or tighter:
OLLAMA_ORIGINS="chrome-extension://*,moz-extension://*" ollama serve

This is not a WebBrain planner bug — the browser sends Origin: chrome-extension://<id> (or moz-extension://…), which recent Ollama versions reject by default. Related: #33.

What breaks locally without this

  • Manual extension testing with Ollama (Act mode, planner gate, etc.)
  • New E2E verifier for planner v1 (test/planner-verify.mjs, npm run test:planner) — planner gate never emits plan_review because the planning LLM call 403s first
  • npm run test:anonymous and node scripts/dev.mjs when Ollama is the configured provider

curl / terminal probes to http://localhost:11434 still work — only extension-origin requests are blocked.

Docs gap

  1. README only says ollama serve + set base URL — no OLLAMA_ORIGINS mention (README.md ~line 69).
  2. Website FAQ says localhost usually doesn't need CORS — true for normal web pages, misleading for extensions (extension origin ≠ http://localhost).
  3. test/README.md documents test:anonymous but not test:planner or the Ollama prerequisite for any extension E2E run.
  4. Code already surfaces a helpful 403 hint in src/chrome/src/providers/openai.js — but users hit it before reading docs.

Context

Discovered while validating planner v1 for #165 (PR #178). Unit tests pass (npm test — planner parse/format). Full headed E2E blocked until Ollama allows extension origins.

Proposed fixes

  • README: add OLLAMA_ORIGINS to the Ollama quick-start block (Chrome + Firefox READMEs too)
  • test/README.md: document npm run test:planner, headed Chromium requirement, and OLLAMA_ORIGINS prerequisite
  • Website FAQ: clarify that browser extensions need OLLAMA_ORIGINS even when Ollama runs on the same machine as the browser
  • Optional: scripts/dev.mjs / test runners print a one-line warning if a probe with Origin: chrome-extension://test gets 403 from configured Ollama URL
  • Optional: link Ollama connection problem on firefox #33 ↔ this issue in a short maintainer note (403 detection + model dropdown tracked there)

Workaround (today)

Quit Ollama app if it holds port 11434, then:

OLLAMA_ORIGINS="*" ollama serve
npm run test:planner   # or node scripts/dev.mjs for manual testing

Environment

  • macOS, Ollama desktop app default install
  • Chrome MV3 extension (unpacked src/chrome/)
  • Ollama OpenAI-compatible endpoint http://localhost:11434/v1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions