File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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)
You can’t perform that action at this time.
0 commit comments