fix(hermes): skip Omnigent relay tools in the pre_tool_call hook - #2220
Conversation
Omnigent relay tools surfaced into Hermes (mcp_omnigent_* / mcp__omnigent__*) are already policy-gated when the relay dispatches them back through the server's tool path. The pre_tool_call hook evaluated them a second time, parking a duplicate approval card per call; a human resolves one and the other's long-poll never returns, wedging the turn after the approved tool runs. Skip those prefixes in the hook, matching the guard the native claude/codex hooks already apply. Hermes' own tools (shell, file) and non-Omnigent MCP servers lack the prefix and stay gated. Signed-off-by: rdosen <robert.dosen@gmail.com>
|
@dosenr This PR is a Bug fix, Feature, or UI / frontend change but the Demo section is missing or only contains a placeholder. These change types require a screenshot or screen recording so reviewers can see the new behaviour without checking out the branch. Please update the Demo section with:
Use |
|
Headless/server-side change with no UI surface; the terminal transcript in the Demo section is the demonstration. |
|
🏷️ Doc impact: Internal bugfix to the Hermes policy hook skipping duplicate gating of Omnigent relay tools; no user-facing surface, integration, or documented behavior changed. Auto-classified on merge. Set the label manually before merging to override. · run |
|
…igent-ai#2220) Omnigent relay tools surfaced into Hermes (mcp_omnigent_* / mcp__omnigent__*) are already policy-gated when the relay dispatches them back through the server's tool path. The pre_tool_call hook evaluated them a second time, parking a duplicate approval card per call; a human resolves one and the other's long-poll never returns, wedging the turn after the approved tool runs. Skip those prefixes in the hook, matching the guard the native claude/codex hooks already apply. Hermes' own tools (shell, file) and non-Omnigent MCP servers lack the prefix and stay gated. Signed-off-by: rdosen <robert.dosen@gmail.com> Signed-off-by: Aditya Devarapalli <adityareddyd2@gmail.com>
Related issue
Closes #2219
Summary
hermes_policy_hook.pyevaluatedPHASE_TOOL_CALLpolicy for every tool, including theOmnigent relay tools (
mcp_omnigent_*/mcp__omnigent__*). Those tools are already gatedwhen the relay dispatches them back through the server's tool path (fail-closed, re-checked on
retry), so the hook gated them a second time — parking a duplicate approval card whose hook
long-poll never returns after the first card is resolved, wedging the turn.
Skip those prefixes in the hook, matching the guard the native claude/codex hooks already apply
(
native_policy_hook.hook_payload_to_evaluation_requestskipsmcp__omnigent__*; Hermes namesthe same relay tools
mcp_omnigent_*, so both forms are matched). Hermes' own tools (shell,file) and non-Omnigent MCP servers lack the prefix and stay gated by the hook.
Test plan
tests/inner/test_hermes_policy_hook.pyasserts the relay tools are allowed without a call to/policies/evaluate(both underscore forms) and that native tools and non-Omnigent MCP serversstill round-trip the hook's policy gate. The relay-skip cases fail before the change (the hook
evaluates them) and pass after.
uv run pytest tests/inner/test_hermes_policy_hook.pygreen.Demo
Live web UI run (headless
hermeswith the Omnigent MCP server from #2216registered, demo ASK policy on
sys_session_get_info): the gated relay callparks exactly ONE approval card - the dispatch-side policy evaluation. Without
this fix the pre_tool_call hook would evaluate the same call a second time and
park a second card whose long-poll outlives the human's single approval.
Original terminal transcript
This is a hook-logic change with no UI surface, so the demonstration is the test: the relay
tools short-circuit to allow without a
/policies/evaluateround-trip, while native tools stillround-trip. The
test_relay_tools_are_skippedcases fail before the change and pass after:End-to-end (a single approval card per gated relay call, no post-resolution wedge) was verified
against a running deployment.
Type of change
Test coverage
Coverage notes
The end-to-end behavior (a single approval card per gated relay call, no post-resolution wedge)
was verified against a running deployment; the added unit tests cover the hook-level skip that
was the defect.
Changelog
Fixed the Hermes
pre_tool_callhook double-gating Omnigent relay tools, which parked aduplicate approval card and could wedge the turn.