docs(ocr): OLLAMA_ORIGINS is not needed — drop the "one gotcha" and reword the 403 hint #31
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
daniel/obsidian-remarkable-round-trip!31
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/ollama-origins-not-needed"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #28 (item 2,
OLLAMA_ORIGINS). Docs plus one error message. No new behaviour.Why (evidence, established empirically on #28)
The docs and the 403 hint tell every Ollama user to set
OLLAMA_ORIGINS=app://obsidian.md. That is not needed for any of the plugin's OCR calls, for two independent reasons:Originheader. All OCR traffic (checkConnection,transcribeviaobsidianHttp→requestUrl,src/main.ts:2388) and the v1 pull (nodeNdjson) sends none.obsidian.asarmain.jsimplementsrequestUrlas an IPC"request-url"handler that callselectron.net.request({url, method, redirect:"follow"})in the main process, setting onlyContent-Typeand the caller's headers.net.requestagainst a local header-echo server: GET and POST both arrive withorigin=undefined(sec-fetch-mode: no-cors,sec-fetch-site: none).app://*by default anyway. It has done so since v0.1.42 (June 2024), in commit1a29e9a8"API app/browser access (#4879)".envconfig.AllowedOrigins()appendsapp://*,file://*,tauri://*, … to whateverOLLAMA_ORIGINSholds. It is absent in v0.1.41 and present in v0.1.42.OLLAMA_ORIGINS:GET /api/versionGET /v1/modelsPOST /v1/chat/completionsapp://obsidian.mdhttps://evil.example(positive control)So a 403 from a local Ollama with no API key now realistically means one of two things: an Ollama older than 0.1.42, or a proxy or other server in front of it. It does not mean "set OLLAMA_ORIGINS".
What to change
docs/ocr-endpoint-setup.mdOLLAMA_ORIGINS— if Test connection then reports …" with one sentence: no origin or CORS setting is needed. Keep the sentence about the manual steps being the fallback.Originheader, and that Ollama 0.1.42+ accepts Obsidian'sapp://origin by default.OLLAMA_ORIGINSinstructions (macOSlaunchctl setenv, Linuxsystemctl edit, Windows env vars) under a clearly secondary note: "Only if you run an Ollama older than 0.1.42 and cannot update it". Updating Ollama is the first advice.OLLAMA_HOSTparagraph as is.403 / forbiddenrow: say "Ollama older than 0.1.42 → update it (or setOLLAMA_ORIGINSas in step 2's note). With an API key set → the key was refused. Otherwise a proxy or the server's own access rules refused the request."src/transport/ocr.tsmapStatus()(line ~196–203). Reword the 403-without-API-key message and its comment above it. It should say:OLLAMA_ORIGINS=app://obsidian.md(or*) and restart it;docs/ocr-endpoint-setup.md → Troubleshooting.Keep the
${raw}suffix and the status code, and keep the branch order (403 without a key before 401/403 with a key). The message must still containOLLAMA_ORIGINS, because the existing tests match on it.src/ollamasetup.ts, the failed-test notify insetUpLocalOllama(… See the setup guide: docs/ocr-endpoint-setup.md → step 2.): point it at→ Troubleshootinginstead, since step 2 is no longer where failures are explained.src/main.tsdesktopNdjson()doc comment (line ~2405–2411): drop "so the pull works before OLLAMA_ORIGINS is set". Say instead that noOriginheader goes out this way, as withrequestUrl.CHANGELOG-INK.md→ Unreleased: one bullet, e.g. "NoOLLAMA_ORIGINSneeded: the setup guide no longer asks you to set it; Ollama 0.1.42+ accepts the plugin's requests as they are."Constraints and decisions
OLLAMA_ORIGINS. The issue offered option (a), copy a command, and option (b), runlaunchctl/setx/systemd. Both are moot, sochild_processstays out of the plugin.mapStatus(). It is still the right first hint for old Ollama installs.agent/lmstudio-detect-guide) and the installer download (sibling MR onagent/ollama-installer-download). Those also touchdocs/ocr-endpoint-setup.md's One-click setup section andsrc/ollamasetup.ts. Mergeorigin/mainbefore you finish and resolve any overlap.Validation contract
src/__tests__/ocr.test.ts, add/update Ollama/i(or similar wording you choose) to the assertions of"403 without an API key points at OLLAMA_ORIGINS, not the key"(line ~30) and the second 403 assertion (line ~79). Runnpm ci && npx vitest run src/__tests__/ocr.test.tson the unchanged code → it FAILS on the new assertion.npx vitest run src/__tests__/ocr.test.ts→ PASS. Thennpx vitest run→ whole suite PASS, andnpm run build→ exits 0, ending with check-bundle's "bundle clean" line.grep -n "OLLAMA_ORIGINS" docs/ocr-endpoint-setup.md→ hits only in step 2's old-version note and the troubleshooting row, and none in the One-click setup section.flake.nix, so use plainnpm/npx, notnix develop.)🤖 Generated with Claude Code
✅ Agent run completed
1m48s · 17 turns · $0.47 · pushed
agent/ollama-origins-not-needed· session saved — new comments resume this runclaude referenced this pull request2026-10-20 20:06:02 +02:00
claude referenced this pull request2026-10-20 20:06:02 +02:00
What changed
docs/ocr-endpoint-setup.md:OLLAMA_ORIGINSsteps sit in a quoted note: "Only if you run an Ollama older than 0.1.42 and cannot update it". Steps are still numbered 1–4.mapStatus()403-without-key message now says the local endpoint refused the request and to update Ollama (0.1.42+ accepts the requests as they are). It still givesOLLAMA_ORIGINS=app://obsidian.md (or *)for older versions and points at→ Troubleshooting. The${raw}suffix and the branch order are unchanged.ollamasetup.tsnow points at→ Troubleshooting. Also updated thedesktopNdjson()comment and added a CHANGELOG-INK bullet.Verify
/update Ollama/iassertions,ocr.test.tsfailed 2 tests on the unchanged code.npx vitest runpasses (762 tests).npm run buildexits 0 and ends with "bundle clean".OLLAMA_ORIGINSnow appears in the guide only in step 2's old-version note and the 403 row.Follow-ups
None. I merged
origin/mainand it was already up to date; the sibling MRs that touch One-click setup had not landed yet.claude referenced this pull request2026-10-20 20:14:22 +02:00
claude referenced this pull request2026-10-20 20:16:08 +02:00
claude referenced this pull request2026-10-20 20:16:08 +02:00
claude referenced this pull request2026-10-20 20:22:55 +02:00