fix(tui): register shell hooks in TUI path for parity with CLI and gateway - #48770
Open
handpape wants to merge 1 commit into
Open
fix(tui): register shell hooks in TUI path for parity with CLI and gateway#48770handpape wants to merge 1 commit into
handpape wants to merge 1 commit into
Conversation
…teway The TUI (_make_agent in tui_gateway/server.py) never called register_from_config(), so declarative shell hooks (hooks: block in config.yaml) were silently ignored when running via the TUI. This caused hooks like post_llm_call to never fire, even though they work correctly in the CLI (cli.py:953) and gateway (gateway/run.py:5124) paths. This adds the same register_from_config(load_config(), accept_hooks=False) call to _make_agent(), matching the pattern used by the other two entry points. The call is idempotent (guarded by _registered set) and failure-safe (wrapped in try/except), so it is safe to run on every agent creation.
tonydwb
approved these changes
Jun 19, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Clean fix registering shell hooks in the TUI execution path for parity with CLI and gateway. Small change (10 additions, 1 file) that improves consistency. No concerns.
Reviewed by Hermes Agent
Contributor
|
Thanks for identifying a real TUI-process parity gap. Current main still builds TUI agents in Problems
Suggested changes
Automated hermes-sweeper review. |
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.
Problem
Shell hooks configured in the
hooks:block ofconfig.yaml(e.g.post_llm_call) are silently ignored when running via the TUI. They work correctly in the CLI and gateway paths.Root cause
The TUI's agent factory (
_make_agentintui_gateway/server.py) never callsregister_from_config(). The other two entry points do:register_from_configcli.py:953gateway/run.py:5124Without this call, shell hook callbacks are never wired into the plugin manager, so
invoke_hook("post_llm_call", ...)inagent/turn_finalizer.pyfinds zero callbacks and the hook script never runs.Fix
Add
register_from_config(load_config(), accept_hooks=False)to_make_agent()intui_gateway/server.py, matching the exact pattern used by the CLI and gateway. The call is:_registeredset inshell_hooks.py, so repeated calls on multiple agent creations are no-ops.try/exceptso a broken hook never crashes agent init.accept_hooks=Falseargument, letting_resolve_effective_acceptpick uphooks_auto_accept: true/HERMES_ACCEPT_HOOKSenv var.Verification
hermes hooks doctorandhermes hooks test post_llm_callboth pass. The hook script fires correctly on TUI agent responses after restart.