fix(dashboard): add lightweight mode - #58721
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused configuration and route-filtering work. The underlying constrained-host problem remains on current main, but this implementation does not yet meet the memory-reduction claim.
Problems
- The
--lightpath still reaches the full backend:cmd_dashboardimports FastAPI/uvicorn athermes_cli/main.py:12194-12196and then importshermes_cli.web_serverat:12290. That module constructsFastAPI(...)athermes_cli/web_server.py:264and mounts plugin API routes at:17105. This matches the #58694 follow-up that RSS rises after the first request. - Plugin suppression is incomplete:
discover_plugins()remains unconditional athermes_cli/main.py:12261-12263, andweb/src/App.tsx:352callsusePlugins()before the new filtering; the hook fetches manifests atweb/src/plugins/usePlugins.ts:26-35. --lightis placed in the shared dashboard/serve runtime parser. Because the new mode resolution does not excludeheadless_backend, it also changesserve, which is the desktop/remote backend path (hermes_cli/subcommands/dashboard.py:130-156).
Suggested changes
- Branch before importing FastAPI or
hermes_cli.web_server, or re-scope this as UI filtering rather than a memory fix. - Keep
servebehavior unchanged and add a regression test for it.
Automated hermes-sweeper review.
| @@ -11906,6 +11906,24 @@ def cmd_dashboard(args): | |||
| remaining = _find_stale_dashboard_pids() | |||
There was a problem hiding this comment.
serve uses this same handler with headless_backend=True, and --light is added to its shared parser. This mode calculation needs to be bypassed for serve (or the flag must be dashboard-only), otherwise a persisted dashboard.mode: lightweight changes the Desktop/remote backend path.
| }; | ||
| setShowTokenAnalytics(dash.show_token_analytics === true); | ||
| setDashboardMode(normalizeDashboardMode(dash.mode)); |
There was a problem hiding this comment.
This only discards manifests after usePlugins() has already run. That hook still fetches /api/dashboard/plugins; more importantly, the backend has already imported and mounted plugin routes before this SPA code executes. Gate plugin discovery/mounting before importing hermes_cli.web_server if startup-memory reduction is required.
c52fed6 to
0902bf3
Compare
0902bf3 to
9a6773f
Compare
|
Addressed in I implemented an early lightweight-dashboard path using a stdlib HTTP server, with profile-scoped sessions, transcripts, logs, and configuration. It retains the read-only everyday views for status, sessions, files, logs, and safe configuration without initializing the full FastAPI/Uvicorn, plugin, and MCP stack. The three-run median results are:
I added the reproducible benchmark separately in The focused test suite passes with 469 tests, and Ruff passes for all changed Python files. |
What does this PR do?
Adds a lightweight dashboard mode for constrained self-hosted servers that only need the basic session/status surface.
The mode can be enabled per launch with
hermes dashboard --lightor persistently withdashboard.mode: lightweight. In lightweight mode, the dashboard:This intentionally avoids changing the shared MCP subprocess-pool behavior because that overlaps with #56832.
Related Issue
Fixes #58694
Type of Change
Changes Made
dashboard.modeconfig withfull/lightweightschema options.hermes dashboard --lightplus hidden--legacyalias.How to Test
hermes dashboard --light --port 9119./api/configreportsdashboard.mode: lightweightfor that process and/api/dashboard/pluginsreturns an empty list.Validation run locally:
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
N/A
Screenshots / Logs
Full
npm --workspace web run lintwas not used as a merge gate because this checkout currently reports pre-existing React compiler lint errors in unrelated files. The new dashboard mode helper files pass targeted ESLint, and the web package typecheck passes.