fix(#41457): register shell hooks in TUI gateway and ACP adapter at startup - #41548
Closed
iamlukethedev wants to merge 1 commit into
Closed
Conversation
…adapter at startup Shell hooks (pre_tool_call blockers, etc. from config.yaml) are now registered in both TUI gateway (desktop app) and ACP adapter (IDE) entry points, fixing a security gap where hook-based tool vetoes were silently ignored in these surfaces. The hooks were already working correctly in CLI and messaging gateway, but missing from the desktop/IDE paths. This registered-them at agent build time, creating a divergence where the same hook configuration would work in CLI but be ineffective in the TUI or IDE. Now both entry points call register_from_config() during startup, mirroring the existing gateway implementation: - tui_gateway/entry.py: register right after sidecar publisher setup - acp_adapter/entry.py: register right after MCP tool discovery Both use the same best-effort error handling: failures log to debug but never block startup. register_from_config() is idempotent, so adding it to additional entry points is safe. Fixes NousResearch#41457
Contributor
Author
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
config.yaml'shooks:block) implement security checks likepre_tool_callblockers to veto dangerous operations (e.g.,rm -rf, writes to protected paths). These hooks work correctly in the CLI and messaging gateway, but are silently ignored in the TUI gateway (desktop app) and ACP adapter (IDE integration).This creates a security gap: a user who configures a
pre_tool_callshell hook to block dangerous operations will have that protection enforced in the CLI and gateway, but not when driving the same agent from the desktop app or an IDE. The divergence is especially concerning becausehermes hooks doctorpasses (script validation, etc.) while the hook remains inert in those surfaces.Solution
Call
register_from_config()at startup in both TUI gateway and ACP adapter entry points, mirroring the existing gateway implementation.Both use the same best-effort error handling: failures log to debug but never block startup.
Implementation details
accept_hooks=Falseto let the function resolve the effective value from env + config itself (no re-reading ofhooks_auto_accept)Testing
tui_gateway/entry.pyandacp_adapter/entry.pyimport successfullyImpact
Fixes #41457