fix(tools): improve error logging in code_execution_tool

This commit is contained in:
aydnOktay
2026-03-17 02:04:19 +03:00
committed by teknium1
parent cfa87e77a9
commit 3304bc93a4

View File

@@ -598,7 +598,14 @@ def execute_code(
except Exception as exc:
duration = round(time.monotonic() - exec_start, 2)
logging.exception("execute_code failed")
logger.error(
"execute_code failed after %ss with %d tool calls: %s: %s",
duration,
tool_call_counter[0],
type(exc).__name__,
exc,
exc_info=True,
)
return json.dumps({
"status": "error",
"error": str(exc),
@@ -611,7 +618,7 @@ def execute_code(
try:
server_sock.close()
except Exception as e:
logger.debug("Server socket close error: %s", e)
logger.debug("Server socket close error: %s", e, exc_info=True)
try:
import shutil
shutil.rmtree(tmpdir, ignore_errors=True)