Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: action.run executed twice if action is not awaitable (#1021)

Xia Zhenhua8450b4760924
diff --git a/opendevin/controller/agent_controller.py b/opendevin/controller/agent_controller.py
index 3aba128c9c..67c3dabf05 100644
--- a/opendevin/controller/agent_controller.py
+++ b/opendevin/controller/agent_controller.py
@@ -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')