From d2ec5aaacf7c3add9111621042b9389495c9fdec Mon Sep 17 00:00:00 2001 From: BathreeNode <101283333+batuhankocyigit@users.noreply.github.com> Date: Mon, 2 Mar 2026 11:57:47 +0300 Subject: [PATCH 1/2] fix(registry): preserve full traceback on tool dispatch errors logger.error() only records the exception message string, silently discarding the stack trace. Switch to logger.exception() which automatically appends the full traceback to the log output. Without this change, when a tool handler raises an unexpected error the log shows only the exception type and message, making it impossible to determine which line caused the failure or trace through nested calls. --- tools/registry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/registry.py b/tools/registry.py index 5605f319e1..7d73bb4fb5 100644 --- a/tools/registry.py +++ b/tools/registry.py @@ -125,7 +125,7 @@ class ToolRegistry: return _run_async(entry.handler(args, **kwargs)) return entry.handler(args, **kwargs) except Exception as e: - logger.error("Tool %s dispatch error: %s", name, e) + logger.exception("Tool %s dispatch error: %s", name, e) return json.dumps({"error": f"Tool execution failed: {type(e).__name__}: {e}"}) # ------------------------------------------------------------------ From c574a4d0862cdaf219236837d03cb0f573feeee5 Mon Sep 17 00:00:00 2001 From: BathreeNode <101283333+batuhankocyigit@users.noreply.github.com> Date: Mon, 2 Mar 2026 12:16:07 +0300 Subject: [PATCH 2/2] fix(batch_runner): log traceback when worker raises during imap_unordered If any worker raises inside pool.imap_unordered(), the exception propagates through the for loop and the results list is left incomplete. The finally block correctly restores the log level but the error is swallowed with no diagnostic information. Added an explicit except block that logs the full traceback via exc_info=True before re-raising, making batch worker failures visible in logs without changing the existing control flow. --- batch_runner.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/batch_runner.py b/batch_runner.py index 9bc7a14ca1..23eeec48ee 100644 --- a/batch_runner.py +++ b/batch_runner.py @@ -914,6 +914,9 @@ class BatchRunner: for result in pool.imap_unordered(_process_batch_worker, tasks): results.append(result) progress.update(task, advance=1) + except Exception as e: + logger.error("Batch worker failed: %s", e, exc_info=True) + raise finally: root_logger.setLevel(original_level)