fix(hooks): register hooks in profile-isolated Desktop and TUI backends - #62681
skeptikoss wants to merge 1 commit into
Conversation
Register config shell hooks only in profile-specific Desktop backends after auth/plugin rediscovery, and in standalone TUI before readiness. Keep ordinary multi-profile dashboards isolated and make failures non-blocking.
|
Thanks for tracing the separate backend startup paths. The production wiring matches the current topology: Desktop launches a per-profile Problems
Suggested changes
Automated hermes-sweeper review. |
|
Thanks @skeptikoss for tracing the three startup paths and showing that Superseded on Your diagnosis pre-dated the fix and is credited. Reopen if a configured |
Problem
Shell hooks configured in
config.yamlare registered in CLI and messaging-gateway startup, but not in the profile-specific Desktop backend or standalone TUI gateway. The turn loop still invokes hooks, but the process-local registry is empty, so hooks such aspre_llm_callandpre_tool_callsilently do nothing.This is especially misleading because
hermes hooks doctorcan pass while the active Desktop/TUI process has registered no hooks.Fix
cmd_dashboard()only whenHERMES_DESKTOP=1.start_server()because auth setup can force plugin rediscovery and clear registered callbacks.tui_gateway.entry.main()beforegateway.ready.--statusand--stoplifecycle actions.Profile isolation
The
HERMES_DESKTOP=1guard is intentional. Desktop starts a separate backend process per profile, while the ordinary browser dashboard can serve multiple profiles. Unconditionally registering the launch/default profile's hooks in the browser-dashboard process risks executing them during another profile's turns.Ordering
Registration occurs after
_maybe_setup_dashboard_auth_interactively(). That path may force plugin rediscovery, which clearsPluginManager._hooks; registering earlier can leave shell-hook deduplication state populated while the actual callbacks have been removed.Tests
Added regression coverage for:
--statusand--stopdo not register hooks;gateway.ready;Local verification:
The same patch was also exercised through real isolated Desktop WebSocket and standalone TUI prompt paths with a controlled
pre_llm_callhook; both produced completed hook invocations.Related work
Related issues: #41457, #43823.
This overlaps #53894, #57020 and #61823, but differs in two material ways: