ColtenOuO opened a new pull request, #71853:
URL: https://github.com/apache/airflow/pull/71853

   ### Summary
   
   Follow up:  #71445
   
   `HookToolset.call_tool` had no error handling — any exception raised by the 
wrapped hook method (bad arguments from the LLM, a transient network error, 
etc.) propagated straight up and aborted the whole agent run. Every other 
hand-written toolset in this provider (`SQLToolset`, `DataFusionToolset`, 
`SandboxToolset`) already catches tool failures and re-raises them as
   `pydantic_ai.exceptions.ModelRetry`, so the model can read the error and 
retry within the run instead of failing the task outright.
   
   This brings `HookToolset` in line with the other toolsets, bounded by the 
tool's existing `max_retries`.
   
   ### Change
   
   - `HookToolset.call_tool` (`toolsets/hook.py`) now wraps the hook method 
call in `try/except Exception`, re-raising as 
`pydantic_ai.exceptions.ModelRetry` with the tool name and original error 
message.
   - Added a short note to the class docstring describing this retry behavior, 
matching the wording already used by `SQLToolset` / `SandboxToolset`.
   - Added `test_wraps_failure_in_model_retry` (`tests/.../test_hook.py`), 
using a new `_FakeHook.failing_method` fixture that always raises.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   No


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to