mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2024-08-29 01:18:33 +03:00
[Fix] Metrics should be updated when agent reaches max iterations. (#3549)
This commit is contained in:
@@ -120,11 +120,15 @@ async def complete_runtime(
|
||||
obs = await runtime.run_action(action)
|
||||
logger.info(obs, extra={'msg_type': 'OBSERVATION'})
|
||||
|
||||
exit_code = 1
|
||||
if isinstance(obs, CmdOutputObservation):
|
||||
exit_code = obs.exit_code
|
||||
|
||||
logger.info(f"{'-' * 50} END Runtime Completion Fn {'-' * 50}")
|
||||
|
||||
return {
|
||||
'test_output': obs.content,
|
||||
'exit_code': obs.exit_code,
|
||||
'exit_code': exit_code,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -220,6 +220,8 @@ class AgentController:
|
||||
logger.info(event, extra={'msg_type': 'OBSERVATION'})
|
||||
elif isinstance(event, ErrorObservation):
|
||||
logger.info(event, extra={'msg_type': 'OBSERVATION'})
|
||||
if self.state.agent_state == AgentState.ERROR:
|
||||
self.state.metrics.merge(self.state.local_metrics)
|
||||
|
||||
def reset_task(self):
|
||||
"""Resets the agent's task."""
|
||||
|
||||
Reference in New Issue
Block a user