rohitsar567 Claude Opus 4.7 (1M context) commited on
Commit
755ba01
·
1 Parent(s): 132a829

fix(admin): KI-184 — Refresh forces fresh probe + tier banner

Browse files

User report: "refresh doesn't work."

Root cause: KI-164's admin-strip removed the "Force fresh probe (slow)"
button. The remaining Refresh button only called fetchLlmHealth() which
re-fetches the cached probe state from /api/admin/llm-health. The
backend's probe loop runs every 5 min independently. So clicking Refresh
on a 2-minute-old snapshot just re-showed the same 2-minute-old data.

Fix: Refresh now POSTs /api/admin/probe first (forces fresh probe), then
re-fetches state, then re-renders. Same as the legacy "Force fresh
probe" button used to do. Button now reads "Probing…" during the call
so the user knows it's actually doing work.

Plus: added a tier banner ABOVE the What's Live table that explains
the 3-tier chain: Gemini Tier 0 (primary) → NIM Tier 1 (what's shown
below) → OpenRouter Tier 2 → NIM Nemotron-49B last resort. This
prevents confusion when the user sees nemotron showing as "primary"
in the NIM table even though Gemini is actually serving traffic
(per KI-179 + ADR-040).

Verification: node --check on inline script — clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

frontend/public/admin/llm-control.html CHANGED
@@ -675,6 +675,19 @@
675
  <button id="btn-refresh-llm-health">Refresh</button>
676
  </div>
677
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
678
  <div id="llm-health-chains" class="llm-simple-tables"></div>
679
  </div>
680
  </section>
@@ -2404,14 +2417,21 @@
2404
  // handlers are gone.
2405
 
2406
  // KI-086 — manual refresh for the LLM Health & Credits card.
 
 
 
 
 
2407
  var llmHealthBtn = $('btn-refresh-llm-health');
2408
  if (llmHealthBtn) {
2409
  llmHealthBtn.onclick = function () {
2410
  var btn = this;
2411
  btn.disabled = true;
2412
- btn.textContent = 'Refreshing…';
2413
- fetchLlmHealth()
2414
- .then(function () { renderLlmHealth(); toast('LLM health refreshed', 'success'); })
 
 
2415
  .catch(handleFetchErr)
2416
  .then(function () { btn.disabled = false; btn.textContent = 'Refresh'; });
2417
  };
 
675
  <button id="btn-refresh-llm-health">Refresh</button>
676
  </div>
677
  </div>
678
+ <!-- KI-184 (2026-05-15) — Tier banner so the table below isn't
679
+ confused with the actual primary serving traffic. Real-world
680
+ call order: Tier 0 Google Gemini → Tier 1 NIM (shown below) →
681
+ Tier 2 OpenRouter free pool → NIM nemotron-49b last resort. -->
682
+ <div style="margin-bottom: 14px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: #0b0d12; font-size: 12px; line-height: 1.5;">
683
+ <strong style="color: var(--text);">3-tier brain chain (KI-179 + ADR-040):</strong>
684
+ <span class="muted">
685
+ Tier 0 — <strong>Google Gemini 2.5 Flash / Flash Lite</strong> (PRIMARY, free 1500/day)
686
+ &nbsp;·&nbsp; Tier 1 — NIM (shown below)
687
+ &nbsp;·&nbsp; Tier 2 — OpenRouter free pool
688
+ &nbsp;·&nbsp; Last resort — NIM Nemotron-49B
689
+ </span>
690
+ </div>
691
  <div id="llm-health-chains" class="llm-simple-tables"></div>
692
  </div>
693
  </section>
 
2417
  // handlers are gone.
2418
 
2419
  // KI-086 — manual refresh for the LLM Health & Credits card.
2420
+ // KI-184 (2026-05-15) — Refresh now forces a fresh probe BEFORE
2421
+ // fetching state. Previously this only re-fetched the cached probe
2422
+ // state from /api/admin/llm-health, which is refreshed by a 5-min
2423
+ // background loop. User clicked Refresh expecting current state but
2424
+ // got cached state. Now: POST /api/admin/probe → then re-fetch.
2425
  var llmHealthBtn = $('btn-refresh-llm-health');
2426
  if (llmHealthBtn) {
2427
  llmHealthBtn.onclick = function () {
2428
  var btn = this;
2429
  btn.disabled = true;
2430
+ btn.textContent = 'Probing…';
2431
+ apiPost('/api/admin/probe', null)
2432
+ .catch(function () { /* tolerate probe failure; still re-fetch cached state */ })
2433
+ .then(function () { return fetchLlmHealth(); })
2434
+ .then(function () { renderLlmHealth(); toast('LLM health refreshed (fresh probe)', 'success'); })
2435
  .catch(handleFetchErr)
2436
  .then(function () { btn.disabled = false; btn.textContent = 'Refresh'; });
2437
  };