feat: make the response of agent_controller better to process when exception in step execution (#1445)

* feat: make the response of agent_controller better to process when exception occurred during executing step.

* Update opendevin/controller/agent_controller.py

---------

Co-authored-by: aaren.xzh <aaren.xzh@antfin.com>
Co-authored-by: Robert Brennan <accounts@rbren.io>
This commit is contained in:
Xia Zhenhua 2024-04-30 05:21:26 +08:00 committed by GitHub
parent fa067edbac
commit 086a2ed17f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)
break
if self._task_state == TaskState.FINISHED:
logger.info('Task finished by agent')