fix(executor): include exception type when .args is empty#543
Conversation
When an adapter raises an exception with no message (e.g. asyncio.TimeoutError, bare Exception()), the re-raised RuntimeError rendered as '[AdapterName] ' with empty body. Now falls back to '<ExceptionType: no message>' so operators can tell what failed without inspecting __cause__. Fixes langwatch#500
langwatch-agent
left a comment
There was a problem hiding this comment.
1 P2 finding — see inline. Static external-PR review only; I did not execute fork code. CI is not currently providing a green signal and the PR is dirty, so conflicts/CI still need to be resolved before merge.
| except Exception as e: | ||
| agent_name = agent.__class__.__name__ | ||
| raise RuntimeError(f"[{agent_name}] {e}") from e | ||
| msg = str(e) if str(e) else f"<{e.__class__.__name__}: no message>" |
There was a problem hiding this comment.
[P2] Add a regression test for empty-message adapter exceptions\n\nProblem: this changes the executor's exception formatting for the no-message case, but there is no test locking the new behavior. This path is specifically about preserving useful operator diagnostics when an adapter raises something like asyncio.TimeoutError(), and it is easy to regress back to [AdapterName] while refactoring executor error handling.\n\nSuggested fix: add a focused test near the existing exception-chain coverage that uses an agent/adapter raising a message-less exception and asserts the re-raised RuntimeError includes <TimeoutError: no message> (or the chosen fallback format) while preserving __cause__.\n\nConfidence: High
When an adapter raises an exception with no message (e.g. asyncio.TimeoutError, bare Exception()), the re-raised RuntimeError rendered as
[AdapterName]with empty body.This PR adds a fallback: if
str(e)is empty, use<e.__class__.__name__: no message>so operators can tell what failed without inspecting__cause__.Fixes #500
Changes
python/scenario/scenario_executor.py: line 898-899Before
After
Test