Skip to content

fix: chain asyncio.TimeoutError cause in _call_with_timeout#114

Open
andrewwhitecdw wants to merge 1 commit into
Agent-Field:mainfrom
andrewwhitecdw:andrewwhitecdw/fix/timeout-raise-from
Open

fix: chain asyncio.TimeoutError cause in _call_with_timeout#114
andrewwhitecdw wants to merge 1 commit into
Agent-Field:mainfrom
andrewwhitecdw:andrewwhitecdw/fix/timeout-raise-from

Conversation

@andrewwhitecdw

Copy link
Copy Markdown
Contributor

Bug

_call_with_timeout in both coding_loop.py and dag_executor.py caught asyncio.TimeoutError and raised a plain TimeoutError, dropping the original exception chain.

Fix

Use raise ... from exc in both implementations so TimeoutError.__cause__ carries the original asyncio.TimeoutError.

Test

Added tests/test_call_with_timeout.py with a parametrized async test that asserts the cause is chained for both implementations.

Verification

AGENTFIELD_SERVER=http://localhost:9999 pytest tests/test_call_with_timeout.py -v passes (2 tests).

Both coding_loop.py and dag_executor.py define _call_with_timeout and
catch asyncio.TimeoutError, but they raised a plain TimeoutError without
chaining the original exception. Preserve the cause so callers can trace
the timeout back to its source.

Adds a parametrized unit test that asserts TimeoutError.__cause__ is the
original asyncio.TimeoutError for both implementations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant