test: stub has_hook in transform_tool_result hook tests

CI slice 3 caught that tests/test_transform_tool_result_hook.py monkeypatches
invoke_hook but not has_hook, so the new has_hook("transform_tool_result")
gate skipped the emit and the transform never ran. Stub has_hook=True in the
shared _run_handle_function_call helper whenever a custom invoke_hook is
supplied (the test intends hooks to fire). The no-hook-registered test keeps
the real has_hook=False path — that's the gate's intended behavior.
This commit is contained in:
teknium1
2026-06-03 06:23:28 -07:00
committed by Teknium
parent 827f251426
commit de26b17854

View File

@ -36,6 +36,10 @@ def _run_handle_function_call(
if invoke_hook is not _UNSET:
# Patch the symbol actually imported inside handle_function_call.
monkeypatch.setattr("hermes_cli.plugins.invoke_hook", invoke_hook)
# Supplying a custom invoke_hook means the test expects hooks to
# fire — make has_hook agree so the has_hook gate doesn't skip the
# post_tool_call / transform_tool_result emit paths.
monkeypatch.setattr("hermes_cli.plugins.has_hook", lambda name: True)
return model_tools.handle_function_call(
tool_name,