ReAct text tool path swallows HookAborted from POST_TOOL_CALL hooks
Description
When an agent runs on the ReAct text-based tool route (no native function calling), a HookAborted raised by a POST_TOOL_CALL policy hook is silently swallowed instead of terminating the run.
AgentExecutor.execute_tool_action (lib/crewai/src/crewai/agents/agent_executor.py, ~line 1857) wraps execute_tool_and_check_finality in try/except. It correctly re-raises ToolExecutionFailedError, but the following except Exception also catches HookAborted (a subclass of Exception) and converts it into a recoverable observation:
Observation: Error executing tool: deny
The agent then keeps iterating and can call the vetoed tool again.
Reproduce
from crewai.hooks import InterceptionPoint, on
from crewai.hooks.dispatch import HookAborted
@on(InterceptionPoint.POST_TOOL_CALL)
def deny(ctx):
raise HookAborted("deletion not allowed")
agent = Agent(role=..., goal=..., backstory=..., llm=<text-mode LLM>, tools=[...])
agent.kickoff("delete the file") # abort never surfaces; LLM receives a tool-error observation
(With a native-function-calling LLM the same setup raises HookAborted out of kickoff as expected.)
Impact
- The documented hook contract (
@ondocstring inhooks/dispatch.py:raise HookAborted("deletion not allowed")) is broken on this path: a policy veto is downgraded to a tool error the LLM can retry around. - Guardrail hooks (blocking destructive tools, PII exfiltration, cost caps) do not stop the run when the model uses text tool calling.
- Inconsistent behavior between the two tool-call modes for identical hook setups: the native path re-raises (
execute_native_tool), the parallel todo executor re-raises, LiteAgent re-raises — only the ReAct text path swallows.
HookAborted should be re-raised before the generic except Exception, mirroring the existing ToolExecutionFailedError passthrough in the same function.