Skip to content

[Bug]: Shell hooks (config.yaml hooks:) are never registered in the desktop TUI entry point #43823

Closed

Description

@pat-videdev

Summary

hooks: entries in config.yaml (shell hooks) are silently ignored when running the desktop app / TUI (tui_gateway). The same config works in CLI and gateway sessions.

Version / platform

  • Hermes Desktop v0.16.0, Windows 11
  • HERMES_HOME = %LOCALAPPDATA%\Hermes

Repro

  1. Add a pre_tool_call shell hook to config.yaml:

    hooks:
      pre_tool_call:
        - matcher: "terminal"
          command: "python C:/path/to/block-git.py"
          timeout: 5
    hooks_auto_accept: true
  2. Restart the desktop app, start a chat, have the agent run a terminal command matching the hook (e.g. git commit --allow-empty -m test).

  3. The command executes; the hook never fires. Logs contain no "shell hook registered" or "not allowlisted - skipped" lines.

Cause (from reading the source)

agent.shell_hooks.register_from_config() is called at CLI startup (cli.py, hermes_cli/main.py) and gateway startup (gateway/run.py), but never from tui_gateway/ - so desktop sessions have no shell hooks at all, even though pre_tool_call plugin hooks dispatched via hermes_cli.plugins.invoke_hook work fine there.

Expected

Either register shell hooks in the TUI gateway startup as well, or document that shell hooks are CLI/gateway-only. Since hooks are a security surface (the docs advertise pre_tool_call blocking), the silent no-op is the risky part: a user can configure a blocking hook, see no error, and believe they are protected.

Workaround

A user plugin (HERMES_HOME/plugins/<name>/ registering pre_tool_call via register(ctx)) + plugins.enabled: [<name>] works in the desktop TUI.

Found while wiring policy gates for autonomous runs; happy to provide more logs/details.

Activity

  1. changed the title [-]Shell hooks (config.yaml hooks:) are never registered in the desktop TUI entry point[/-] [+][Bug]: Shell hooks (config.yaml hooks:) are never registered in the desktop TUI entry point[/+] on Jun 10, 2026
  2. added
    type/bugSomething isn't working
    comp/tuiTerminal UI (ui-tui/ + tui_gateway/)
    P2Medium — degraded but workaround exists
    duplicateThis issue or pull request already exists
    on Jun 10, 2026
  3. alt-glitch commented on Jun 10, 2026

    @alt-glitch

    Duplicate of #41457 — same gap: shell_hooks.register_from_config() is not called in the desktop/TUI entry point, so pre_tool_call block hooks silently no-op there. Fix PRs: #43826/#43828 (and existing #13854/#34112/#41464).

  4. liuhao1024 commented on Jun 11, 2026

    @liuhao1024

    This is fixed by #43826 — adds register_from_config() call to tui_gateway/entry.py::main() so shell hooks (config.yaml hooks: entries) are registered at desktop/TUI startup.

  5. teknium1 commented on Sep 7, 2026

    @teknium1
    Collaborator

    The missing in-process shell-hook registration is resolved on main in #104870 (#104870), merge commit d87d7657c0791c7038f2e5dfffb036516cba512c. The shared chat-agent factory now invokes the existing consent-aware, profile-keyed registrar in the process that executes the turn—not just the launcher.

    The merged live serve/WebSocket/local-model/subprocess A/B verified file and terminal hooks across launch/A/B/A profiles: formerly unblocked writes are blocked, with exactly one matching hook per turn; unapproved controls retain ordinary tool execution. This is real Linux backend evidence, not native Windows/macOS or Feishu/vendor service QA. Existing hook event semantics are unchanged.

    Thanks @pat-videdev for the report and process-path evidence; credit @grimmjoww (#57020), @michaelversluis (#69832), @fangliquanflq (#102691), and @foma-agent for the earlier implementation and profile-isolation investigations. The distinct startup-refusal contract in #69825 and ACP portion of #41457 remain open.

    Please update to a build containing this commit and restart the serving process. Reply with a fresh reproduction if registration remains missing so we can reopen.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/tuiTerminal UI (ui-tui/ + tui_gateway/)duplicateThis issue or pull request already existstype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions