fix(web): register configured shell hooks for Web UI sessions - #83997
andyst-dev wants to merge 1 commit into
Conversation
9f8dd85 to
479c7b9
Compare
fix(web): register configured shell hooks for Web UI sessions
|
479c7b9 to
7a3e6d8
Compare
|
Addressed the review points on this PR. Point 1 (log registration failure at WARNING, not DEBUG): done. A configured hook silently vanishing is exactly the failure this PR exists to fix (Web UI sessions previously skipped configured hooks entirely), so the lifespan failure path now logs at Point 2 (double-registration): verified — Point 3 (register → invoke chain): the existing Validation: |
dfc436c to
869899c
Compare
869899c to
3662c2f
Compare
|
Rebased on current main (web_server refactored; shell-hooks registration re-injected after thread start, |
3662c2f to
6b87a15
Compare
Fixes #83980
Problem
Ordinary
hermes dashboardWeb UI sessions never registered the lifecycle hooks declared incli-config.yaml.agent.shell_hooks.register_from_config()had call sites incli.pyandgateway/run.pybut none on the Web UI path. So the persistent Relay observability (and any config-defined shell hook) silently stopped emitting for Web UI chats — while the same config looked healthy on CLI, TUI, messaging, and webhook surfaces.Root cause
The FastAPI app's lifespan never invoked
register_from_config. Web UI sessions built the agent but skipped the config-driven hook and outbound-webhook registration that every other surface performs at startup.Fix
Register declarative shell hooks and outbound webhooks from the loaded config during the FastAPI lifespan (
hermes_cli/web_server.py), mirroring the gateway and CLI call sites. The web server has no TTY, so consent is resolved from the same opt-in channels (--accept-hooks,HERMES_ACCEPT_HOOKS,hooks_auto_accept). Failures are logged but never block startup — identical to the gateway path.Tests
Added
tests/hermes_cli/test_web_server_registers_config_hooks.py: starts the app throughTestClient(which runs the lifespan) withregister_from_config/outbound-webhook registration patched at the source module, and asserts the web server calls them with the loaded config and consent resolved internally (accept_hooks=False).Verified: new test passes, existing web-server tests (
test_web_server_git,test_web_server_config_offloop) still pass, ruff clean.