Skip to content

fix(executor): include exception type when .args is empty#543

Open
wjgong001 wants to merge 1 commit into
langwatch:mainfrom
wjgong001:main
Open

fix(executor): include exception type when .args is empty#543
wjgong001 wants to merge 1 commit into
langwatch:mainfrom
wjgong001:main

Conversation

@wjgong001

Copy link
Copy Markdown

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-899

Before

RuntimeError: [PipecatAgentAdapter]

After

RuntimeError: [PipecatAgentAdapter] <TimeoutError: no message>

Test

  • Need guidance on where to add regression test

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 langwatch-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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

@langwatch-agent langwatch-agent removed the request for review from drewdrewthis July 10, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hound-checked Triaged by the pr-hound agent at the current head SHA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scenario_executor re-raise renders empty body for no-message exceptions, hides root cause across all adapters

2 participants