mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 23:08:04 -05:00
Fix stuck execution flow (#5458)
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user