Skip to content

Commit 4b891d2

Browse files
address review comment
1 parent 0f8f271 commit 4b891d2

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/agentevals/sdk.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,10 @@ async def session_async(
256256
setup.tracer_provider.force_flush()
257257
if setup.logger_provider:
258258
setup.logger_provider.force_flush()
259-
await setup.processor.shutdown_async()
259+
try:
260+
await setup.processor.shutdown_async()
261+
except Exception as exc:
262+
logger.warning("Shutdown error: %s", exc)
260263

261264
# --- Decorator run helpers ---
262265

tests/test_sdk.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,20 @@ async def _test():
387387

388388
asyncio.run(_test())
389389

390+
@patch(PROC_PATH)
391+
def test_shutdown_error_is_logged_not_raised(self, MockProc):
392+
mock_proc = _make_mock_processor()
393+
mock_proc.shutdown_async = AsyncMock(side_effect=RuntimeError("ws closed"))
394+
MockProc.return_value = mock_proc
395+
396+
app = AgentEvals(auto_instrument=False)
397+
398+
async def _test():
399+
async with app.session_async(session_name="s1"):
400+
pass
401+
402+
asyncio.run(_test())
403+
390404

391405
# ---------------------------------------------------------------------------
392406
# streaming=False (disabled mode)

0 commit comments

Comments
 (0)