Skip to content

armgit / ODS

Public Imported from GitHub
0

ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.

fix(dashboard): no dead sidebar links; Hermes opens its chat (#8179)

Mike Bradleyc0cfc8ea0808
diff --git a/ods/docs/HERMES-SSO.md b/ods/docs/HERMES-SSO.md
index b9a93ee20..a62a9448f 100644
--- a/ods/docs/HERMES-SSO.md
+++ b/ods/docs/HERMES-SSO.md
@@ -1,6 +1,6 @@
# Hermes access and optional owner-card SSO
-Current ODS installs use Hermes 0.21.5's required dashboard authentication. The dashboard's Hermes link opens `/auth/ods` through `hermes-proxy` on port 9120, validates the existing ODS session, and signs into Hermes with server-held managed credentials. Only allowlisted HttpOnly cookies are returned, without a Domain attribute, and the destination is always `/` on the same origin. Direct visits can use Hermes's native login for operator-configured credentials. See [the current auth contract](HERMES.md#security-posture).
+Current ODS installs use Hermes 0.21.5's required dashboard authentication. The dashboard's Hermes link opens `/auth/ods` through `hermes-proxy` on port 9120, validates the existing ODS session, and signs into Hermes with server-held managed credentials. Only allowlisted HttpOnly cookies are returned, without a Domain attribute, and the destination is always Hermes's chat, `/chat`, on the same origin. Direct visits can use Hermes's native login for operator-configured credentials. See [the current auth contract](HERMES.md#security-posture).
Operators who want the additional owner-card gate can set `HERMES_REQUIRE_OWNER_CARD=true` in the installed `.env` and recreate `hermes-proxy`. It defaults to `false` on Linux, Windows, and macOS. Keep direct access limited to a trusted network; enable the gate before publishing Hermes to untrusted users.
diff --git a/ods/extensions/services/dashboard-api/builtin_source_recipes.py b/ods/extensions/services/dashboard-api/builtin_source_recipes.py
index c205f3991..ed9dfb395 100644
--- a/ods/extensions/services/dashboard-api/builtin_source_recipes.py
+++ b/ods/extensions/services/dashboard-api/builtin_source_recipes.py
@@ -35,7 +35,7 @@ _CONTEXT_BUILDS = {
"ape": ("ape", None, "Dockerfile", "ffa14f37d9bca3fc9aa35582b5f3a4b9adaa1e75222a9c29dc9d55d9cfa49805"),
"brave-search": ("brave-search", "ods-brave-search:local", "Dockerfile", "f1be25450cae210788c29d02dc497ff64f3fe7f9184cc73332c08a734e709e95"),
"privacy-shield": ("privacy-shield", None, "Dockerfile", "deb8da4c40e7eac01c2576c33bd11f0df21c2332bf929bc6ba0272669ffa64b8"),
- "token-spy": ("token-spy", None, "Dockerfile", "83199d50b7f48b3c9d454b8f6508dc5a3cf874358a2035bc78b125006fa57b97"),
+ "token-spy": ("token-spy", None, "Dockerfile", "a437422b3bd3eeb0ce35631137dc78665769489cd7d7f6b6bb219586273f2f60"),
}
_MAX_CONTEXT_FILE_BYTES = 8 * 1024 * 1024
_MAX_CONTEXT_FILES = 512
diff --git a/ods/extensions/services/dashboard-api/config.py b/ods/extensions/services/dashboard-api/config.py
index 0f434335a..f31be6ef3 100644
--- a/ods/extensions/services/dashboard-api/config.py
+++ b/ods/extensions/services/dashboard-api/config.py
@@ -264,6 +264,8 @@ def _apply_host_native_llm_service_override(
service["host"] = parsed.hostname
service["port"] = port
+ # The in-stack container is off on this route; its sidebar link (OLLAMA_PORT, 11434) opened an error page.
+ service["external_link"] = False
logger.info("Host-native llama-server detected; routing LLM probes to %s:%d", parsed.hostname, port)
diff --git a/ods/extensions/services/dashboard-api/main.py b/ods/extensions/services/dashboard-api/main.py
index f76f9b86f..f6bc52aeb 100644
--- a/ods/extensions/services/dashboard-api/main.py
+++ b/ods/extensions/services/dashboard-api/main.py
@@ -1729,6 +1729,11 @@ async def _build_api_status() -> dict:
# --- Settings ---
+# Sidebar names where the manifest name describes plumbing rather than the
+# application the link opens. Health matching keeps the manifest name.
+_SIDEBAR_LABELS = {"hermes-proxy": "Hermes"}
+
+
@app.get("/api/external-links")
async def get_external_links(api_key: str = Depends(verify_api_key)):
"""Return sidebar-ready external links derived from service manifests."""
@@ -1738,7 +1743,7 @@ async def get_external_links(api_key: str = Depends(verify_api_key)):
if not ext_port or sid == "dashboard-api" or cfg.get("external_link") is False:
continue
links.append({
- "id": sid, "label": cfg.get("name", sid), "port": ext_port,
+ "id": sid, "label": _SIDEBAR_LABELS.get(sid, cfg.get("name", sid)), "port": ext_port,
"ui_path": cfg.get("ui_path", "/"),
"public_url": cfg.get("public_url", ""),
"icon": SIDEBAR_ICONS.get(sid, "ExternalLink"),
diff --git a/ods/extensions/services/dashboard-api/routers/auth.py b/ods/extensions/services/dashboard-api/routers/auth.py
index 2dbd2136d..af9f4ed0d 100644
--- a/ods/extensions/services/dashboard-api/routers/auth.py
+++ b/ods/extensions/services/dashboard-api/routers/auth.py
@@ -130,7 +130,8 @@ async def hermes_session(request: Request):
raise HTTPException(status_code=503, detail="Hermes sign-in is unavailable") from exc
if cookies is not None and not any(c.key == "hermes_session_at" and c.value for c in cookies):
raise HTTPException(status_code=503, detail="Hermes did not issue a login session")
- response = RedirectResponse("/", status_code=303)
+ # Land in Hermes's chat; its root opens an empty Sessions list.
+ response = RedirectResponse("/chat", status_code=303)
response.headers["Cache-Control"] = "no-store"
secure = request.url.scheme == "https" or request.headers.get("x-forwarded-proto") == "https"
allowed = {"hermes_session_at", "hermes_session_rt", "hermes_session_provider"}
diff --git a/ods/extensions/services/dashboard-api/tests/test_config.py b/ods/extensions/services/dashboard-api/tests/test_config.py
index 0cc59629f..11e85ac99 100644
--- a/ods/extensions/services/dashboard-api/tests/test_config.py
+++ b/ods/extensions/services/dashboard-api/tests/test_config.py
@@ -261,7 +261,7 @@ class TestHostNativeLlmResolution:
url_key: "http://192.168.50.1:8181/v1",
"OLLAMA_URL": "http://litellm:4000",
})
- assert services["llama-server"] == {"host": "192.168.50.1", "port": 8181}
+ assert services["llama-server"] == {"host": "192.168.50.1", "port": 8181, "external_link": False}
def test_host_side_url_and_gateway_are_never_probed(self):
services = {"llama-server": {"host": "llama-server", "port": 8080}}
@@ -274,7 +274,9 @@ class TestHostNativeLlmResolution:
"LEMONADE_BASE_URL": "http://localhost:13305",
"LLM_API_URL": "http://litellm:4000",
})
- assert services["llama-server"] == {"host": "host.docker.internal", "port": 18080}
+ assert services["llama-server"] == {
+ "host": "host.docker.internal", "port": 18080, "external_link": False,
+ }
def test_container_runtime_does_not_use_host_endpoint(self):
services = {"llama-server": {"host": "llama-server", "port": 8080}}
@@ -297,6 +299,8 @@ class TestHostNativeLlmResolution:
assert services["llama-server"]["host"] == "host.docker.internal"
assert services["llama-server"]["port"] == 9090
+ # The container is off on this route; a sidebar link to its port opened an error page.
+ assert services["llama-server"]["external_link"] is False
@pytest.mark.parametrize(
("backend", "location"),
diff --git a/ods/extensions/services/dashboard-api/tests/test_hermes_auth.py b/ods/extensions/services/dashboard-api/tests/test_hermes_auth.py
index d84c6e383..a9b0232f7 100644
--- a/ods/extensions/services/dashboard-api/tests/test_hermes_auth.py
+++ b/ods/extensions/services/dashboard-api/tests/test_hermes_auth.py
@@ -216,7 +216,7 @@ def test_launch_only_relays_host_only_secure_allowlisted_cookies(client, monkeyp
cookies['unrelated'] = 'do-not-relay'
monkeypatch.setattr(hermes_bridge, "login_dashboard", AsyncMock(return_value=list(cookies.values())))
response = client.get("/api/auth/hermes-session", headers={"x-forwarded-proto": "https"}, follow_redirects=False)
- assert response.status_code == 303 and response.headers['location'] == '/'
+ assert response.status_code == 303 and response.headers['location'] == '/chat'
header = response.headers['set-cookie']
assert 'hermes_session_at=fixture' in header and 'HttpOnly' in header and 'Secure' in header
assert 'Path=/' in header and 'Domain=' not in header and 'unrelated' not in header
diff --git a/ods/extensions/services/dashboard-api/tests/test_main.py b/ods/extensions/services/dashboard-api/tests/test_main.py
index 97b1101dc..f7ea4dda6 100644
--- a/ods/extensions/services/dashboard-api/tests/test_main.py
+++ b/ods/extensions/services/dashboard-api/tests/test_main.py
@@ -2,6 +2,7 @@
import json
import time
+from pathlib import Path
from unittest.mock import AsyncMock, MagicMock
import pytest
@@ -592,6 +593,44 @@ class TestExternalLinks:
assert "open-webui" in link_ids
assert "litellm" not in link_ids
+ def test_hermes_proxy_link_is_labelled_hermes(self, test_client, monkeypatch):
+ """The proxy's manifest name describes plumbing; the link opens Hermes."""
+ monkeypatch.setattr("main.SERVICES", {
+ "hermes-proxy": {
+ "name": "Hermes Auth Proxy",
+ "port": 9120,
+ "external_port": 9120,
+ "health": "/health",
+ "host": "hermes-proxy",
+ "ui_path": "/auth/ods",
+ },
+ })
+
+ resp = test_client.get("/api/external-links", headers=test_client.auth_headers)
+
+ assert resp.status_code == 200
+ [link] = resp.json()
+ assert link["label"] == "Hermes"
+ assert link["ui_path"] == "/auth/ods"
+ # Health still matches the proxy's own status row, never Hermes Agent's.
+ assert link["healthNeedles"] == ["hermes-proxy", "hermes auth proxy"]
+
+ def test_shipped_token_spy_manifest_has_no_sidebar_link(self, test_client, monkeypatch):
+ """Its page asks for Token Spy's own API key; the Usage page reads it server-side."""
+ import config
+ shipped, _, errors = config.load_extension_manifests(
+ Path(__file__).resolve().parents[2], "nvidia",
+ only_service_ids=frozenset({"token-spy"}),
+ )
+ assert errors == []
+ assert shipped["token-spy"]["external_link"] is False
+ monkeypatch.setattr("main.SERVICES", shipped)
+
+ resp = test_client.get("/api/external-links", headers=test_client.auth_headers)
+
+ assert resp.status_code == 200
+ assert resp.json() == []
+
# --- /api/storage ---
diff --git a/ods/extensions/services/token-spy/manifest.yaml b/ods/extensions/services/token-spy/manifest.yaml
index 24a38a996..b162d4f99 100644
--- a/ods/extensions/services/token-spy/manifest.yaml
+++ b/ods/extensions/services/token-spy/manifest.yaml
@@ -14,6 +14,9 @@ service:
external_port_default: 3005
health: /health
ui_path: /dashboard
+ # The page asks for Token Spy's own API key in the browser; the dashboard's
+ # Usage page reads Token Spy server-side, so it gets no sidebar link.
+ external_link: false
type: docker
gpu_backends: [all]
compose_file: compose.yaml