Fix stuck execution flow (#5458)

This commit is contained in:
Engel Nyst 2024-12-08 22:39:32 +01:00 committed by GitHub
parent 279e1d7abc
commit 2874041381
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -454,13 +454,10 @@ class AgentController:
await asyncio.sleep(1)
return
if self._is_stuck():
await self._react_to_exception(RuntimeError('Agent got stuck in a loop'))
return
if self.delegate is not None:
assert self.delegate != self
if self.delegate.get_agent_state() == AgentState.PAUSED:
# no need to check too often
await asyncio.sleep(1)
else:
await self._delegate_step()
@ -487,6 +484,10 @@ class AgentController:
if stop_step:
return
if self._is_stuck():
await self._react_to_exception(RuntimeError('Agent got stuck in a loop'))
return
self.update_state_before_step()
action: Action = NullAction()
try: