Skip to content

fix(tui_gateway): register shell hooks and plugins on TUI startup#24237

Open
xiaokang wants to merge 1 commit into
NousResearch:mainfrom
xiaokang:fix/tui-register-shell-hooks-and-plugins
Open

fix(tui_gateway): register shell hooks and plugins on TUI startup#24237
xiaokang wants to merge 1 commit into
NousResearch:mainfrom
xiaokang:fix/tui-register-shell-hooks-and-plugins

Conversation

@xiaokang
Copy link
Copy Markdown

tui_gateway.entry — the Python backend for hermes --tui — never called register_from_config or discover_plugins. The CLI (hermes_cli/main.py:11804) and Gateway (gateway/run.py:3369,3377) both bootstrap them at process startup; the TUI was missed.

The bug is silent: tui_gateway/server.py:280 already calls invoke_hook(event_type, ..., platform="tui"), but the plugin manager's dispatch table is empty in this process, so every event fires into the void. Shell hooks configured under hooks: in cli-config.yaml and Python plugins discovered via the standard plugin sources both fail to fire on TUI turns — observability integrations, security guardrails, approval hooks, and custom transforms all silently no-op.

Fix by mirroring the gateway's bootstrap (accept_hooks=False, letting register_from_config resolve consent from HERMES_ACCEPT_HOOKS or hooks_auto_accept: true).

What does this PR do?

Related Issue

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

How to Test

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform:

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

  • This skill is broadly useful to most users (if bundled) — see Contributing Guide
  • SKILL.md follows the standard format (frontmatter, trigger conditions, steps, pitfalls)
  • No external dependencies that aren't already available (prefer stdlib, curl, existing Hermes tools)
  • I've tested the skill end-to-end: hermes --toolsets skills -q "Use the X skill to do Y"

Screenshots / Logs

tui_gateway.entry — the Python backend for `hermes --tui` — never
called `register_from_config` or `discover_plugins`. The CLI
(`hermes_cli/main.py:11804`) and Gateway (`gateway/run.py:3369,3377`)
both bootstrap them at process startup; the TUI was missed.

The bug is silent: `tui_gateway/server.py:280` already calls
`invoke_hook(event_type, ..., platform="tui")`, but the plugin
manager's dispatch table is empty in this process, so every event
fires into the void. Shell hooks configured under `hooks:` in
`cli-config.yaml` and Python plugins discovered via the standard
plugin sources both fail to fire on TUI turns — observability
integrations, security guardrails, approval hooks, and custom
transforms all silently no-op.

Fix by mirroring the gateway's bootstrap (`accept_hooks=False`,
letting `register_from_config` resolve consent from
`HERMES_ACCEPT_HOOKS` or `hooks_auto_accept: true`).
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tui Terminal UI (ui-tui/ + tui_gateway/) comp/plugins Plugin system and bundled plugins labels May 12, 2026
@alt-glitch
Copy link
Copy Markdown
Collaborator

Duplicate of #13854 — same fix (register shell hooks + plugins at TUI startup). #13854 was already triaged and is open. This PR adds plugin discovery (discover_plugins) on top of the shell hooks registration, making it a superset of #13854.

@xiaokang
Copy link
Copy Markdown
Author

@alt-glitch Thanks for you comment. Should I close this PR or continue to add some testcases?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants