hermes - 💡(How to fix) Fix fix: pre_tool_call hook missing session_id in three call sites

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

These call sites pass function_name, function_args, task_id but omit session_id. The model_tools.handle_function_call() path already passes session_id correctly — these three were missed.

Without session_id, _get_session_source("") returns None, so any hook that checks session source to distinguish platform sessions will silently skip the check and never block.

Fix Action

Fix

 block_message = get_pre_tool_call_block_message(
     function_name, function_args, task_id=effective_task_id or "",
+    session_id=getattr(agent, "session_id", "") or "",
 )

Code Example

block_message = get_pre_tool_call_block_message(
     function_name, function_args, task_id=effective_task_id or "",
+    session_id=getattr(agent, "session_id", "") or "",
 )
RAW_BUFFERClick to expand / collapse

Bug description

The get_pre_tool_call_block_message() function is called without session_id in three places, causing pre_tool_call hooks that rely on session-based platform detection to fail silently.

Affected code paths

  1. agent/agent_runtime_helpers.py:1561invoke_tool()
  2. agent/tool_executor.py:129execute_tool_calls_concurrent()
  3. agent/tool_executor.py:504execute_tool_calls_sequential()

Root cause

These call sites pass function_name, function_args, task_id but omit session_id. The model_tools.handle_function_call() path already passes session_id correctly — these three were missed.

Without session_id, _get_session_source("") returns None, so any hook that checks session source to distinguish platform sessions will silently skip the check and never block.

Reproduction

  1. Write a plugin with a pre_tool_call hook that blocks based on session_id source
  2. Trigger a tool call from a non-CLI platform (wecom, telegram, etc.)
  3. The hook never fires because session_id is empty

Fix

 block_message = get_pre_tool_call_block_message(
     function_name, function_args, task_id=effective_task_id or "",
+    session_id=getattr(agent, "session_id", "") or "",
 )

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING