From 168f7df62c773e026741533ceb7206b9d56c8705 Mon Sep 17 00:00:00 2001 From: "Junaid Y. Sheikh" Date: Thu, 16 Jul 2026 04:40:46 +0500 Subject: [PATCH] fix(ui): route OBSIDIVM benchmarks through any backend (#64) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(ui): route OBSIDIVM benchmarks through any backend, not OpenRouter-only The OBSIDIVM benchmark/self-improvement UI ran its own client-side, OpenRouter-only LLM path: getApiKey() read only the OpenRouter key, every call hardcoded openrouter.ai, and the gate hard-blocked with "Configure OpenRouter API key first" — so a configured Venice key was ignored and a connected local agent was never used. Add a client-side backend resolver (OpenRouter key -> Venice key -> connected agent -> server LLM) and route all benchmark executors, judges, and gates through it: - resolveLLMBackend() + LLM_BACKEND_HINT; safeLLMCall()/_safeLLMCallOnce() become backend-aware (Venice uses api.venice.ai with a Venice-valid model; OpenRouter unchanged). _backendCall() routes keyless backends through the existing server endpoints: /api/agents/local/dispatch (drives the connected Claude Code/Codex/Hermes agent) and /api/llm/chat (server LLM). - runLiveBenchmark, ctfCallLLM, the self-improvement analyzer, and the config optimizer now call safeLLMCall instead of a hardcoded openrouter.ai fetch. - Live-Test / improvement-loop gates and runLLMJudge accept any backend. Client-side only; no server changes (endpoints already existed). The recon-only SPECTRA helper is intentionally left OpenRouter-only (out of scope). Co-Authored-By: Claude Opus 4.8 * fix(ui): keyless routing must use the API base URL (cross-origin) + model consistency Addresses review feedback on the OBSIDIVM backend-routing PR. 1. Relative keyless URLs broke the primary cross-origin deployment. _backendCall fetched '/api/agents/local/dispatch' and '/api/llm/chat' as RELATIVE URLs, but when the static War Room (GitHub Pages docs/) talks to a separate backend the app sets T3MP3ST_API.baseUrl = http://:3333. There the relative fetches hit the Pages origin → 404/CORS, so the headline local-agent / server-LLM routing silently failed (worked only same-origin). Fix: prefix `${T3MP3ST_API.baseUrl}` on both; empty base stays relative for same-origin. Verified: with baseUrl set, both now resolve to http://:3333/api/... 2. Model default consistency. Four benchmark fallbacks read 'anthropic/claude-opus-4.8', out of step with the state default, the