fix(dashboard): trigger plugin discovery in cmd_dashboard before start_server

The argparse-setup plugin discovery path is gated on
_plugin_cli_discovery_needed(), which returns False for any built-in
subcommand including 'dashboard' (to save ~500ms startup on hot paths
like --tui). As a result, plugins/dashboard_auth/nous never registered
its DashboardAuthProvider, and start_server's fail-closed gate check
tripped for any non-loopback bind even when the Nous provider was
bundled and ready to run.

Call discover_plugins() explicitly in cmd_dashboard so the provider
registry is populated before the gate check runs. discover_plugins() is
idempotent (per its docstring), so this is safe to call regardless of
whether the argparse path already ran it.
This commit is contained in:
Ben 2026-05-23 15:00:12 +10:00 committed by Teknium
parent b3dc539304
commit 42729775db

View file

@ -10735,6 +10735,22 @@ def cmd_dashboard(args):
sys.exit(1)
print(f"→ Skipping web UI build (--skip-build); using dist at {_dist_root}")
# Discover and load plugins so any DashboardAuthProvider plugin
# (e.g. plugins/dashboard_auth/nous) registers BEFORE start_server's
# fail-closed gate check runs. The top-level argparse setup skips
# plugin discovery for built-in subcommands like ``dashboard`` to
# save ~500ms startup; we have to trigger it explicitly here because
# the dashboard's server-side runtime depends on plugin-registered
# providers (image_gen, web, dashboard_auth, …).
try:
from hermes_cli.plugins import discover_plugins
discover_plugins()
except Exception as exc:
# Discovery failures must not block dashboard startup outright —
# log and proceed; the gate's fail-closed branch will surface
# the missing-provider state if it matters.
print(f"⚠ Plugin discovery failed: {exc}", file=sys.stderr)
from hermes_cli.web_server import start_server
embedded_chat = args.tui or os.environ.get("HERMES_DASHBOARD_TUI") == "1"