Fix for regression (#4075)

Regression fixed
This commit is contained in:
tofarr 2024-09-26 12:58:00 -06:00 committed by GitHub
parent 0a03c802f5
commit c919086e25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View File

@ -119,8 +119,6 @@ class AgentController:
async def close(self):
"""Closes the agent controller, canceling any ongoing tasks and unsubscribing from the event stream."""
if self.agent_task is not None:
self.agent_task.cancel()
await self.set_agent_state_to(AgentState.STOPPED)
self.event_stream.unsubscribe(EventStreamSubscriber.AGENT_CONTROLLER)

View File

@ -32,6 +32,7 @@ class AgentSession:
runtime: Runtime | None = None
security_analyzer: SecurityAnalyzer | None = None
_closed: bool = False
loop: asyncio.AbstractEventLoop
def __init__(self, sid: str, file_store: FileStore):
"""Initializes a new instance of the Session class
@ -44,6 +45,7 @@ class AgentSession:
self.sid = sid
self.event_stream = EventStream(sid, file_store)
self.file_store = file_store
self.loop = asyncio.new_event_loop()
async def start(
self,
@ -71,7 +73,6 @@ class AgentSession:
'Session already started. You need to close this session and start a new one.'
)
self.loop = asyncio.new_event_loop()
self.thread = Thread(target=self._run, daemon=True)
self.thread.start()