feat(tui): port classic CLI /reload (.env hot-reload) to TUI#17129
Closed
OutThisLife wants to merge 3 commits into
Closed
feat(tui): port classic CLI /reload (.env hot-reload) to TUI#17129OutThisLife wants to merge 3 commits into
OutThisLife wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds /reload support to the TUI so users can hot-reload ~/.hermes/.env (API keys/credentials) without restarting, matching classic CLI behavior.
Changes:
- Add
reload.envJSON-RPC method intui_gateway/server.pydelegating tohermes_cli.config.reload_env. - Add TUI
/reloadslash command wiring toreload.env, plus TS response typing. - Update command registry metadata and extend test coverage for the new RPC + slash routing.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ui-tui/src/gatewayTypes.ts | Adds ReloadEnvResponse type for the new RPC response shape. |
| ui-tui/src/app/slash/commands/ops.ts | Implements /reload to call reload.env and report updated var count. |
| ui-tui/src/tests/createSlashHandler.test.ts | Extends native-RPC slash routing matrix to include /reload. |
| tui_gateway/server.py | Adds @method("reload.env") handler that calls hermes_cli.config.reload_env(). |
| tests/test_tui_gateway_server.py | Adds tests verifying reload.env calls into hermes_cli.config.reload_env and surfaces errors. |
| hermes_cli/commands.py | Makes /reload no longer cli_only, affecting gateway-visible command surfaces. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0e52341 to
b0b9e3a
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b0b9e3a to
d1ffe83
Compare
d1ffe83 to
946a6ee
Compare
Classic CLI exposes ``/reload`` (re-reads ~/.hermes/.env into
``os.environ`` via ``hermes_cli.config.reload_env``) so newly added API
keys take effect without restarting the session. The TUI was missing
the parity command, so users had to Ctrl+C out and ``hermes --tui``
again whenever they added or rotated a credential.
Three small wires:
* New ``reload.env`` JSON-RPC method in ``tui_gateway/server.py`` that
delegates to ``hermes_cli.config.reload_env`` and returns the count
of vars updated.
* New ``/reload`` slash command in ``ui-tui/src/app/slash/commands/ops.ts``
matching the existing ``/reload-mcp`` pattern (native RPC, no slash
worker).
* Drop ``cli_only=True`` from the ``reload`` ``CommandDef`` in
``hermes_cli/commands.py`` so help/menus surface it in the TUI too.
``reload_env`` itself is environment-agnostic.
Same caveat as classic CLI: the *currently constructed* agent's
credential pool / provider routing does not auto-rebuild. Users who
want a brand-new credential resolution should follow with ``/new``.
Tests:
* New ``test_reload_env_rpc_calls_hermes_cli_reload_env`` confirms
RPC delegates and reports the count.
* New ``test_reload_env_rpc_surfaces_errors`` confirms exceptions are
rendered as JSON-RPC errors.
* ``createSlashHandler.test.ts`` slash-parity matrix extended with
``['/reload', 'reload.env', {}]`` so we can't regress the routing.
Validation:
scripts/run_tests.sh tests/test_tui_gateway_server.py — 92/92.
scripts/run_tests.sh tests/hermes_cli/test_commands.py — 128/128.
cd ui-tui && npm run type-check — clean; npm test --run — 390/390.
5d59bc0 to
059652d
Compare
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
Classic CLI exposes
/reload(re-reads~/.hermes/.envintoos.environviahermes_cli.config.reload_env) so newly added API keys take effect without restarting the session. The TUI was missing the parity command, so users had to Ctrl+C out and re-runhermes --tuiwhenever they added or rotated a credential.This brings the TUI to parity with the classic CLI surface.
Changes
reload.envJSON-RPC method intui_gateway/server.pythat delegates tohermes_cli.config.reload_envand reports{ updated: <count> }./reloadslash command inui-tui/src/app/slash/commands/ops.ts, matching the existing/reload-mcppattern (native RPC, no slash worker).CommandDef("reload", ..., cli_only=True)is kept.cli_onlyonly excludes a command from the messaging-gateway dispatcher (GATEWAY_KNOWN_COMMANDS); it does NOT remove it fromCOMMANDS(which feeds TUIcomplete.slashautocomplete) or from the TUI's ownSLASH_COMMANDSregistry.gateway/run.pyhas no handler for/reload, so flipping the flag would silently forward the literal/reloadtext to the LLM in Slack/Discord/Telegram. Native TUI slash + native RPC is the right path for this command.Caveat (matches classic CLI)
The currently constructed agent's credential pool and provider routing don't auto-rebuild. Users who want a brand-new credential resolution should follow with
/new.Test plan
scripts/run_tests.sh tests/test_tui_gateway_server.py— 92/92 pass (2 new).scripts/run_tests.sh tests/hermes_cli/test_commands.py— 128/128 pass.npm run type-checkclean (inui-tui/).npm test -- --run— 390/390 pass, slash-parity matrix extended with['/reload', 'reload.env', {}].Refs
Audit High #1 (asheriif): "Incomplete configuration hot-reload". Closes the visible parity gap between classic CLI and TUI for
.envreloading.