File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
temporalio/contrib/openai_agents
tests/contrib/openai_agents Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1717 TIMEOUT_TYPE_HEARTBEAT ,
1818 TIMEOUT_TYPE_SCHEDULE_TO_START ,
1919)
20- from temporalio .exceptions import ActivityError , ApplicationError
20+ from temporalio .exceptions import (
21+ ActivityError ,
22+ ApplicationError ,
23+ CancelledError ,
24+ is_cancelled_exception ,
25+ )
2126from temporalio .worker import PollerBehaviorSimpleMaximum , Worker
2227from temporalio .workflow import ActivityConfig , ActivityHandle
2328
@@ -213,6 +218,13 @@ async def connect(self) -> None:
213218 async def cleanup (self ) -> None :
214219 if self ._connect_handle :
215220 self ._connect_handle .cancel ()
221+ try :
222+ await self ._connect_handle
223+ except Exception as e :
224+ if is_cancelled_exception (e ):
225+ pass
226+ else :
227+ raise
216228
217229 async def __aenter__ (self ):
218230 await self .connect ()
Original file line number Diff line number Diff line change 1212 Optional ,
1313 Sequence ,
1414 Union ,
15+ cast ,
1516 no_type_check ,
1617)
1718
@@ -2466,6 +2467,7 @@ async def get_prompt(
24662467 "list_tools" ,
24672468 "cleanup" ,
24682469 ]
2470+ assert len (cast (StatefulMCPServerProvider , server )._servers ) == 0
24692471 else :
24702472 assert tracking_server .calls == [
24712473 "connect" ,
You can’t perform that action at this time.
0 commit comments