mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 05:37:20 +08:00
fix: action.run executed twice if action is not awaitable (#1021)
This commit is contained in:
@@ -194,10 +194,9 @@ class AgentController:
|
||||
|
||||
if action.executable:
|
||||
try:
|
||||
if inspect.isawaitable(action.run(self)):
|
||||
observation = await cast(Awaitable[Observation], action.run(self))
|
||||
else:
|
||||
observation = action.run(self)
|
||||
observation = action.run(self)
|
||||
if inspect.isawaitable(observation):
|
||||
observation = await cast(Awaitable[Observation], observation)
|
||||
except Exception as e:
|
||||
observation = AgentErrorObservation(str(e))
|
||||
print_with_color(observation, 'ERROR')
|
||||
|
||||
Reference in New Issue
Block a user