fix(runner): narrow BaseException catch to Exception in tool execution
The tool execution path caught BaseException, which includes KeyboardInterrupt, SystemExit, MemoryError, and GeneratorExit. These should never be caught and converted into conversational error messages. CancelledError is already handled separately. Change except BaseException to except Exception so fatal signals propagate instead of being swallowed. Adds parametrized regression test for KeyboardInterrupt and SystemExit propagation. Fixes #4788
This commit is contained in:
@@ -1174,7 +1174,7 @@ class AgentRunner:
|
||||
result = await spec.tools.execute(tool_call.name, params)
|
||||
except asyncio.CancelledError:
|
||||
raise
|
||||
except BaseException as exc:
|
||||
except Exception as exc:
|
||||
await hook.on_execute_tool_error(context, tool_call, tool, params, exc)
|
||||
event = {
|
||||
"name": tool_call.name,
|
||||
|
||||
Reference in New Issue
Block a user