π OpenHands: AI-Driven Development
feat: make the response of agent_controller better to process when exception in step execution (#1445)
Xia Zhenhua086a2ed17fe6
diff --git a/opendevin/controller/agent_controller.py b/opendevin/controller/agent_controller.pyindex a202e44d28..7e1da1e246 100644--- a/opendevin/controller/agent_controller.py+++ b/opendevin/controller/agent_controller.py@@ -99,9 +99,12 @@ class AgentController:finished = await self.step(i)if finished:self._task_state = TaskState.FINISHED- except Exception as e:+ except Exception:logger.error('Error in loop', exc_info=True)- raise e+ await self._run_callbacks(+ AgentErrorObservation('Oops! Something went wrong while completing your task. You can check the logs for more info.'))+ await self.set_task_state_to(TaskState.STOPPED)+ breakif self._task_state == TaskState.FINISHED:logger.info('Task finished by agent')