fix(dispatch): forward session_id into registry.dispatch (#28479)
Both the regular and execute_code dispatch paths forward task_id into registry.dispatch via middleware _dispatch lambdas but silently dropped session_id. Dispatch-layer hooks (e.g. set_enforcement_fn) that correlate calls with the active session received "" for every invocation. Pass session_id=session_id at both _dispatch call sites inside handle_function_call, matching the existing task_id pattern. Hooks already received session_id; this closes the registry.dispatch gap. Rebased onto current main where dispatch is wrapped by run_tool_execution_middleware — the old direct-dispatch sites from #28479 no longer exist. test(dispatch): add tests for session_id forwarding (NousResearch#28479) Covers standard and execute_code paths through the middleware wrapper. Verifies task_id forwarding is not broken by the change.
This commit is contained in:
@@ -1115,6 +1115,7 @@ def handle_function_call(
|
||||
return registry.dispatch(
|
||||
function_name, next_args,
|
||||
task_id=task_id,
|
||||
session_id=session_id,
|
||||
enabled_tools=sandbox_enabled,
|
||||
)
|
||||
else:
|
||||
@@ -1122,6 +1123,7 @@ def handle_function_call(
|
||||
return registry.dispatch(
|
||||
function_name, next_args,
|
||||
task_id=task_id,
|
||||
session_id=session_id,
|
||||
user_task=user_task,
|
||||
)
|
||||
from hermes_cli.middleware import run_tool_execution_middleware
|
||||
|
||||
Reference in New Issue
Block a user