salvage(#55954): Hermes Console REPL + perf follow-ups (NS-574) - #57781
Merged
kshitijk4poor merged 5 commits intoJul 3, 2026
Conversation
Addresses two non-blocking review notes on the Hermes Console PR: - console_engine: the four _*_summaries helpers import a subcommand module and build a throwaway argparse tree purely to extract help summaries. The dashboard opens a fresh HermesConsoleEngine per /api/console connection, so every reconnect re-imported + re-parsed the whole CLI surface. The surface is process-static, so memoize with functools.lru_cache — callers only read the returned map. - web_server: console commands run in a worker thread via asyncio.to_thread. On a 60s timeout asyncio.wait_for cancels the awaitable, but Python threads aren't preemptible, so a stuck worker keeps running and would leak into the shared default thread pool. Route console execution through a small dedicated bounded ThreadPoolExecutor (max_workers=4) so a leaked worker is capped and concurrent console execution is bounded regardless of reconnects. Follow-up on top of @shannonsands' NS-574 Hermes Console.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Salvages @shannonsands' Hermes Console REPL (NS-574, #55954) onto current
mainand lands two perf fixes for the non-blocking review notes.The console gives hosted/managed users a curated, safe subset of
hermesoperations (MCP mgmt, config, etc.) via CLI + dashboard websocket + xterm UI — without raw shell access.Changes
tools.ansi_strip.strip_ansi).console_engine: memoize the 4 process-static_*_summariesbuilders withfunctools.lru_cache. The dashboard opens a fresh engine per/api/consoleconnection, so every reconnect was re-importing + re-parsing the whole CLI surface. Callers only read the returned map.web_server: run console commands on a dedicated boundedThreadPoolExecutor(max_workers=4)instead ofasyncio.to_thread. On the 60s command timeout,wait_forcancels the awaitable but the non-preemptible worker thread keeps running — the shared default pool would accumulate leaked threads. Bounding caps that. Executor is torn down at exit viaatexit(cancel_futures=True, no wait).Validation
test_console_engine.py+test_web_server_console_ws.py+test_dashboard_auth_ws_auth.pymax_workers=4, singleton,atexitshutdown registeredReview notes addressed (from the original #55954 review)
strip_ansi— done by @shannonsands.Salvage of #55954. Contributor commits cherry-picked with authorship preserved; perf follow-up by @kshitijk4poor.