Hi Varun,
I spent some time tracing the root causes of the three Dashboard issues I reported earlier. All three appear to be frontend / API data-mapping issues rather than backend engine problems. Below are my findings, including the exact code changes that resolved them in my environment.
IMPORTANT NOTE: I've only tested the Dashboard UI behavior. I have not tested whether these fixes affect deeper backend functionality, nor have I checked for other code paths that might have similar issues. Please review carefully.
MY ENVIRONMENT:
- SLM v3.6.11, npm install on Debian 13 LXC
- Mode B, remote llama.cpp endpoints (no API key required)
- Dashboard accessed from Windows on the same LAN (192.168.50.x)
- SLM_DAEMON_HOST=0.0.0.0, SLM_MCP_ALLOWED_HOSTS=*
==============================
ISSUE 1 (CRITICAL): BRAIN PAGE FAILS TO LOAD FROM REMOTE BROWSER
ROOT CAUSE:
The /internal/token endpoint is hardcoded to only accept requests from 127.0.0.1.
FILE: src/superlocalmemory/server/routes/token.py
Line 61:
if not is_loopback(client_host):
return JSONResponse({"error": "loopback only"}, status_code=403)
Line 66:
if not _origin_is_loopback(origin):
return JSONResponse({"error": "origin not allowed"}, status_code=403)
VERIFIED FIX (Temporary, for reference only):
Modifying these two checks to also accept my LAN subnet (192.168.50.*) immediately resolved the issue.
Line 61 after modification:
if not is_loopback(client_host) and not client_host.startswith("192.168.50."):
return JSONResponse({"error": "loopback only"}, status_code=403)
Line 66 after modification:
if not _origin_is_loopback(origin) and not origin.startswith("http://192.168.50."):
return JSONResponse({"error": "origin not allowed"}, status_code=403)
After this change, the Brain page loaded correctly from a remote browser, confirming this is the exact root cause.
SUGGESTED OFFICIAL FIX:
Allow /internal/token to also respect SLM_MCP_ALLOWED_HOSTS, so trusted LAN IPs can fetch the install token. Alternatively, a global SLM_REMOTE=1 switch could open all loopback-restricted endpoints at once.
==============================
ISSUE 2 (MEDIUM): LLM SETTINGS PANEL SHOWS WRONG ENDPOINT / TEST CONNECTION FAILS
ROOT CAUSE:
A field name mismatch between the config file and the Dashboard frontend.
In config.json, the custom endpoint is stored under "base_url", but the Dashboard frontend reads it from an "endpoint" field. Additionally, the /api/v3/config API returns an empty llm object ({}), so the backend is not exposing the custom endpoint at all. This causes the Dashboard to always fall back to https://api.openai.com/v1, and the connection test fails with 401 when no API key is provided.
HOW I VERIFIED:
- Confirmed config.json correctly stores the custom endpoint under "base_url".
- Called /api/v3/config — the returned llm object is empty ({}).
- The Dashboard displays the default OpenAI URL instead of the user's configured endpoint.
SUGGESTED OFFICIAL FIX:
Either change the Dashboard frontend to read "base_url" instead of "endpoint", or change the backend API to expose the custom endpoint under the "endpoint" field.
==============================
ISSUE 3 (MEDIUM): DASHBOARD RATE LIMITING (429 TOO MANY REQUESTS)
ROOT CAUSE:
SLM's built-in HTTP rate limiter triggers after repeated failed authentication attempts during debugging. The rate limit is not currently configurable via environment variables.
HOW I VERIFIED:
After multiple failed attempts to load the Brain page (before fixing Issue 1), the browser received "429 Too Many Requests" with "retry-after: 60".
SUGGESTED OFFICIAL FIX:
Expose the rate limit window and thresholds as environment variables (e.g., SLM_RATE_LIMIT_WINDOW, SLM_RATE_LIMIT_READ, SLM_RATE_LIMIT_WRITE) so users can adjust them for their environments.
==============================
SUMMARY
Issue 1 | Backend (token.py) | Hardcoded loopback check on /internal/token
Issue 2 | Frontend + Backend API | Field name mismatch (base_url vs endpoint)
Issue 3 | Backend (rate limiter) | No environment variable to adjust thresholds
All three are UI/API-level issues. I have not tested whether deeper backend functionality is affected. Please review the suggested fixes carefully. The code changes I provided for Issue 1 resolved the issue in my environment, but I am not a professional developer and cannot guarantee they are the best long-term solution.
Thanks again for your continued work on SLM.
Best regards,
sinking
Hi Varun,
I spent some time tracing the root causes of the three Dashboard issues I reported earlier. All three appear to be frontend / API data-mapping issues rather than backend engine problems. Below are my findings, including the exact code changes that resolved them in my environment.
IMPORTANT NOTE: I've only tested the Dashboard UI behavior. I have not tested whether these fixes affect deeper backend functionality, nor have I checked for other code paths that might have similar issues. Please review carefully.
MY ENVIRONMENT:
==============================
ISSUE 1 (CRITICAL): BRAIN PAGE FAILS TO LOAD FROM REMOTE BROWSER
ROOT CAUSE:
The /internal/token endpoint is hardcoded to only accept requests from 127.0.0.1.
FILE: src/superlocalmemory/server/routes/token.py
Line 61:
if not is_loopback(client_host):
return JSONResponse({"error": "loopback only"}, status_code=403)
Line 66:
if not _origin_is_loopback(origin):
return JSONResponse({"error": "origin not allowed"}, status_code=403)
VERIFIED FIX (Temporary, for reference only):
Modifying these two checks to also accept my LAN subnet (192.168.50.*) immediately resolved the issue.
Line 61 after modification:
if not is_loopback(client_host) and not client_host.startswith("192.168.50."):
return JSONResponse({"error": "loopback only"}, status_code=403)
Line 66 after modification:
if not _origin_is_loopback(origin) and not origin.startswith("http://192.168.50."):
return JSONResponse({"error": "origin not allowed"}, status_code=403)
After this change, the Brain page loaded correctly from a remote browser, confirming this is the exact root cause.
SUGGESTED OFFICIAL FIX:
Allow /internal/token to also respect SLM_MCP_ALLOWED_HOSTS, so trusted LAN IPs can fetch the install token. Alternatively, a global SLM_REMOTE=1 switch could open all loopback-restricted endpoints at once.
==============================
ISSUE 2 (MEDIUM): LLM SETTINGS PANEL SHOWS WRONG ENDPOINT / TEST CONNECTION FAILS
ROOT CAUSE:
A field name mismatch between the config file and the Dashboard frontend.
In config.json, the custom endpoint is stored under "base_url", but the Dashboard frontend reads it from an "endpoint" field. Additionally, the /api/v3/config API returns an empty llm object ({}), so the backend is not exposing the custom endpoint at all. This causes the Dashboard to always fall back to https://api.openai.com/v1, and the connection test fails with 401 when no API key is provided.
HOW I VERIFIED:
SUGGESTED OFFICIAL FIX:
Either change the Dashboard frontend to read "base_url" instead of "endpoint", or change the backend API to expose the custom endpoint under the "endpoint" field.
==============================
ISSUE 3 (MEDIUM): DASHBOARD RATE LIMITING (429 TOO MANY REQUESTS)
ROOT CAUSE:
SLM's built-in HTTP rate limiter triggers after repeated failed authentication attempts during debugging. The rate limit is not currently configurable via environment variables.
HOW I VERIFIED:
After multiple failed attempts to load the Brain page (before fixing Issue 1), the browser received "429 Too Many Requests" with "retry-after: 60".
SUGGESTED OFFICIAL FIX:
Expose the rate limit window and thresholds as environment variables (e.g., SLM_RATE_LIMIT_WINDOW, SLM_RATE_LIMIT_READ, SLM_RATE_LIMIT_WRITE) so users can adjust them for their environments.
==============================
SUMMARY
Issue 1 | Backend (token.py) | Hardcoded loopback check on /internal/token
Issue 2 | Frontend + Backend API | Field name mismatch (base_url vs endpoint)
Issue 3 | Backend (rate limiter) | No environment variable to adjust thresholds
All three are UI/API-level issues. I have not tested whether deeper backend functionality is affected. Please review the suggested fixes carefully. The code changes I provided for Issue 1 resolved the issue in my environment, but I am not a professional developer and cannot guarantee they are the best long-term solution.
Thanks again for your continued work on SLM.
Best regards,
sinking